You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versions/3.0.4.md
+13-7Lines changed: 13 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -163,6 +163,8 @@ When parsing an OAD, JSON or YAML objects are parsed into specific Objects (such
163
163
164
164
If the same JSON/YAML object is parsed multiple times and the respective contexts require it to be parsed as _different_ Object types, the resulting behavior is _implementation defined_, and MAY be treated as an error if detected. An example would be referencing an empty Schema Object under `#/components/schemas` where a Path Item Object is expected, as an empty object is valid for both types. For maximum interoperability, it is RECOMMENDED that OpenAPI Description authors avoid such scenarios.
Primitive data types in the OAS are based on the types supported by the [JSON Schema Specification Wright Draft 00](https://tools.ietf.org/html/draft-wright-json-schema-00#section-4.2).
@@ -2647,7 +2649,7 @@ components:
2647
2649
]
2648
2650
},
2649
2651
"Cat": {
2650
-
"description": "A representation of a cat. Note that `Cat` will be used as the discriminator value.",
2652
+
"description": "A representation of a cat. Note that `Cat` will be used as the discriminating value.",
2651
2653
"allOf": [
2652
2654
{
2653
2655
"$ref": "#/components/schemas/Pet"
@@ -2674,7 +2676,7 @@ components:
2674
2676
]
2675
2677
},
2676
2678
"Dog": {
2677
-
"description": "A representation of a dog. Note that `Dog` will be used as the discriminator value.",
2679
+
"description": "A representation of a dog. Note that `Dog` will be used as the discriminating value.",
2678
2680
"allOf": [
2679
2681
{
2680
2682
"$ref": "#/components/schemas/Pet"
@@ -2716,7 +2718,7 @@ components:
2716
2718
required:
2717
2719
- name
2718
2720
- petType
2719
-
Cat: # "Cat" will be used as the discriminator value
2721
+
Cat: # "Cat" will be used as the discriminating value
2720
2722
description: A representation of a cat
2721
2723
allOf:
2722
2724
- $ref: '#/components/schemas/Pet'
@@ -2732,7 +2734,7 @@ components:
2732
2734
- aggressive
2733
2735
required:
2734
2736
- huntingSkill
2735
-
Dog: # "Dog" will be used as the discriminator value
2737
+
Dog: # "Dog" will be used as the discriminating value
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 by implicitly or explicitly associating the possible values of a named property with alternative schemas.
2755
+
When request bodies or response payloads may be one of a number of different schemas, a Discriminator Object gives a hint about the expected schema of the document.
2756
+
This hint can be used to aid in serialization, deserialization, and validation.
2757
+
The Discriminator Object does this by implicitly or explicitly associating the possible values of a named property with alternative schemas.
2754
2758
2755
2759
##### Fixed Fields
2756
2760
Field Name | Type | Description
2757
2761
---|:---:|---
2758
-
<a name="propertyName"></a>propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminator value.
2762
+
<a name="propertyName"></a>propertyName | `string` | **REQUIRED**. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined.
2759
2763
<a name="discriminatorMapping"></a> mapping | Map[`string`, `string`] | An object to hold mappings between payload values and schema names or URI references.
2760
2764
2761
2765
##### Conditions for Using the Discriminator Object
@@ -2779,6 +2783,8 @@ However, the exact nature of such conversions are implementation-defined.
For these examples, assume all schemas are in the entry OpenAPI document; for handling of `discriminator` in referenced documents see [Resolving Implicit Connections](#resolvingImplicitConnections).
2787
+
2782
2788
In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:
Here the discriminator _value_ of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `Dog`. If the discriminator _value_ does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail.
2838
+
Here the discriminating value of `dog` will map to the schema `#/components/schemas/Dog`, rather than the default (implicit) value of `#/components/schemas/dog`. If the discriminating value does not match an implicit or explicit mapping, no schema can be determined and validation SHOULD fail.
2833
2839
2834
2840
When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.
0 commit comments