You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
api-with-examples.yaml: example vs examples in Media Type Object #1116
Thank you for merging PR #985 and providing official examples of OpenAPI v3 files! 👏👏👏
Is it possible that api-with-examples.yaml has errors?
I am asking because I validated all four examples/v3.0/ files with JSON Schema created by @timburks and @MikeRalphson. The JSON Schema validation is OK on petstore-expanded.yaml, petstore.yaml, and uber.yaml, but fails on api-with-examples.yaml.
Validation fails on content examples - there are four examples in the file, the first of which is defined on line 16:
example (singular) - inlines example text directly (Any in JSON Schema);
examples (plural) - uses the Example Object, which also provides additional information, such as example name, summary, or description.
The problem is that api-with-examples.yaml defines examples with examples, but inlines them as if they were defined with example.
In my understanding of the spec, api-with-examples.yaml should be corrected:
Either examples keyword should be replaced by example:
@zbinlin OpenAPI's examples is not a schema keyword. It is directly under the media type, adjacent to the schema keyword. While the usage difference is unfortunate, it is not a syntactical conflict.
Activity
darrelmiller commentedon Jun 16, 2017
These examples need to be fixed. Sorry for the confusion
zbinlin commentedon Oct 17, 2019
@darrelmiller The
examplesincompatible JSON Schema's exampes, JSON Schema'sexamplesMUST be an array but thereexamplesis an object.handrews commentedon Oct 17, 2019
@zbinlin OpenAPI's
examplesis not a schema keyword. It is directly under the media type, adjacent to theschemakeyword. While the usage difference is unfortunate, it is not a syntactical conflict.MikeRalphson commentedon Jan 12, 2021
Closing as #1286 was merged. Thanks all.