Class: Jsapi::Meta::Schema::Array
- Inherits:
-
Base
- Object
- Base::Model
- Base
- Jsapi::Meta::Schema::Array
- Defined in:
- lib/jsapi/meta/schema/array.rb
Constant Summary
Constants included from Base::Attributes
Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH
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, #default_value, #deprecated, #description, #enum, #enum=, #examples, #existence, #external_docs, #initialize, #nullable?, #omittable?, #title, #type
Methods included from OpenAPI::Extensions
#add_openapi_extension, #openapi_extensions, #openapi_extensions=
Methods inherited from Base::Model
#initialize, #inspect, #merge!, #reference?, #resolve
Methods included from Base::Attributes
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.
10 |
# File 'lib/jsapi/meta/schema/array.rb', line 10 attribute :items, Schema |
#items=(keywords = {}) ⇒ Object
:nodoc:
24 25 26 27 28 29 30 |
# File 'lib/jsapi/meta/schema/array.rb', line 24 def items=(keywords = {}) # :nodoc: if keywords.key?(:schema) keywords = keywords.dup keywords[:ref] = keywords.delete(:schema) end @items = Schema.new(keywords) end |
#max_items ⇒ Object
:attr: max_items The maximum length of an array.
15 |
# File 'lib/jsapi/meta/schema/array.rb', line 15 attribute :max_items |
#max_items=(value) ⇒ Object
:nodoc:
32 33 34 35 |
# File 'lib/jsapi/meta/schema/array.rb', line 32 def max_items=(value) # :nodoc: add_validation('max_items', Validation::MaxItems.new(value)) @max_items = value end |
#min_items ⇒ Object
:attr: min_items The minimum length of an array.
20 |
# File 'lib/jsapi/meta/schema/array.rb', line 20 attribute :min_items |
#min_items=(value) ⇒ Object
:nodoc:
37 38 39 40 |
# File 'lib/jsapi/meta/schema/array.rb', line 37 def min_items=(value) # :nodoc: add_validation('min_items', Validation::MinItems.new(value)) @min_items = value end |
#to_json_schema ⇒ Object
:nodoc:
42 43 44 |
# File 'lib/jsapi/meta/schema/array.rb', line 42 def to_json_schema # :nodoc: super.merge(items: items&.to_json_schema || {}) end |
#to_openapi(version) ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/jsapi/meta/schema/array.rb', line 46 def to_openapi(version, *) # :nodoc: super.merge(items: items&.to_openapi(version) || {}) end |