-
https://swagger.io/docs/specification/adding-examples/ seems to suggest it cant be done: Note that arrays and array items support single example but not multiple examples. I would like to reference several examples. |
Beta Was this translation helpful? Give feedback.
Answered by
hkosova
Nov 19, 2022
Replies: 2 comments
-
Multiple schema-level openapi: 3.1.0
...
components:
schemas:
MyObject:
type: object
properties:
foo:
type: string
# Multiple property-level examples
examples:
- Hello, world!
- quick brown fox
# Multiple object-level examples
examples:
- foo: Hello, world!
- foo: quick brown fox
MyArray:
type: array
items:
$ref: '#/components/schemas/MyObject'
# Multiple array-level examples
examples:
-
# The 1st example
- foo: Hello, world!
- foo: quick brown fox
-
# The 2nd example
- foo: Something else |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
handrews
-
Seems to have been answered, closing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Multiple schema-level
examples
are supported in OpenAPI 3.1. They must be inline example values and cannot be $refs.