Replies: 1 comment 2 replies
-
What version of DJA are you using? Since DJA version 4.0.0 nested serializers are not rendered as relationships anymore but as attribute value. So when I look at your example this would actually be rendered as attribute value instead and resource name is not needed in this case. But if you wanna have dynamic relationships you can use SerializerMethodResourceRelatedField and the resource name is then calculated by the returning instance. Does this help? Or have I misunderstood your question? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the following structure of serializers
OneOfSerializer
is my custom serializer accepting values either forA
orB
. The main problem is that it doesn't containJSONAPIMeta
and DRF-jsonapi raises an exception. Would it be possible to somehow return theresource_name
dynamically based on the data, so that the relation is correctly set?Beta Was this translation helpful? Give feedback.
All reactions