![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@nodecg/json-schema-defaults
Advanced tools
A library and CLI tool for generating a default value from a JSON schema
A library and CLI tool for generating a default value from a JSON schema
npm install @nodecg/json-schema-defaults
Node (TypeScript/ESM)
import defaults from 'json-schema-defaults';
defaults({ ... });
CLI
If installed globally:
json-schema-defaults schema.json
If locally:
./node_modules/.bin/json-schema-defaults schema.json
Custom indentation (defaults to 2):
json-schema-defaults --indent 4 schema.json
Write into a file:
json-schema-defaults schema.json > defaults.json
Call defaults
with JSON Schema. The default values will be extracted as a JSON.
const json = defaults({
"title": "Album Options",
"type": "object",
"properties": {
"sort": {
"type": "string",
"default": "id"
},
"per_page": {
"default": 30,
"type": "integer"
}
}
});
// would return
{
sort: 'id',
per_page: 30
}
For more examples, see the tests.
Run tests
npm test
json-schema-defaults
on npm)(c) 2023 The NodeCG Project. Released under the terms of the MIT License.
FAQs
A library and CLI tool for generating a default value from a JSON schema
We found that @nodecg/json-schema-defaults demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.