Skip to content

Move "applicability" keywords to core #513

Closed
@handrews

Description

@handrews

The keywords in Section 3.1 "Applicability" of the Validation spec are not specific to Validation. Let's either move them to core or make them into their own vocabulary specificaton.

Any non-trivial vocabulary will need these applicability keywords, or a set of keywords with roughly equivalent functionality. Standardizing on this set will encourage interoperable vocabularies. If we want a truly minimal core specification, then factoring out applicability into its own document will still clarify what is recommended as the base for most vocabularies (core + applicability) while still allowing for a different approach to applicability based on a minimal core for vocabularies that really want to re-imagine this functionality.

Notably, with the applicability keywords factored out, the Hyper-Schema spec will no longer directly depend on the Validation spec. It will only need core (or core + applicability), and the general notion of assertions and annotations already described in core. This eliminates a "design smell" in the current system where hyper-schema requires implementing a specific set of assertions that are unrelated to the task of annotating a JSON document with hyperlinks.


In terms of the content, the first sentence of §3.1:

Validation begins by applying the root schema to the complete instance document.

can be changed to:

Schema evaluation begins by applying the root schema to the complete instance document.

The remainder of the section talks about "assertions" in general, rather than the validation vocabulary in particular.

The third paragraph currently has to awkwardly list the child applicability keywords out as they are mixed in with the array and object assertions. In the core spec or their own spec they would be grouped as a section and we could drop the list and just refer to the section. Another indication that this is a good idea: it simplifies the text.

Section 3.1.1 Keyword Independence would also be simplified, as it universally applies to all current assertions, but is not universal across applicability keywords. Right now we treat the additional* applicability keywords as exceptions to an assertion-oriented concept, which muddles things a bit.


Putting these keywords in core would make the minimum extensible JSON Schema implementation requirements involve:

  • identifying, organizing, and linking schemas ($ref, $id, $schema, and if Move "definitions" to core (as "$defs"?) #512 is accepted definitions)
  • providing an interface to evaluate assertions
  • providing an interface to collect annotations
  • applying subschemas to instances and combining assertion results and annotation data accordingly

Putting them in their own spec would leave the first three bullets as the minimal implementation, with the fourth being a strongly recommended baseline extension required for all json-schema.org assertion and annotation vocabularies (of which we currently have two).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions