-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Closed
Labels
Description
I would like to understand the extent of using the allOf: construct in OpenAPI; it may be different than what it is defined in JSON schema.
I would like to define a composite schema by re-using two or more independent schema definitions. It seems that once I add more than one definition to the allOf: array, then 1) the resulting object is not rendered in either Swagger Editor or Swagger UI the way I expect it to be, and 2) there are cascading syntax errors in the editor when defining additional OpenAPI objects.
I think the answer is this [for OpenAPI]:
- the allOf: construct is limited to take only one schema reference; the "polymorphism examples" supply its best use.
- the allOf: construct should not be used to define the schema of a response: use the oneOf: construct to select one schema from several alternatives.
It is #2 that is what I would like to do: to avoid defining intermediate schemas and just "compose" a response given re-useable schema definitions.
Here is an example:
openapi-13.txt
welps, JulienLizano, glenn-kim, mikewach, quetzyg and 1 more