Class: Yori::Schema::V3::Discriminator
- Inherits:
-
Yori::SchemaBase
- Object
- Hash
- Yori::SchemaBase
- Yori::Schema::V3::Discriminator
- Defined in:
- lib/yori/schema/v3/discriminator.rb
Overview
Discriminator
When request bodies or response payloads may be one of a number of different schemas,
a discriminator object can be used to aid in serialization, deserialization, and validation.
The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.
When using the discriminator, inline schemas will not be considered.
Instance Attribute Summary
Attributes inherited from Yori::SchemaBase
Instance Method Summary collapse
-
#mapping ⇒ Object
An object to hold mappings between payload values and schema names or references.
-
#propertyName ⇒ Object
REQUIRED.
- #validate! ⇒ Object
Methods inherited from Yori::SchemaBase
eval_class!, eval_hash!, eval_input!, #ref, #validator
Instance Method Details
#mapping ⇒ Object
An object to hold mappings between payload values and schema names or references.
17 |
# File 'lib/yori/schema/v3/discriminator.rb', line 17 hash_field :mapping, :map |
#propertyName ⇒ Object
REQUIRED. The name of the property in the payload that will hold the discriminator value.
14 |
# File 'lib/yori/schema/v3/discriminator.rb', line 14 fields :propertyName |
#validate! ⇒ Object
19 20 21 |
# File 'lib/yori/schema/v3/discriminator.rb', line 19 def validate! validate_require_fields!('propertyName') end |