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:
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:
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:
Specification version - parsing schemas might behave differently depending on version value.
Evaluator Factory - class responsible for the creation of evaluators which in turn contain (mostly) validation logic.
Meta-schema URI (optional) - every schema in this dialect must be valid against this meta-schema.
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 | |||||
Evaluator factory | |||||
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 |
|
| - | - | - |
Required vocabs |
|
| - | - | - |
Custom dialects
Please see a dedicated chapter Custom dialects.