Class: Graphiti::OpenAPI::Attribute

Inherits:
AttributeData show all
Defined in:
app/models/graphiti/open_api/attribute.rb

Instance Method Summary collapse

Instance Method Details

#to_propertyObject



22
23
24
25
26
27
28
29
30
# File 'app/models/graphiti/open_api/attribute.rb', line 22

def to_property
  return {} unless readable || writable

  definition = type.to_schema
  definition[:description] = description if description
  definition[:readOnly] = readable unless writable
  definition[:writeOnly] = writable unless readable
  {name => definition}
end

#typeObject



18
19
20
# File 'app/models/graphiti/open_api/attribute.rb', line 18

def type
  schema.types[__attributes__[:type].to_sym]
end