Description
An effect of moving to a delegation model for $ref
(see #514) is that there is no longer any need to forbid adjacent keywords. This was mentioned in passing in the first comment but I wanted to call it out to get clear agreement (without getting bogged down in the very long and nicely resolved #514).
The resolution to #514 allows implementations to do inclusions under certain circumstances. This can be made to work with adjacent keywords by simply stuffing the included target under an allOf
:
{
"$defs": {
"foo": {"required": ["f"]}
},
"required": ["a", "b"],
"$ref": {"#/$defs/foo"}
}
is equivalent to
{
"required": ["a", "b"],
"allOf": [{"required": ["f"]}]
}
If there is already an adjacent allOf
, the included $ref
is simply appended to the existing list.
Any objections? It's extremely common to see people put keywords beside $ref
even with all documentation saying that it is not allowed, so we really should make it more intuitive.