json-schema-org / json-schema-spec

The JSON Schema specification
http://json-schema.org/
Other
3.82k stars 266 forks source link

Consolidate language around duplicate schema IRIs #1271

Closed handrews closed 2 years ago

handrews commented 2 years ago

The spec mentions duplicate IRIs in two places with slightly different requiremetns:

§8.2.2 "Defining location-independent identifiers (last paragraph):

The effect of specifying the same fragment name multiple times within the same resource, using any combination of "$anchor" and/or "$dynamicAnchor", is undefined. Implementations MAY raise an error if such usage is detected.

§9.1.2 "Loading a referenced schema" (last paragraph):

A schema MAY (and likely will) have multiple IRIs, but there is no way for an IRI to identify more than one schema. When multiple schemas try to identify as the same IRI, validators SHOULD raise an error condition.

It would be good to have 8.2.2 refer to 9.1.2 (as it is more general), so that the "SHOULD raise an error" requirement is consistent regardless of how the schemas came to have the same IRI.