Closed franckweb closed 2 years ago
I'm trying to validate employee id to be an integer but the following does not throw any errors.
Data:
{ "id": 824, "employee": { "id": "text" } }
Schema:
{ "type": "object", "properties": { "id": { "type": "integer", "minimum": 1 }, "employee": { "$ref": "#/$defs/employee" } }, "$defs": { "employee": { "type": "object", "title": "Employee", "·properties": { "id": { "type": "integer" } }, } } }
And when I add "required": ["id", "name"] inside "employee" definition I do get following error as expected since "name" property is not present:
"required": ["id", "name"]
array(1) { ["/employee"]=> array(1) { [0]=> string(42) "The required properties (name) are missing" } }
Note: The "id" of the first object does validate integer vs string type.
Any idea why this is happening? I'm trying to do a clean POC for Opis Json Schema. Any help appreciated.
Fixed! "properties" key inside "employee" had an extra space. Looks like Prettier did not format it correctly!
I'm trying to validate employee id to be an integer but the following does not throw any errors.
Data:
Schema:
And when I add
"required": ["id", "name"]
inside "employee" definition I do get following error as expected since "name" property is not present:Note: The "id" of the first object does validate integer vs string type.
Any idea why this is happening? I'm trying to do a clean POC for Opis Json Schema. Any help appreciated.