Add a method for getting serializer field name (OpenAPI)
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_serializer method and do something similar to what has been described here https://github.com/vbabiy/djangorestframework-camel-case/issues/79#issue-563203091
However, it would be much simpler if we had a separate method for getting serializer field name that I can override:
class CustomAutoSchema(AutoSchema):
...
def get_field_name(self, field):
return camelize(field.field_name)
This PR adds this method.
@carltongibson Added docs and test.
I'd also love to see this merged :smile: 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.
.