Skip to content

require $schema in schemas #1434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions jsonschema-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ The `$schema` keyword is both used as a JSON Schema dialect identifier and as
the identifier of a resource which is itself a JSON Schema, which describes the
set of valid schemas written for this particular dialect.

The value of this keyword MUST be a [IRI](#rfc3987) (containing a scheme) and
The value of this keyword MUST be an [IRI](#rfc3987) (containing a scheme) and
this IRI MUST be normalized. The current schema MUST be valid against the
meta-schema identified by this IRI.

Expand All @@ -895,14 +895,22 @@ type `application/schema+json`.

The `$schema` keyword SHOULD be used in the document root schema object, and MAY
be used in the root schema objects of embedded schema resources. It MUST NOT
appear in non-resource root schema objects. If absent from the document root
schema, the resulting behavior is implementation-defined, but MUST fall within
the following options:

- Refuse to process the schema, as with unsupported required vocabularies
- Assume a specific, documented meta-schema
- Document the process by which it examines the schema and determines which of a
specific set of meta-schemas to assume
appear in non-resource root schema objects.

If present in the document root schema, an implementation MUST process the
schema in accordance with the associated dialect.

If absent from the document root schema, and an `application/schema+json` media
type with a `schema` parameter is available, then the schema MUST be processed
in accordance with the dialect indicated by the `schema` parameter.

For cases where the `$schema` keyword is absent from the document root, no media
type is provided, and/or the media type has no `schema` parameter, an
implementation MAY offer a mechanism for the user to explicitly set the
dialect.

If the dialect is not specified through one of these methods, the implementation
MUST refuse to process the schema, as with unsupported required vocabularies.

Values for this property are defined elsewhere in this and other documents, and
by other parties.
Expand Down