Class: Jsapi::Meta::Schema::Discriminator
- Inherits:
-
Base::Model
- Object
- Base::Model
- Jsapi::Meta::Schema::Discriminator
- Defined in:
- lib/jsapi/meta/schema/discriminator.rb
Constant Summary
Constants included from Base::Attributes
Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH
Instance Method Summary collapse
-
#mappings ⇒ Object
:attr: mappings.
-
#property_name ⇒ Object
:attr: property_name.
-
#to_openapi(version) ⇒ Object
Returns a hash representing the OpenAPI discriminator object.
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::Base::Model
Instance Method Details
#mappings ⇒ Object
:attr: mappings
9 |
# File 'lib/jsapi/meta/schema/discriminator.rb', line 9 attribute :mappings, { Object => String } |
#property_name ⇒ Object
:attr: property_name
13 |
# File 'lib/jsapi/meta/schema/discriminator.rb', line 13 attribute :property_name, String |
#to_openapi(version) ⇒ Object
Returns a hash representing the OpenAPI discriminator object.
16 17 18 19 20 21 22 23 24 |
# File 'lib/jsapi/meta/schema/discriminator.rb', line 16 def to_openapi(version, *) version = OpenAPI::Version.from(version) return property_name if version.major == 2 { propertyName: property_name, mapping: mappings.transform_keys(&:to_s).presence }.compact end |