Skip to content

Commit 6ea52f2

Browse files
Apply suggestions from code review
Co-authored-by: Adam Altman <[email protected]>
1 parent 1924bf0 commit 6ea52f2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

versions/3.1.1.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,7 @@ The OpenAPI Specification allows combining and extending model definitions using
23462346

23472347
While composition offers model extensibility, it does not imply a hierarchy between the models.
23482348
To support polymorphism, the OpenAPI Specification adds the `discriminator` keyword.
2349-
When used, the `discriminator` will indicate the name of the property that hints which schema definition is expected to validate the structure of the model.
2349+
When used, the `discriminator` indicates the name of the property that hints which schema definition is expected to validate the structure of the model.
23502350

23512351
###### XML Modeling
23522352

@@ -2693,7 +2693,7 @@ components:
26932693
26942694
#### <a name="discriminatorObject"></a>Discriminator Object
26952695
2696-
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` keyword is used to inform the consumer of the document which of the alternatives is expected or preferred.
2696+
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. It can be used to aid in serialization, deserialization, and validation.
26972697

26982698
`discriminator` uses a schema's "name" to automatically map a property value to
26992699
a schema. The schema's "name" is the property name used when declaring the
@@ -2726,7 +2726,7 @@ MyResponseType:
27262726
- $ref: '#/components/schemas/Lizard'
27272727
```
27282728

2729-
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 then describe exactly which field tells us which schema is expected to match the instance:
2729+
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:
27302730

27312731
```yaml
27322732
MyResponseType:
@@ -2747,7 +2747,7 @@ The expectation now is that a property with name `petType` _MUST_ be present in
27472747
}
27482748
```
27492749

2750-
Will indicate that the `Cat` schema is the alternative that is expected to match this payload.
2750+
Will indicate that the `Cat` schema is expected to match this payload.
27512751

27522752
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:
27532753

0 commit comments

Comments
 (0)