8000 Schema/OpenAPI: Make operationId camel-case by gnuletik · Pull Request #7208 · encode/django-rest-framework · GitHub
[go: up one dir, main page]

Skip to content
8000

Schema/OpenAPI: Make operationId camel-case #7208

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

Merged

Conversation

gnuletik
Copy link
Contributor

This PR intend to make the OpenAPI - AutoSchema's operationIds camel case and consistent across the schema.

The operationId in OpenAPI examples are all camel case.
e.g. : Do a CTRL-F for "operationId" on the spec

The current behavior is the following :

  • if you have ViewSet (with the inherited methods : get, list, retrieve, partial_update etc..), you will get an operationId like partial_updateItem which is half snake_case and half camelCase.
  • if you have APIView (with the inherited methods: get, post, put etc...), you will get an operationId like RetrieveItem which is "PascalCase" or "upper camel case".

With this PR, the auto-generated operationId will be camelCase.

Copy link
Collaborator
@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gnuletik. OK, this seems reasonable. If you rebase and adjust tests we'll go with it.

Thanks for the input!

@gnuletik gnuletik force-pushed the openapi/camel-case-operationId branch from 1bfdce9 to 3300936 Compare March 2, 2020 16:59
@gnuletik
Copy link
Contributor Author
gnuletik commented Mar 2, 2020

Thanks for the feedback!
I rebased and updated the docs.

@carltongibson
Copy link
Collaborator

Super thanks. I think we just need one more rebase. 😀

@gnuletik gnuletik force-pushed the openapi/camel-case-operationId branch from 7d2dbdd to 200e839 Compare March 2, 2020 19:22
@gnuletik
Copy link
Contributor Author
gnuletik commented Mar 3, 2020

I rebased it on master @carltongibson :)

Copy link
Collaborator
@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done.

Finally! 😀

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

Successfully merging this pull request may close these issues.

2 participants
0