How should parameter examples be written? #4622
Replies: 2 comments 3 replies
-
This is a very interesting question! My understanding had always been that the example/examples for a query parameter would only contain the value, but now I see why that might not give the whole picture -- in particular for a parameter with parameters:
- name: colors
in: query
explode: true
schema:
type: array
items:
type: string
example: # what to put here? Specifying Hmmm. Are the tools just wrong on this? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to understand whether or not to apply serialization to parameter examples. If I'm following #3041 and the changes added to 3.0.4, it looks like parameter examples should be serialized according to this table:
https://spec.openapis.org/oas/v3.0.4.html#style-examples
So then I'd have parameters specified like this:
However this seems to cause problems for the tooling I've tested with (swagger-ui, spectral, vacuum) and seems to contradict documentation around parameters elsewhere (where the serialization:
https://swagger.io/docs/specification/v3_0/describing-parameters/#parameter-examples
I work on a tool that generates Open API and am adding support for emitting parameter examples, but came across issues around tooling support as part of validation. I'm curious if there are any tools that do work with the serialized examples.
Beta Was this translation helpful? Give feedback.
All reactions