-
Notifications
You must be signed in to change notification settings - Fork 123
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
Camelizing schema generator #79
Comments
I have the same problem :) |
I think I've found a way to make this work by doing a bit of explicit configuration. I just had to implement the OpenAPI schema endpoint from the DRF docs and then passed the renderer classes configured according to this package's docs: from django.urls import re_path
from rest_framework.schemas import get_schema_view
from rest_framework.settings import api_settings
urlpatterns = [
re_path(
"^openapi/$",
get_schema_view(
title="My API",
renderer_classes=api_settings.DEFAULT_RENDERER_CLASSES,
),
name="openapi-schema",
),
] Next time I access my OpenAPI schema url or my Swagger url all fields are camelCased 👌 |
https://github.com/tfranzel/drf-spectacular supports djangorestframework-camel-case |
Right now if you use this package and DRF's OpenAPI schema generator, the fields don't end up camelized. I have kludged together a quick fix for this:
It works for me and it seems like a good fit for this project, but I thought I'd check in first before making a PR because I'm not sure if it's an amazing idea. It's very useful and works, but overriding a private API (
_map_serializer()
) doesn't seem great, especially since DRF's schema generation is quite new and a bit of a moving target at the moment.But if you'd like I can add some tests for this and submit a PR, but it might need some maintenance.
The text was updated successfully, but these errors were encountered: