Closed panchock closed 1 year ago
I've decided to implement union type support using a homegrown UnionField
(#82) instead of a solution based on this PR/django-rest-polymorphic
. The main reason for that is that such a field turns out to be less code than the InlinePolymorphicSerializer
needed here to fixup the mismatch with django-rest-polymorphic
assumptions, while also being more flexible (it supports e.g. unions of primitives). It also avoids the dependency.
I've decided to implement union type support using a homegrown
UnionField
(#82) instead of a solution based on this PR/django-rest-polymorphic
. The main reason for that is that such a field turns out to be less code than theInlinePolymorphicSerializer
needed here to fixup the mismatch withdjango-rest-polymorphic
assumptions, while also being more flexible (it supports e.g. unions of primitives). It also avoids the dependency.
@oxan This solution also supports drf spectacular? What will happens if someone will try to generate openapi schema now?
I don't know, I haven't tested it as I don't use drf-spectacular. However, if it doesn't work, the best way to fix it would be by extending drf-spectactular's rest_framework_dataclasses plugin.
Resolves #63