Validation in a custom definition property is not throwing any error
Closed this issue · 1 comments
franckweb commented
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:
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.
franckweb commented
Fixed!
"properties" key inside "employee" had an extra space. Looks like Prettier did not format it correctly!