Skip to content

Single-level overrides (more fun with additionalProperties/additionalItems) #313

Closed
@handrews

Description

@handrews

In an effort to get all options on the table for the next batch of work, yet another solution to the re-use with additionalProperties conundrum would be a simple single-level override of keywords.

This could either support all schema keywords, in which case it is a simpler version of #15 ($merge/$patch), or a limited subset of keywords such as non-validation keywords, in which case it is a simpler version of #98 ($use). It could use the $use syntax (assuming we would not implement both this and #98), or (as discussed in #98) it could just be handled by defining the behavior of other keywords alongside of $ref. In any approach, it avoids the nightmarish complexity of #119 ($combine).

A single-level override avoids having to make any choices about complex merge behavior, in particular that proposed for $combine. If keyword X is overridden, the entire old overridden value of X, including all subschemas, is disregarded in favor of the new overriding value.

While the reliance of standard media types means that $merge and $patch are easy to implement in practice, the possibilities of arbitrary editing makes it hard to reason about the results. Single-level overrides reduce those possibilities and make the effects more intuitive.

Finally, single-level overrides avoid the major complexity involved in the $use proposal, which is the need to filter out forbidden keywords at arbitrary depths from the with clause. If only a single level override is allowed, with no merging or other sort of deep editing, it is easy to check which keywords are being overridden at that single level and ensure that they meet any restrictions (e.g. that they are not validation keywords).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions