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

Support OpenAPI #80

Open
DavidBiesack opened this issue Jun 11, 2024 · 3 comments
Open

Support OpenAPI #80

DavidBiesack opened this issue Jun 11, 2024 · 3 comments

Comments

@DavidBiesack
Copy link

99% of the JSON Schema I work with are embedded in an OpenAPI document (several documents with $ref etc.). This GitHub repo does not mention OpenAPI - can the CLI be used with JSON Schema embedded OpenAPI documents? If so, how?

@jviotti
Copy link
Member

jviotti commented Jun 11, 2024

Hi @DavidBiesack , thanks a lot for reaching out! This is indeed a very good point I was thinking about lately.

One approach is to extend commands like lint to automatically recognise an OpenAPI specification and i.e. apply themselves to the schemas in such specification. However, this approach might not work very well with other commands like bundle or test, unless we come up with a way to say "I want to bundle/test this specific schema part of the OpenAPI specification".

What do you think? Any ideas would be more than welcome. Was there a specific command you were interested in using in the context of OpenAPI?

@DavidBiesack
Copy link
Author

@jviotti initially, I would like to use lint (with --fix).
Some OpenAPI context sensitive linting(with fix) would be nice - i.e. add unevaluatedProperties: false to schemas, but only where "safe" to do so (i.e. not schemas that are $referenced elsewhere for composition, but OK for those used in request or response bodies in the OpenAPI, would be good targets for such context-specific linting.)
Longer term, if refactoring is added to the CLI, that would be awesome ... notably, "extract these properties into a reusable schema, replacing with an allOf", rename schemas (automatically locate references and update them, Building schema cross-reference tracking and impact analysis would be nice.) Other types of refactoring tasks that are error prone when done manually would be great.
Other refactoring, like after adding a property, propagate updated example to other schemas, would be awesome.
(Ideally, the CLI would work with YAML source as well as JSON source)

@jviotti
Copy link
Member

jviotti commented Jun 12, 2024

Thanks a lot for the feedback and ideas. Makes sense. I'll aim to get linting support for OpenAPI + YAML some time soon.

@jviotti jviotti changed the title Support OpenAPI? Support OpenAPI Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants