Open awallat opened 11 months ago
Hi @awallat , to answer your last question first – yes, I do plan to add unevaluatedProperties
, but not in this version. I have had a new version under development for some time now, and this will include the full 2020-12 spec, but I'm afraid I can't yet say when that will be available.
But to go back to your problem – the preferred method for extending a schema is:
"allOf": [
{
"$ref": "original.schema.json"
},
{
"properties": {
"newProp": {
"description": "New property, or additional validations on an existing property"
}
}
}
]
Would some variation on this technique meet your needs?
Thank you for the info!
The "preferred method" unfortunately doesn't meet my needs. I do not want to allow additional properties and throw an error if there's a property in the JSON document which is not expected. When I add "additionalProperties": false
it seems always to be releated to one of the items defined in the allOf
-array and not for the union or the extended definition, when setting like this:
"additionalProperties": false,
"allOf": [ ... ]
For my project I need to extend an already defined schema by a few other properties. My current solution is to include the schema as a
$ref
and by usingadditionalProperties: false
. However in my extended schema I need to redefine all properties from the reference, likeAs I understand this can be prevented by using
unevaluatedProperties
. Is there a plan to support this anytime soon?Thanks for this great library!