I have the following structure of serializers
class A(Serializer)
class JSONAPIMeta:
resource_name = "A"
class B(Serializer)
class JSONAPIMeta:
resource_name = "B"
class MySerializer(Serializer)
my_field = OneOfSerializer(A(), B())
OneOfSerializer is my custom serializer accepting values either for A or B. The main problem is that it doesn't contain JSONAPIMeta and DRF-jsonapi raises an exception. Would it be possible to somehow return the resource_name dynamically based on the data, so that the relation is correctly set?
I have the following structure of serializers
OneOfSerializeris my custom serializer accepting values either forAorB. The main problem is that it doesn't containJSONAPIMetaand DRF-jsonapi raises an exception. Would it be possible to somehow return theresource_namedynamically based on the data, so that the relation is correctly set?