I am using the npm package quicktype to generate json schema from sample json files. I am using these schema files later on in the openapispec file and then generating documentation as well as SDK using the openapi generator tool.
The problem is that quicktype generates draft6 json schema by default and the open api generator cannot read/understand anything above draft4.
I have tried a few json schema generators and found that quicktype is pretty close to what is required and would like to continue to use it.
Any ideas on whether it could be possible to use quicktype to generate draft4 schema ?
Edit: Adding an example. A simplified draft4 schema would be something like this
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "",
"type": "object",
"properties": {
"property1": {
"type": "string",
"minLength": 1
},
"property2": {
"type": "string",
"minLength": 1
}
}
}
Now a draft6 schema generated using quicktype would be something like this
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/MyObject",
"definitions": {
"MyObject": {
"type": "object",
"additionalProperties": false,
"properties": {
"property1": {
"type": "string"
},
"property2": {
"type": "string"
}
}
}
}
}