openapi: 3.1.0 info: title: anyOf / oneOf example description: Demonstrate the valid use of anyOf and oneOf version: 1.0.0 paths: /animals/{id}: get: summary: Find animal by ID description: Returns a single animal operationId: getAnimalByID parameters: - name: id in: path description: ID of animal to get schema: type: integer minimum: 1 maximum: 10 required: true example: 7 responses: "200": description: successful operation content: "application/json": schema: anyOf: - $ref: '#/components/schemas/Cat' - $ref: '#/components/schemas/Dog' "400": description: Invalid ID supplied content: {} "404": description: animal not found content: {} components: schemas: Dog: type: object required: - name - owner - bark properties: name: type: string owner: type: string bark: type: string Cat: type: object required: - name - owner - meow properties: name: type: string owner: type: string meow: type: string