Class: Eazypi::Schema::Array
- Inherits:
-
Object
- Object
- Eazypi::Schema::Array
- Defined in:
- lib/eazypi/schema/array.rb
Overview
Array schema for JSON
Instance Attribute Summary collapse
-
#item_schema ⇒ Object
readonly
Returns the value of attribute item_schema.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #collect_components(schemas: nil, **kwargs) ⇒ Object
-
#initialize(item_schema) ⇒ Array
constructor
A new instance of Array.
- #to_openapi_spec ⇒ Object
Constructor Details
#initialize(item_schema) ⇒ Array
Returns a new instance of Array.
9 10 11 |
# File 'lib/eazypi/schema/array.rb', line 9 def initialize(item_schema) @item_schema = item_schema end |
Instance Attribute Details
#item_schema ⇒ Object (readonly)
Returns the value of attribute item_schema.
7 8 9 |
# File 'lib/eazypi/schema/array.rb', line 7 def item_schema @item_schema end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 29 30 |
# File 'lib/eazypi/schema/array.rb', line 26 def ==(other) return false unless other.is_a?(Array) other.instance_variable_get(:@item_schema) == @item_schema end |
#collect_components(schemas: nil, **kwargs) ⇒ Object
13 14 15 16 17 |
# File 'lib/eazypi/schema/array.rb', line 13 def collect_components(schemas: nil, **kwargs) schemas&.call(@item_schema) @item_schema.collect_components(schemas: schemas, **kwargs) end |
#to_openapi_spec ⇒ Object
19 20 21 22 23 24 |
# File 'lib/eazypi/schema/array.rb', line 19 def to_openapi_spec { "type" => "array", "items" => item_schema.to_openapi_spec } end |