-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Adding support for dataclass Union field #63
Comments
I'm happy to consider a PR to add support for unions, provided that it doesn't add a hard dependency (i.e. if you don't use unions, you shouldn't need the dependency). |
Happy to hear it will be useful. |
@panchock care to share your solution? a "dirty" DataclassSerializer modification (shared through gist or something) will be nice as well if you don't have a time for a proper PR. |
This would be a really great feature, especially given that it would plug into In order to avoid concerns about other users being required to add a new dependencies, Something like: [project.optional-dependencies]
union = ["django-rest-polymorphic"] And then users could opt-in to this feature/dependency:
|
@panchock Were you ever able to open a PR? |
I'm planning to open PR soon. |
@panchock You don't need permissions to open a PR. You will create your own local fork, create a branch there, and then GitHub will help you set up the pull request back to this original repository. |
Fixed by #82. |
Hi there!
We are starting using this package a lot in our product and it's great!
One gap we reached into is support for dataclass union (
typing.Union[dataclass1, dataclass2, ...]
) as one of the dataclass fields.Example case:
I solved this by extending
DataclassSerializer
and add support usingrest-polymorphic
.We also use
drf-spectacular
foropenapi
scheme and it also supportsrest-polymorphic
, so all good!Before I open PR I wanted to check that this feature is useful, I would be happy to get a feedback :)
The text was updated successfully, but these errors were encountered: