Forum Discussion
frankkilcommins
7 months agoStaff
Hi mtiwari176
Do you need to use discriminator here? If the goal is to just show examples of the different schemas to the consumer, then you could have:
responses:
'200':
description: search results matching criteria
content:
application/json:
schema:
type: array
items:
oneOf:
- $ref: '#/components/schemas/Schema1'
- $ref: '#/components/schemas/Schema2'
examples:
Schema1:
value:
subject: foo
Schema2:
value:
subject: bar
This would then render as follows in SwaggerUI and allow a consumer to select the appropriate example and see the schemas:
Related Content
- 5 years ago
- 3 years ago
- 3 years ago
Recent Discussions
- 7 days ago