I am using json:api with python with a class that looks like this:
class ChildrenResultSerializer(JSONAPISerializer):
children = fields.List(fields.Nested(ChildSerializer), allow_none=True)
and the other one looks like this:
class ChildSerializer(JSONAPISerializer):
toys = fields.Relationship(
many=True,
type_="toys",
include_resource_linkage=True,
schema=ToySerializer,
allow_none=True,
)
In the ChildrenResultSerializer.serialize function, I want to be able to see the toys data for each of the children. I'm using it like this:
ChildrenResultSerializer.serialize(results, include_data=("children.toys"))
but I get this error: ValueError: Can only include relationships. "children" is a "List"
what am I doing wrong? I would like to keep children as a list of nested if possible.