Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert OpenAPI schema "example" to "examples" array #396

Closed
kalxas opened this issue Nov 3, 2024 · 5 comments · Fixed by #397 or #410
Closed

Convert OpenAPI schema "example" to "examples" array #396

kalxas opened this issue Nov 3, 2024 · 5 comments · Fixed by #397 or #410
Assignees
Labels
question Further information is requested

Comments

@kalxas
Copy link
Member

kalxas commented Nov 3, 2024

It has been reported that some tools that convert OpenAPI schemas to JSONSchema have an issue converting example to examples.

ESA-EarthCODE/open-science-catalog-metadata#233 (comment)
ESA-EarthCODE/open-science-catalog-metadata#233 (comment)
ESA-EarthCODE/open-science-catalog-metadata#233 (comment)
ESA-EarthCODE/open-science-catalog-metadata#233 (comment)

Should we consider switching the YAML schema example to examples to avoid doing it manually during conversion?

@pvretano
Copy link
Contributor

pvretano commented Nov 3, 2024

@kalxas I'll update all instances of "example" to be "examples'. I just checked the JSON Schema specification and it seems that the correct key name is "examples".

@kalxas
Copy link
Member Author

kalxas commented Nov 3, 2024

@pvretano thank you

@pvretano
Copy link
Contributor

pvretano commented Nov 5, 2024

OK ... the change from "example" to "examples" causes validation of the example openAPI files to fail so I have to undo these changes. For example, when I changes all instances of "example" in linkBase.yaml to "examples" (and converted the example to an array) swagger-cli spewed forth a long list of "additional parameters not allowed" errors. I think this is because the version of JSON schema that swagger-cli understands is not pure JSON schema.

@kalxas
Copy link
Member Author

kalxas commented Nov 5, 2024

ok, let's revert then

@m-mohr
Copy link
Contributor

m-mohr commented Nov 8, 2024

Interesting, especially given that OpenAPI 3.1 deprecates example in favor of examples:

Deprecated: The example property has been deprecated in favor of the JSON Schema examples keyword. Use of example is discouraged, and later versions of this specification may remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

Successfully merging a pull request may close this issue.

3 participants