Skip to content

Commit 2d940c5

Browse files
Update versions/3.1.1.md
Co-authored-by: Mike Kistler <[email protected]>
1 parent eb5ddee commit 2d940c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

versions/3.1.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2722,7 +2722,7 @@ MyResponseType:
27222722
- $ref: '#/components/schemas/Lizard'
27232723
```
27242724

2725-
which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. Evaluating a `oneOf` can be a costly operation, so `discriminator` MAY be used as a "hint" to improve the efficiency of selection of the matching schema. The `discriminator` keyword cannot change the validation result of the `oneOf`, it can only help make the evaluation more efficient and provide better error messaging. We can specify the exact field that tells us which schema is expected to match the instance:
2725+
which means the payload _MUST_, by validation, match exactly one of the schemas described by `Cat`, `Dog`, or `Lizard`. Deserialization of a `oneOf` can be a costly operation, as it requires determining which schema matches the payload and thus should be used in deserialization. This problem also exists for `anyOf` schemas. A `discriminator` MAY be used as a "hint" to improve the efficiency of selection of the matching schema. The `discriminator` keyword cannot change the validation result of the `oneOf`, it can only help make the deserialization more efficient and provide better error messaging. We can specify the exact field that tells us which schema is expected to match the instance:
27262726

27272727
```yaml
27282728
MyResponseType:

0 commit comments

Comments
 (0)