{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "#/$defs/Product",
"$defs": {
"Product": {
"properties": {
"id": {
"type": "integer"
},
"productType": {
"type": "string",
"enum": [
"Simple",
"Configurable",
"Grouped",
"Virtual",
"Bundle"
],
"maxLength": 20,
"minLength": 1,
"title": "product type",
"description": "product type",
"default": "Simple",
"examples": [
"Bundle",
"Configurable"
]
},
"product_date": {
"type": "string",
"format": "date-time",
"description": "Product date must be valid"
},
"productPrice": {
"$ref": "#/$defs/ProductPrice"
},
"tags": {
"type": "object",
"a": "b",
"foo": [
"bar",
"bar1"
]
}
},
"additionalProperties": false,
"type": "object",
"required": [
"id",
"productType",
"product_date",
"productPrice"
]
},
"ProductPrice": {
"properties": {
"regularPrice": {
"type": "number"
},
"markedPrice": {
"type": "number"
},
"discount": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"regularPrice",
"markedPrice"
]
}
}
}
I have this below json schema drafted with version 2020-12. I tested online here and also using this golang package. The schema is successfully parsed and could validate the json.
Using schemasafe I am getting error
Error: Unexpected keywords mixed with const or enum: ["maxLength","minLength"] at #/properties/productTypeCan you please check and see if there is any fix for this?
Jsonschema
I am getting error while parsing this jsonschema
Error: Unexpected keywords mixed with const or enum: ["maxLength","minLength"] at #/properties/productType