Module: JSONSchemer::OpenAPI31

Defined in:
lib/json_schemer/openapi31/meta.rb,
lib/json_schemer/openapi31/vocab.rb,
lib/json_schemer/openapi31/document.rb,
lib/json_schemer/openapi31/vocab/base.rb

Defined Under Namespace

Modules: Document, Meta, Vocab

Constant Summary collapse

BASE_URI =
URI('https://spec.openapis.org/oas/3.1/dialect/base')
FORMATS =
{
  'int32' => proc { |instance, _format| instance.is_a?(Integer) && instance.bit_length <= 32 },
  'int64' => proc { |instance, _format| instance.is_a?(Integer) && instance.bit_length <= 64 },
  'float' => proc { |instance, _format| instance.is_a?(Float) },
  'double' => proc { |instance, _format| instance.is_a?(Float) },
  'password' => proc { |_instance, _format| true }
}
SCHEMA =
{
  '$id' => 'https://spec.openapis.org/oas/3.1/dialect/base',
  '$schema' => 'https://json-schema.org/draft/2020-12/schema',

  'title' => 'OpenAPI 3.1 Schema Object Dialect',
  'description' => 'A JSON Schema dialect describing schemas found in OpenAPI documents',

  '$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,
    'https://spec.openapis.org/oas/3.1/vocab/base' => false
  },

  '$dynamicAnchor' => 'meta',

  'allOf' => [
    { '$ref' => 'https://json-schema.org/draft/2020-12/schema' },
    { '$ref' => 'https://spec.openapis.org/oas/3.1/meta/base' }
  ]
}