-
-
Notifications
You must be signed in to change notification settings - Fork 229
operationId should be optional #92
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
Comments
We'll just need to figure out what the name the generated functions when there is not operationId. Any suggestions? I think most other tools do something with combining the method and path, where GET /my/endpoint would become something like get_my_endpoint. Not sure what to do with path parameters though (GET /my/endpoint/{id: int}). Any suggestions on what you'd like to see for automatic naming? |
Connexion is a server-side project, but here's an example of automatic naming using the path / method. |
Thanks @dtkav! For some reason that link is displaying in my browser with all the leading whitespace stripped which makes it hard to read- but it seems like the basics are:
I think I'm missing a bit of context- it's clearly doing something differently if the path ends in a var but some of the logic is based around some defaults I think? FastAPI does something similar but the I believe this is the code that openapi-generator uses. I think if we follow that same idea then GET /my/endpoint/{id} would become my_endpoint_id_get which would conflict with GET /my/endpoint/id. Maybe that's not the end of the world and we just catch conflicting names and emit a warning about them. |
Added auto name generation roughly matching above, though the method is before the path instead of after since that makes more sense to me. If you have GET /path/with/{param}/ it will produce a module with the name "get_path_with_param". This will be available in 0.6.1 later today. |
As per swagger's doc, operationId is an optional parameter:
Therefore, the following line should use a
.get("operationId")
:https://github.com/triaxtec/openapi-python-client/blob/7ef8b93931a33829de2e272f530ac379fc976670/openapi_python_client/openapi_parser/openapi.py#L146
The text was updated successfully, but these errors were encountered: