Class: OpenApi2JsonSchema::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/open_api_2_json_schema/converter.rb

Constant Summary collapse

NOT_SUPPORTED =
[
  'nullable', 'readOnly',
  'writeOnly', 'xml', 'externalDocs',
  'example', 'deprecated'
]
STRUCTS =
['allOf', 'anyOf', 'oneOf', 'not', 'items', 'additionalProperties', 'schema', 'discriminator']
VALID_TYPES =
['integer', 'number', 'string', 'boolean', 'object', 'array', 'null']
VALID_FORMATS =
['date-time', 'email', 'hostname', 'ipv4', 'ipv6', 'uri', 'uri-reference']
MIN_INT_32 =
0 - 2 ** 31
MAX_INT_32 =
2 ** 31 - 1
MIN_INT_64 =
0 - 2 ** 63
MAX_INT_64 =
2 ** 63 - 1
MIN_FLOAT =
0 - 2 ** 128
MAX_FLOAT =
2 ** 128 - 1
MAX_DOUBLE =
1.7976931348623157e+308
MIN_DOUBLE =
0 - MAX_DOUBLE
BYTE_PATTERN =
'^[\\w\\d+\\/=]*$'

Instance Method Summary collapse

Instance Method Details

#convert(schema) ⇒ Object



22
23
24
25
26
# File 'lib/open_api_2_json_schema/converter.rb', line 22

def convert(schema)
  convert_schema(schema).tap do |json_schema|
    json_schema['$schema'] = 'http://json-schema.org/draft-04/schema#'
  end.to_json
end