Class: Jsapi::Meta::Schema::Array
- Inherits:
-
Base
- Object
- Model::Base
- Base
- Jsapi::Meta::Schema::Array
- Defined in:
- lib/jsapi/meta/schema/array.rb
Defined Under Namespace
Classes: Wrapper
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#items ⇒ Object
:attr: items The Schema defining the kind of items.
-
#items=(keywords = {}) ⇒ Object
:nodoc:.
-
#max_items ⇒ Object
:attr: max_items The maximum length of an array.
-
#max_items=(value) ⇒ Object
:nodoc:.
-
#min_items ⇒ Object
:attr: min_items The minimum length of an array.
-
#min_items=(value) ⇒ Object
:nodoc:.
-
#to_json_schema ⇒ Object
:nodoc:.
-
#to_openapi(version) ⇒ Object
:nodoc:.
Methods inherited from Base
#default, #deprecated, #description, #enum, #enum=, #examples, #existence, #external_docs, #initialize, #nullable?, #omittable?, #title, #type
Methods included from OpenAPI::Extensions
Methods inherited from Model::Base
#initialize, #inspect, #merge!, #reference?, #resolve
Methods included from Model::Attributes
#attributes_frozen?, #freeze_attributes, included
Constructor Details
This class inherits a constructor from Jsapi::Meta::Schema::Base
Instance Method Details
#items ⇒ Object
:attr: items The Schema defining the kind of items.
16 |
# File 'lib/jsapi/meta/schema/array.rb', line 16 attribute :items, Schema, accessors: %i[reader] |
#items=(keywords = {}) ⇒ Object
:nodoc:
28 29 30 31 32 33 34 35 36 |
# File 'lib/jsapi/meta/schema/array.rb', line 28 def items=(keywords = {}) # :nodoc: try_modify_attribute!(:items) do if keywords.key?(:schema) keywords = keywords.dup keywords[:ref] = keywords.delete(:schema) end @items = Schema.new(keywords) end end |
#max_items ⇒ Object
:attr: max_items The maximum length of an array.
21 |
# File 'lib/jsapi/meta/schema/array.rb', line 21 attribute :max_items, accessors: %i[reader] |
#max_items=(value) ⇒ Object
:nodoc:
38 39 40 41 42 43 |
# File 'lib/jsapi/meta/schema/array.rb', line 38 def max_items=(value) # :nodoc: try_modify_attribute!(:max_items) do add_validation('max_items', Validation::MaxItems.new(value)) @max_items = value end end |
#min_items ⇒ Object
:attr: min_items The minimum length of an array.
26 |
# File 'lib/jsapi/meta/schema/array.rb', line 26 attribute :min_items, accessors: %i[reader] |
#min_items=(value) ⇒ Object
:nodoc:
45 46 47 48 49 50 |
# File 'lib/jsapi/meta/schema/array.rb', line 45 def min_items=(value) # :nodoc: try_modify_attribute!(:min_items) do add_validation('min_items', Validation::MinItems.new(value)) @min_items = value end end |
#to_json_schema ⇒ Object
:nodoc:
52 53 54 |
# File 'lib/jsapi/meta/schema/array.rb', line 52 def to_json_schema # :nodoc: super.merge(items: items&.to_json_schema || {}) end |
#to_openapi(version) ⇒ Object
:nodoc:
56 57 58 |
# File 'lib/jsapi/meta/schema/array.rb', line 56 def to_openapi(version, *) # :nodoc: super.merge(items: items&.to_openapi(version) || {}) end |