Skip to content

Commit 1523666

Browse files
committed
edit Discriminator Object
1 parent e6ec613 commit 1523666

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

versions/3.0.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,7 +2859,7 @@ components:
28592859
28602860
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.
28612861

2862-
Note, when using the discriminator, _inline_ schemas will not be considered when using the discriminator.
2862+
Note, when using the discriminator, _inline_ schemas will not be considered.
28632863

28642864
##### Fixed Fields
28652865
Field Name | Type | Description
@@ -2879,7 +2879,7 @@ MyResponseType:
28792879
- $ref: '#/components/schemas/Lizard'
28802880
```
28812881

2882-
which means the paylod _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:
2882+
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:
28832883

28842884

28852885
```
@@ -2919,11 +2919,11 @@ MyResponseType:
29192919
monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
29202920
```
29212921

2922-
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 a implicit or explicit mapping, no schema can be determined and validation SHOULD fail. Note, mapping keys MUST be string values, but tooling MAY response values to strings for comparison.
2922+
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. Mapping keys MUST be string values, but tooling MAY map response values to strings for comparison.
29232923

29242924
When used in conjunction with the `anyOf` construct, the use of the discriminator can avoid ambiguity where multiple schemas may satisfy a single payload.
29252925

2926-
In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas composing the parent schema in an `allOf` construct may be used as an alternate schema.
2926+
In both the `oneOf` and `anyOf` use cases, all possible schemas MUST be listed explicitly. To avoid redundancy, the discriminator MAY be added to a parent schema definition, and all schemas comprising the parent schema in an `allOf` construct may be used as an alternate schema.
29272927

29282928
For example:
29292929

@@ -2967,7 +2967,7 @@ components:
29672967
type: boolean
29682968
```
29692969
2970-
a payload like this:
2970+
having a payload like this:
29712971
29722972
```
29732973
{

0 commit comments

Comments
 (0)