Skip to content

Add a note about supported OpenAPI versions #176

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

Closed
filippog opened this issue Sep 2, 2020 · 4 comments
Closed

Add a note about supported OpenAPI versions #176

filippog opened this issue Sep 2, 2020 · 4 comments
Labels
📝 documentation Improvements or additions to documentation ✨ enhancement New feature or improvement

Comments

@filippog
Copy link

filippog commented Sep 2, 2020

Describe the bug
The configuration I'm generating a client for declares parameters with in: body, the generation fails with openapi-python-client version: 0.5.4 however:

ERROR parsing POST /alerts within alert. Endpoint will not be generated.
Parameter must be declared in path or query
Parameter(name='alerts', param_in='body', description='The alerts to create', required=True, deprecated=False, allowEmptyValue=False, style=None, explode=False, allowReserved=False, param_schema=Reference(ref='#/definitions/postableAlerts'), example=None, examples=None, content=None)

To Reproduce
Steps to reproduce the behavior:
openapi-python-client generate --url https://raw.githubusercontent.com/prometheus/alertmanager/master/api/v2/openapi.yaml

I'm not familiar with OpenAPI specs and versions, e.g. if this is relevant? https://swagger.io/docs/specification/2-0/describing-request-body/

@filippog filippog added the 🐞bug Something isn't working label Sep 2, 2020
@dtkav
Copy link
Contributor

dtkav commented Sep 2, 2020

Hey @filippog - consider upgrading your spec from openapi 2.0 to openapi 3.0 using a tool like this: https://mermade.org.uk/openapi-converter
It seems this tool is mostly focused on openapi 3.0 support.

@dbanty
Copy link
Collaborator

dbanty commented Sep 2, 2020

Thanks for answering this @dtkav! You're 100% correct in that this tool only supports OpenAPI 3. I should probably add a note about that to the README and maybe even check for the top level swagger key and emit an early error.

@dbanty dbanty changed the title in: body parameters not parsed Add a note about supported OpenAPI versions Sep 2, 2020
@dbanty dbanty added ✨ enhancement New feature or improvement 📝 documentation Improvements or additions to documentation and removed 🐞bug Something isn't working labels Sep 2, 2020
@filippog
Copy link
Author

filippog commented Sep 3, 2020

Thank you very much folks for the answers! I agree being more explicit on which openapi/swagger versions are supported will be of great help to users

@dbanty dbanty closed this as completed in 2966ebe Sep 26, 2020
@dbanty
Copy link
Collaborator

dbanty commented Sep 26, 2020

All set, a message is now available in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📝 documentation Improvements or additions to documentation ✨ enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

3 participants