Using the schema
{
"type": "object",
"required": [
"person",
"animal"
],
"person": {
"title": "person",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
}
},
"animal": {
"title": "animal",
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
}
}
This schema is valid when it is compared against this object
{
"person": 0,
"animal": "dog"
}
I only want it to validate for the properties within person object (as it also has required properties). For example, only the following would be valid:
{
"person": {
"name": "myName"
},
"animal": "dog"
}
How can I ensure nested objects are validated in my schema using AJV?