The schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"oneOf": [
{
"if": {
"properties": {
"name": {
"const": "alice"
}
}
},
"then": {
"$ref": "#/definitions/alice"
}
}
],
"definitions": {
"alice": {
"type": "object",
"properties": {
"name": {
"const": "alice"
},
"age": {
"type": "number"
}
},
"required": ["name", "age"]
}
}
}
The object:
{
"name": "bob"
}
Basically, I don't understand why even though the name is bob and I want the name to be one of ["alice"], the JSON object still passes the validation.