Skip to content

spec: remove/change extending meta-schemas recommendation #86

Closed
@epoberezkin

Description

@epoberezkin

https://github.com/json-schema-org/json-schema-spec/blob/master/jsonschema-core.xml#L254

The suggestion to extend meta-schemas using allOf (assuming that one of subschemas is $ref) is not feasible because meta-schemas are recursive and they have references to the meta-schema itself ("#"). Therefore if meta-schema is extended using $ref to the original meta-schema the # ref in that meta-schema will not point to the extended one, it will still point to the original, so the schemas would not be properly validated.

The only working meta-schema extension mechanism at the moment is copy-pasting and adding keywords, suggestion to use allOf is misleading because it implies $ref.

We have several options:

  1. Suggest copy-pasting with explanation why it is the only working option
  2. Adopt $merge/$patch keywords proposed by @fge
  3. Drop this suggestion from this version of the spec until we agree what is the right thing.

Happy to draft 1, can draft 2 as well...

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarificationItems that need to be clarified in the specificationcore

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions