Description
🚀 Feature Proposal
It would be useful to be able to attach examples for any request and response specifications.
Motivation
OpenAPI specifications make use of examples to demonstrate valid use cases.
They are also useful for validating the accuracy of the specification.
Example
There are some examples for Kibana alerting OAS in https://github.com/elastic/kibana/tree/main/x-pack/plugins/alerting/docs/openapi/components/examples
They can be validated against the specification by using commands like these:
npx swagger-cli validate entrypoint.yaml
npx @redocly/cli lint bundled.json
... which generate errors and warnings if the examples don't align with the specifications.
Per discussions at recent conference, it would be very nice if these examples were somehow tested against the code not just validated against the specification. There was discussion that this could be accomplished by validating them as part of the flight recorder(?), but I have no further details about this proposal.