dev.harrel:json-schema Help

Dialects

Officially supported dialects (JSON Schema specification versions):

  • Draft 2020-12,

  • Draft 2019-09,

  • Draft 07,

  • Draft 06,

  • Draft 04.

It is automatically inferred (by the value of the $schema keyword) which dialect to use. If a schema does not contain the $schema keyword, the default dialect will be used, which is draft 2020-12 dialect. It's possible to change the default dialect by calling:

new ValidatorFactory().withDefaultDialect(new Dialects.Draft2019Dialect());

Meta-schemas

Each schema is recommended to contain the $schema keyword to properly infer which dialect to use. $schema keyword must refer to a meta-schema against which the current schema will be validated. Resolution of meta-schemas follows the same rules as for regular schemas.

There is a configuration option that disables all schema validations:

new ValidatorFactory().withDisabledSchemaValidation(true);

Note that this option will also turn off meta-schema resolution mechanics and will fall back to the matching predefined dialect or the default one.

Importance of dialects

Every schema needs to be understood in the context of a specific dialect. Dialects consist of a few vital parts:

  1. Specification version - parsing schemas might behave differently depending on version value.

  2. Evaluator Factory - class responsible for the creation of evaluators which in turn contain (mostly) validation logic.

  3. Meta-schema URI (optional) - every schema in this dialect must be valid against this meta-schema.

  4. Vocabularies (optional) - first appeared in the Draft 2019-09 specification, but it's not strictly limited to the newest versions only. You can define which vocabularies are supported, required and enabled by default.

Draft 2020-12

Draft 2019-09

Draft 07

Draft 06

Draft 04

Spec version

SpecificationVersion.DRAFT2020_12

SpecificationVersion.DRAFT2019_09

SpecificationVersion.DRAFT7

SpecificationVersion.DRAFT6

SpecificationVersion.DRAFT4

Evaluator factory

Draft2020EvaluatorFactory

Draft2019EvaluatorFactory

Draft7EvaluatorFactory

Draft6EvaluatorFactory

Draft4EvaluatorFactory

Meta-schema

https://json-schema.org/draft/2020-12/schema

https://json-schema.org/draft/2019-09/schema

http://json-schema.org/draft-07/schema#

http://json-schema.org/draft-06/schema#

http://json-schema.org/draft-04/schema#

Supported vocabs

  • https://json-schema.org/draft/2020-12/vocab/core

  • https://json-schema.org/draft/2020-12/vocab/applicator

  • https://json-schema.org/draft/2020-12/vocab/unevaluated

  • https://json-schema.org/draft/2020-12/vocab/validation

  • https://json-schema.org/draft/2020-12/vocab/meta-data

  • https://json-schema.org/draft/2020-12/vocab/format-annotation

  • https://json-schema.org/draft/2020-12/vocab/format-assertion

  • https://json-schema.org/draft/2020-12/vocab/content

  • https://json-schema.org/draft/2019-09/vocab/core

  • https://json-schema.org/draft/2019-09/vocab/applicator

  • https://json-schema.org/draft/2019-09/vocab/validation

  • https://json-schema.org/draft/2019-09/vocab/meta-data

  • https://json-schema.org/draft/2019-09/vocab/format

  • https://json-schema.org/draft/2019-09/vocab/content

-

-

-

Required vocabs

  • https://json-schema.org/draft/2020-12/vocab/core

  • https://json-schema.org/draft/2019-09/vocab/core

-

-

-

Custom dialects

Please see a dedicated chapter Custom dialects.

04 August 2025