I installed “json-schema-faker” (and then grunt and grunt-cli)
and I took a default schema from this site: https://jsonschema.net/ ; and put in the following file:
`var jsf = require("json-schema-faker");
const schema = {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "http://example.com/example.json",
"title": "Root Schema",
"type": "object",
"default": {},
"required": [
"checked",
"dimensions",
"id",
"name",
"price",
"tags"
],
"properties": {
"checked": {
"title": "The checked Schema",
"type": "boolean",
"default": false
},
"dimensions": {
"title": "The dimensions Schema",
"type": "object",
"default": {},
"required": [
"width",
"height"
],
"properties": {
"width": {
"title": "The width Schema",
"type": "integer",
"default": 0
},
"height": {
"title": "The height Schema",
"type": "integer",
"default": 0
}
}
},
"id": {
"title": "The id Schema",
"type": "integer",
"default": 0
},
"name": {
"title": "The name Schema",
"type": "string",
"default": ""
},
"price": {
"title": "The price Schema",
"type": "number",
"default": 0.0
},
"tags": {
"title": "The tags Schema",
"type": "array",
"default": [],
"items": {
"title": "A Schema",
"type": "string"
}
}
}
}
var sample = jsf(schema);
console.log(sample);`
However when I execute it (node filename.js), I get an error:
Error: Unsupported schema version (v4 only)
at Object.module.exports [as normalizeSchema] (C:UsersnillaDesktopjson-fakernode_modulesdereflibutilnormalize-schema.js:53:11)
Generally it works and I guess even worked. But after I installed grunt or grunt-cli or grunt-init, it stopped working and I don’t know how to change it to v4. On the web-site mentioned above it’s possible to change version to “draft 4” or “draft 7”, but I did not help.
Do you know how to change json schema to v4?
I executed the file with “node filename.js” and a json should have been printed to the console, but now it gives me the error.