Keep invalid (not content type) examples
philsturgeon opened this issue ยท comments
Whilst the OAS2 spec does say example names SHOULD be a mime type, and it does say they MUST be in produces, we need to (for now at least) leave them intact for class/next docs/prism users who are used to being able to do this.
Solution:
IF an oas2 example does match a produces, push it into contents[0].examples
. It would be a small change that would help us maintain support for the random example pattern from oas2 yesteryear in mocking and docs, while people migrate. Our new tooling (e.g: Studio) will still not allow random examples in oas2 moving forward unless they modify in the code view, so it's basically "deprecated" instead of "no more support at all".
Additional Context
A followup to #2
We can add a rule to Spectral to check for examples not in produces, so users get more insight into the problem, and between that and Studio giving them a nudge, it might just convince them to upgrade to OAS3.
Originally posted by @marbemac in #2 (comment)
@XVincentX there's no huge rush here, but I assigned you because the best place to try this concept out is likely in Prism. I think it will not require any changes in prism, and should just work, but we'll see :).
๐ This issue has been resolved in version 2.2.0 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐