Add a method for getting serializer field name (OpenAPI)#7493
Merged
lovelydinosaur merged 3 commits intoencode:masterfrom Oct 17, 2022
Merged
Add a method for getting serializer field name (OpenAPI)#7493lovelydinosaur merged 3 commits intoencode:masterfrom
lovelydinosaur merged 3 commits intoencode:masterfrom
Conversation
Collaborator
carltongibson
left a comment
There was a problem hiding this comment.
Grrr. Yes. Seems reasonable. Can you add docs and tests please.
Contributor
Author
|
@carltongibson Added docs and test. |
|
I'd also love to see this merged 😄 I'm working on an API that'll be used by an Angular app and it can generate services based on OpenAPI & Swagger. I'd like to have both the API and its Swagger documentation show the same fields, in camelCase. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've camelized my API using djangorestframework-camel-case (https://github.com/vbabiy/djangorestframework-camel-case). However, OpenAPI is still showing me that all of my fields are in snake case.
One way of fixing this is to override
map_serializermethod and do something similar to what has been described here vbabiy/djangorestframework-camel-case#79 (comment)However, it would be much simpler if we had a separate method for getting serializer field name that I can override:
This PR adds this method.