Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a method for getting serializer field name (OpenAPI)#7493

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@denisorehovsky
Copy link
Contributor

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 overridemap_serializer method and do something similar to what has been described herevbabiy/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:

classCustomAutoSchema(AutoSchema):    ...defget_field_name(self,field):returncamelize(field.field_name)

This PR adds this method.

WhyNotHugo, baojd42, t-ionut, tevariou, canassa, and noname2048 reacted with thumbs up emoji
Copy link
Collaborator

@carltongibsoncarltongibson left a comment

Choose a reason for hiding this comment

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

Grrr. Yes. Seems reasonable. Can you add docs and tests please.

@denisorehovsky
Copy link
ContributorAuthor

@carltongibson Added docs and test.

@t-ionut
Copy link

t-ionut commentedDec 21, 2020
edited
Loading

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.

@stale
Copy link

stalebot commentedApr 17, 2022

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.

@stalestalebot added the stale labelApr 17, 2022
@stalestalebot removed the stale labelJun 6, 2022
@carltongibsoncarltongibson removed their request for reviewJune 27, 2022 07:53
@stale
Copy link

stalebot commentedOct 15, 2022

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.

@stalestalebot added the stale labelOct 15, 2022
@WhyNotHugo
Copy link

.

@stalestalebot removed the stale labelOct 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@carltongibsoncarltongibsoncarltongibson left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@denisorehovsky@t-ionut@WhyNotHugo@carltongibson@lovelydinosaur

[8]ページ先頭

©2009-2025 Movatter.jp