Support for multiple request examples
Closed this issue · 3 comments
ehossack commented
Hiya
I notice I can include a single request example by using the example
property on the body.
But what if I want multiple?
Can I propose the allowing of a property like responseExamples
that would set the content[mediaType].examples
property, similar to the way example
is handled in https://github.com/SkeLLLa/fastify-oas/blob/master/lib/helpers.js#L98
Alternatively use the examples
array as is provided, and extract the name property:
else if (body.examples) {
dst.content[mediaType].examples = Object.fromEntries(
body.examples.map(({ name, ...rest }) => [name, rest])
);
delete body.examples;
}
SkeLLLa commented
Hi. That's good idea, do you want to send a PR?
SkeLLLa commented
@ehossack I think we should follow swagger/openapi https://swagger.io/docs/specification/adding-examples/#parameters. So we'll need to handle examples
alongside with example
.