json-schema-generator
json-schema-generator copied to clipboard
json-schema-generator doesn't handle arrays of primitives correctly
When given an object like:
{myArray: ['one', 'two']}
The generator creates a schema like the following:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "",
"properties": {
"myArray": {
"type": "array",
"items": {
"required": [],
"properties": {}
}
}
},
"required": ["myArray"],
"type": "object"
}
The "items" should instead be something like:
"items": {
"type": "string",
"minLength": 1
}
The currently-generated schema breaks validators like ajv.
Thanks for the heads up. I'll take a look.
+1 : Subscribing
Occur the same problem. I think the priority of the problem could be p0, because mostly we use generator for output and ajv for input in a normal build process @krg7880
@krg7880 Any updates on this?
Yes. Same problem here. Fix available ?
But, the online version generates well. https://www.liquid-technologies.com/online-json-to-schema-converter
I also faced the same issue recently by generating form from generated json schema, have you find any solution to this? thanks