-
Notifications
You must be signed in to change notification settings - Fork 269
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
Add integration with django-enumfields #570
Comments
django by default now provide enumfield, so why not using that instead? |
@auvipy That is a good point. I hadn't realized that until digging in more that It would be better to support something that is officially part of Django. |
One reason someone might want to keep using But I would still understand if |
Django doesn't provide an
I picked up the implementation of this and drove it through to completion. IIRC we went for |
@ngnpope we relaxed that constraint when we found out that @johnthagen afaik hzdg/django-enumfields#111 (comment) is not an issue anymore with e.g. Generally we have to have some sort of cut-off for 3rd party apps. I generally try to weight implementation complexity, impact on the codebase, and reach of the 3rd party app. That said, it contains quite a bit of magic that likely requires quite a few small changes. Also, imho it is partially superseded by more recent Django versions. At the moment I'm leaning more towards not including it. |
@tfranzel Totally understand and I tend to agree as well. Once I understood
I'll have to play with it some more myself and see if Please feel free to close this issue as Won't Fix. I think most Django users will be happy enough with the |
closing this by consensus. 😄 |
django-enumfields
allows using "real" PythonEnum
s within Django Models.We've used these extensively within Django/DRF to provide a more expressive internal API to work with.
We've hit some related to #482 during our porting to
drf-spectacular
that can be summarized in the following example:When we build the schema for this contrived example (
ModelSerializer
,ViewSet
derived from this), we get generated OpenAPI enums that look like:With a warning:
But it seems like it should be possible to introspect the actual Python
Enum
that is used and use that as a way to name the generated OpenAPI enums?I believe that FastAPI does something similar to this.
The text was updated successfully, but these errors were encountered: