Open vetsin opened 8 months ago
Thank you. Maybe this part?
In drafts 06 and 07 $defs keyword was named definitions, this has changed starting with draft 2019-09. Don’t worry, definitions can still be used (you can use any name, it doesn’t really matter).
I will think about how to fix it.
Certainly other JSON Schema Validators behave that way too. https://www.jsonschemavalidator.net/
{
"type": "object",
"properties": {
"username": {"$ref": "#/foobar/custom-username"},
"aliases": {
"type": "array",
"items": {"$ref": "#/foobar/custom-username"}
},
"primary_email": {"$ref": "#/foobar/custom-email"},
"other_emails": {
"type": "array",
"items": {"$ref": "#/foobar/custom-email"}
}
},
"foobar": {
"custom-username": {
"type": "string",
"minLength":3
},
"custom-email": {
"type": "string",
"format": "email",
"pattern": "\\.com$"
}
}
}
reference: https://opis.io/json-schema/2.x/definitions.html
currently
#/$defs
is expected, as literal, when the spec states$defs
ordefinitions
is valid. But even more specifically it states any name is valid, ergo it should be looked up instead.