Module: JSONSchemer::Draft202012

Defined in:
lib/json_schemer/draft202012/meta.rb,
lib/json_schemer/draft202012/vocab.rb,
lib/json_schemer/draft202012/vocab/core.rb,
lib/json_schemer/draft202012/vocab/content.rb,
lib/json_schemer/draft202012/vocab/meta_data.rb,
lib/json_schemer/draft202012/vocab/applicator.rb,
lib/json_schemer/draft202012/vocab/validation.rb,
lib/json_schemer/draft202012/vocab/unevaluated.rb,
lib/json_schemer/draft202012/vocab/format_assertion.rb,
lib/json_schemer/draft202012/vocab/format_annotation.rb

Defined Under Namespace

Modules: Meta, Vocab

Constant Summary collapse

BASE_URI =
URI('https://json-schema.org/draft/2020-12/schema')
FORMATS =
{
  'date-time' => Format::DATE_TIME,
  'date' => Format::DATE,
  'time' => Format::TIME,
  'duration' => Format::DURATION,
  'email' => Format::EMAIL,
  'idn-email' => Format::IDN_EMAIL,
  'hostname' => Format::HOSTNAME,
  'idn-hostname' => Format::IDN_HOSTNAME,
  'ipv4' => Format::IPV4,
  'ipv6' => Format::IPV6,
  'uri' => Format::URI,
  'uri-reference' => Format::URI_REFERENCE,
  'iri' => Format::IRI,
  'iri-reference' => Format::IRI_REFERENCE,
  'uuid' => Format::UUID,
  'uri-template' => Format::URI_TEMPLATE,
  'json-pointer' => Format::JSON_POINTER,
  'relative-json-pointer' => Format::RELATIVE_JSON_POINTER,
  'regex' => Format::REGEX
}
CONTENT_ENCODINGS =
{
  'base64' => ContentEncoding::BASE64
}
CONTENT_MEDIA_TYPES =
{
  'application/json' => ContentMediaType::JSON
}
SCHEMA =
{
  '$schema' => 'https://json-schema.org/draft/2020-12/schema',
  '$id' => 'https://json-schema.org/draft/2020-12/schema',
  '$vocabulary' => {
    'https://json-schema.org/draft/2020-12/vocab/core' => true,
    'https://json-schema.org/draft/2020-12/vocab/applicator' => true,
    'https://json-schema.org/draft/2020-12/vocab/unevaluated' => true,
    'https://json-schema.org/draft/2020-12/vocab/validation' => true,
    'https://json-schema.org/draft/2020-12/vocab/meta-data' => true,
    'https://json-schema.org/draft/2020-12/vocab/format-annotation' => true,
    'https://json-schema.org/draft/2020-12/vocab/content' => true
  },
  '$dynamicAnchor' => 'meta',
  'title' => 'Core and Validation specifications meta-schema',
  'allOf' => [
    {'$ref' => 'meta/core'},
    {'$ref' => 'meta/applicator'},
    {'$ref' => 'meta/unevaluated'},
    {'$ref' => 'meta/validation'},
    {'$ref' => 'meta/meta-data'},
    {'$ref' => 'meta/format-annotation'},
    {'$ref' => 'meta/content'}
  ],
  'type' => ['object', 'boolean'],
  '$comment' => 'This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.',
  'properties' => {
    'definitions' => {
      '$comment' => '"definitions" has been replaced by "$defs".',
      'type' => 'object',
      'additionalProperties' => { '$dynamicRef' => '#meta' },
      'deprecated' => true,
      'default' => {}
    },
    'dependencies' => {
      '$comment' => '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
      'type' => 'object',
      'additionalProperties' => {
        'anyOf' => [
          { '$dynamicRef' => '#meta' },
          { '$ref' => 'meta/validation#/$defs/stringArray' }
        ]
      },
      'deprecated' => true,
      'default' => {}
    },
    '$recursiveAnchor' => {
      '$comment' => '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
      '$ref' => 'meta/core#/$defs/anchorString',
      'deprecated' => true
    },
    '$recursiveRef' => {
      '$comment' => '"$recursiveRef" has been replaced by "$dynamicRef".',
      '$ref' => 'meta/core#/$defs/uriReferenceString',
      'deprecated' => true
    }
  }
}