ppazos
6 years agoNew Contributor
Problems adding two examples for a response
Hi, I have an endpoint that can return a response based on two different schemas, which I have on the response with oneOf.
I'm trying to add examples of those two payloads to the response of th...
- 6 years ago
"example" (singular) expects a single inline example, so this definition
example:
- ex1 .... - ex2 .....means that the example value is literally
- ex1 .... - ex2 .....
The syntax with multiple "examples" would look like this:
responses: '200': description: OK content: application/json: schema: oneOf: - $ref: '#/components/schemas/A' - $ref: '#/components/schemas/B' examples: cat: summary: An example of a cat value: name: Fluffy petType: Cat color: White gender: male breed: Persian dog: summary: An example of a dog with a cat's name value: name: Puma petType: Dog color: Black gender: female breed: Mixed