lib/json_schemer/draft202012/meta.rb in json_schemer-2.0.0 vs lib/json_schemer/draft202012/meta.rb in json_schemer-2.1.0
- old
+ new
@@ -1,9 +1,36 @@
# frozen_string_literal: true
module JSONSchemer
module Draft202012
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,
@@ -62,13 +89,10 @@
module Meta
CORE = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/core',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/core' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Core vocabulary meta-schema',
'type' => ['object', 'boolean'],
'properties' => {
'$id' => {
@@ -112,13 +136,10 @@
}
}
APPLICATOR = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/applicator',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/applicator' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Applicator vocabulary meta-schema',
'type' => ['object', 'boolean'],
'properties' => {
'prefixItems' => { '$ref' => '#/$defs/schemaArray' },
@@ -159,13 +180,10 @@
}
}
UNEVALUATED = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/unevaluated',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/unevaluated' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Unevaluated applicator vocabulary meta-schema',
'type' => ['object', 'boolean'],
'properties' => {
'unevaluatedItems' => { '$dynamicRef' => '#meta' },
@@ -173,13 +191,10 @@
}
}
VALIDATION = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/validation',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/validation' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Validation vocabulary meta-schema',
'type' => ['object', 'boolean'],
'properties' => {
'type' => {
@@ -270,13 +285,10 @@
}
}
META_DATA = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/meta-data',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/meta-data' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Meta-data vocabulary meta-schema',
'type' => ['object', 'boolean'],
'properties' => {
'title' => {
@@ -305,38 +317,29 @@
}
}
FORMAT_ANNOTATION = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/format-annotation',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/format-annotation' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Format vocabulary meta-schema for annotation results',
'type' => ['object', 'boolean'],
'properties' => {
'format' => { 'type' => 'string' }
}
}
FORMAT_ASSERTION = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/format-assertion',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/format-assertion' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Format vocabulary meta-schema for assertion results',
'type' => ['object', 'boolean'],
'properties' => {
'format' => { 'type' => 'string' }
}
}
CONTENT = {
'$schema' => 'https://json-schema.org/draft/2020-12/schema',
'$id' => 'https://json-schema.org/draft/2020-12/meta/content',
- '$vocabulary' => {
- 'https://json-schema.org/draft/2020-12/vocab/content' => true
- },
'$dynamicAnchor' => 'meta',
'title' => 'Content vocabulary meta-schema',
'type' => ['object', 'boolean'],
'properties' => {
'contentEncoding' => { 'type' => 'string' },