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.2.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1372,7 +1372,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
1372
1372
1373
1373
##### Media Type Examples
1374
1374
1375
-
```js
1375
+
```json
1376
1376
{
1377
1377
"application/json": {
1378
1378
"schema": {
@@ -2689,7 +2689,7 @@ The discriminator object is legal only when using one of the composite keywords
2689
2689
2690
2690
In OAS 3.0, a response payload MAY be described to be exactly one of any number of types:
2691
2691
2692
-
```
2692
+
```yaml
2693
2693
MyResponseType:
2694
2694
oneOf:
2695
2695
- $ref: '#/components/schemas/Cat'
@@ -2700,7 +2700,7 @@ MyResponseType:
2700
2700
which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. In this case, a discriminator MAY act as a "hint" to shortcut validation and selection of the matching schema which may be a costly operation, depending on the complexity of the schema. We can then describe exactly which field tells us which schema to use:
2701
2701
2702
2702
2703
-
```
2703
+
```yaml
2704
2704
MyResponseType:
2705
2705
oneOf:
2706
2706
- $ref: '#/components/schemas/Cat'
@@ -2712,7 +2712,7 @@ MyResponseType:
2712
2712
2713
2713
The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:
2714
2714
2715
-
```
2715
+
```json
2716
2716
{
2717
2717
"id": 12345,
2718
2718
"pet_type": "Cat"
@@ -2723,7 +2723,7 @@ Will indicate that the `Cat` schema be used in conjunction with this payload.
2723
2723
2724
2724
In scenarios where the value of the discriminator field does not match the schema name or implicit mapping is not possible, an optional `mapping` definition MAY be used:
2725
2725
2726
-
```
2726
+
```yaml
2727
2727
MyResponseType:
2728
2728
oneOf:
2729
2729
- $ref: '#/components/schemas/Cat'
@@ -2745,7 +2745,7 @@ In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed e
2745
2745
2746
2746
For example:
2747
2747
2748
-
```
2748
+
```yaml
2749
2749
components:
2750
2750
schemas:
2751
2751
Pet:
@@ -2787,7 +2787,7 @@ components:
2787
2787
2788
2788
a payload like this:
2789
2789
2790
-
```
2790
+
```json
2791
2791
{
2792
2792
"pet_type": "Cat",
2793
2793
"name": "misty"
@@ -2796,7 +2796,7 @@ a payload like this:
2796
2796
2797
2797
will indicate that the `Cat` schema be used. Likewise this schema:
2798
2798
2799
-
```
2799
+
```json
2800
2800
{
2801
2801
"pet_type": "dog",
2802
2802
"bark": "soft"
@@ -3306,7 +3306,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
0 commit comments