The Swagger documentation gives an example of how to implement model inheritance in OpenAPI:
components:
schemas:
BasicErrorModel:
type: object
required:
- message
- code
properties:
message:
type: string
code:
type: integer
minimum: 100
maximum: 600
ExtendedErrorModel:
allOf: # Combines the BasicErrorModel and the inline model
- $ref: "#/components/schemas/BasicErrorModel"
- type: object
required:
- rootCause
properties:
rootCause:
type: string
When using the 3.0 version of the OpenAPI specification, this works as intended, and the ExtendedErrorModel
has all properties of both the base and derived object:
Switching to the 3.1 version of the specification (supported in the "next" web editor), however, breaks this example, treating the siblings as separate and leaving the ref as text:
Is this expected behavior given the semantic changes in the 3.1 spec? If so, is there a replacement for the mechanism?