Skip to content

Review draft-08/core/9.4 - $defs: Clarify its a recommendation #778

Closed
@about-code

Description

@about-code

In requests for reviewing draft-08 I would like to comment on

Core-Spec, Section 9.4. Schema Re-Use With "$defs"

The "$defs" keyword provides a standardized location for schema authors to inline re-usable JSON Schemas into a more general schema. [...]

In the original issue #512 @handrews stated that $defs is actually more of a recommendation while definitions and basically any other arbitrary keys (see #512 (comment)) should continue to work, too.

Reading previous versions of the specification as well as draft-08, though, it is easy to read it as if $defs (and formerly definitions) were the only possible spec-conformant place where to put subschemas. It is not very clear that it has been a recommendation. I guess the fine distinction to catch is the use of the phrase a standardized location rather than the standardized location and an absence of MUST. However, standardized sounds more reliable than it obviously is and doesn't indicate a recommendation at all.

I think the spec would profit from using the wording the recommended location or from becoming even more clear with something like

It MUST NOT be assumed that $defs is the only permitted location for subschemas. This is, because schemas and subschemas are identified by an URI which itself is agnostic to the actual keyword used to locate subschemas (see 8.3.2 Dereferencing). Schema authors SHOULD consider using $defs over any alternative for conventional purposes, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clarificationItems that need to be clarified in the specification

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions