Skip to content

Commit 850a4f0

Browse files
committed
edit Composition and Inheritance
1 parent e6ec613 commit 850a4f0

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
@@ -2511,15 +2511,15 @@ This object can be extended with [Specification Extensions](#specificationExtens
25112511
###### <a name="schemaComposition"></a>Composition and Inheritance (Polymorphism)
25122512

25132513
The OpenAPI Specification allows combining and extending model definitions using the `allOf` property of JSON Schema, in effect offering model composition.
2514-
`allOf` takes in an array of object definitions that are validated *independently* but together compose a single object.
2514+
`allOf` takes an array of object definitions that are validated *independently* but together compose a single object.
25152515

25162516
While composition offers model extensibility, it does not imply a hierarchy between the models.
2517-
To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field.
2518-
When used, the `discriminator` will be the name of the property used to decide which schema definition is used to validate the structure of the model.
2517+
To support polymorphism, the OpenAPI Specification adds the `discriminator` field.
2518+
When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model.
25192519
As such, the `discriminator` field MUST be a required field.
25202520
There are are two ways to define the value of a discriminator for an inheriting instance.
2521-
- Use the schema's name.
2522-
- Override the schema's name by overriding the property with a new value. If exists, this takes precedence over the schema's name.
2521+
- Use the schema name.
2522+
- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
25232523
As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism.
25242524

25252525
###### XML Modeling

0 commit comments

Comments
 (0)