Skip to content

Commit 7f38d36

Browse files
author
Ron
authored
Merge pull request OAI#1195 from krishahn/composition-and-inheritance
edit Composition and Inheritance
2 parents bd08307 + 850a4f0 commit 7f38d36

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

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

25142514
While composition offers model extensibility, it does not imply a hierarchy between the models.
2515-
To support polymorphism, OpenAPI Specification adds the support of the `discriminator` field.
2516-
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.
2515+
To support polymorphism, the OpenAPI Specification adds the `discriminator` field.
2516+
When used, the `discriminator` will be the name of the property that decides which schema definition validates the structure of the model.
25172517
As such, the `discriminator` field MUST be a required field.
25182518
There are are two ways to define the value of a discriminator for an inheriting instance.
2519-
- Use the schema's name.
2520-
- Override the schema's name by overriding the property with a new value. If exists, this takes precedence over the schema's name.
2519+
- Use the schema name.
2520+
- Override the schema name by overriding the property with a new value. If a new value exists, this takes precedence over the schema name.
25212521
As such, inline schema definitions, which do not have a given id, *cannot* be used in polymorphism.
25222522

25232523
###### XML Modeling

0 commit comments

Comments
 (0)