Skip to content

support anyOf, allOf, oneOf, and not, in applyDefaults #52

@andy-miracl

Description

@andy-miracl

This is subtle, e.g. with anyOf it is possible that the data matches several subschemas each with different default values. Do we apply (a) the first default, (b) the defaults in turn (ordering of map is not necessarily the same as the original schema data file), (c) the first default providing there are no other schemas providing defaults, (d) no defaults (unless there is a single matching subschema).

Similar issue for allOf, do we apply the defaults of each subschema in turn, overriding where necessary?

For oneOf, we must check that the data matches a unique subschema, if it matches more than one then we cannot reliably determine which default (from which subschema) to apply.

not is easy, since the data must never match any of the subschemas we know never to apply any of these defaults.

e.g.
https://spacetelescope.github.io/understanding-json-schema/reference/combining.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions