Skip to content

Commit a76933b

Browse files
Make it more clear that discriminator is not for validation
Co-authored-by: Darrel <[email protected]>
1 parent 0ae0968 commit a76933b

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
@@ -2727,7 +2727,7 @@ MyResponseType:
27272727
- $ref: '#/components/schemas/Lizard'
27282728
```
27292729

2730-
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 validation and selection of the matching schema. The `discriminator` keyword can not change the validation result of the `oneOf`, it can only help make the evaluation more efficient and provide better error messaging. We can then describe exactly which field tells us which schema is expected to match the instance:
2730+
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 can not change the validation result of the `oneOf`, it can only help make the evaluation more efficient and provide better error messaging. We can then describe exactly which field tells us which schema is expected to match the instance:
27312731

27322732
```yaml
27332733
MyResponseType:

0 commit comments

Comments
 (0)