1.1.3 • Published 11 months ago
json-schema-artifact v1.1.3
Installation
npm install --save-dev json-schema-artifactUsage
- Create a file named
json-schema-artifact.jsonin the workspace root.
This configuration implies monitoring all files in the
srcdirectory and triggering a rebuild when changes occur. The build process utilizessrc/example.jsonas input and producesdist/example.jsonas output.If you have any internationalization (i18n) requirements, you can configure the locale field to specify the language file(in JSON format) to be used. In your source files, define keys in the format of t(`key`). If the corresponding key is not found in the language file, the key itself will be used as a fallback. This process will generate additional output files based on the configured locales.
You can find an example here.
{
"$schema": "node_modules/json-schema-artifact/schema/json-schema-artifact.json",
"watch": [
{
"dir": "src",
"recursive": true
}
],
"build": {
"target": [
{
"input": "src/example.json",
"output": "dist/example.json"
// "locale": {
// "ru": "test/locales/ru.json",
// "fa": "test/locales/fa.json"
// }
}
],
"optimize": {
"format": "minify", // or pretty
"refsDerefer": true
}
}
}- Start coding your JSON Schema with
watchon.
npx json-schema-artifact --watchYou can include the following similar configurations in the .vscode/settings.json file for validation.
"json.schemas": [
{
"url": "./dist/example.json",
"fileMatch": ["test/example-test-data.json"]
}
],- Bundle JSON Schema and check the output.
npx json-schema-artifact