Class: Graphiti::OpenAPI::Type

Inherits:
TypeData show all
Defined in:
app/models/graphiti/open_api/type.rb

Constant Summary collapse

TYPES_MAP =
Hash.new do |hash, type|
  hash[type] = {type: type}
end.merge(
  big_decimal: {type: :string, format: :decimal},
  hash: {type: :object, additionalProperties: true},
  datetime: {type: :string, format: :'date-time'},
  date: {type: :string, format: :date},
  time: {type: :string, format: :'date-time'},
  inet: {type: :string, format: :ipv4},
)

Instance Method Summary collapse

Instance Method Details

#canonical_nameObject



29
30
31
# File 'app/models/graphiti/open_api/type.rb', line 29

def canonical_name
  Graphiti::Types.name_for(name)
end

#dry_typeObject



25
26
27
# File 'app/models/graphiti/open_api/type.rb', line 25

def dry_type
  Graphiti::Types[name]
end

#to_schemaObject



33
34
35
# File 'app/models/graphiti/open_api/type.rb', line 33

def to_schema
  TYPES_MAP[canonical_name].dup
end