You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
The issue occurs while attempting to load an object with bidirectional relationships on child objects in the included data.
Below is a minimal example demonstrating the issue. When we try to load the root data object, we run into a RecursionError. It seems marshmallow-jsonapi goes into an infinite loop trying to load the included objects when the children have bidirectional relationships.
What's strange is that this bug doesn't happen if you remove all references to the SecondChildSchema, even though there's also a circular relationship between Root and FirstChild. It seems that this happens only when there are relationships between multiple included data resources.
I think this is because they access related related data in slightly different ways from when it's the root element that has relationships.
I've looked into solving this, but it's not easy. The best way would be to store the ret value from Unmarshaller and storing it in a dictionary indexed by id and type, and then look up that dictionary whenever we try to deserialize a field. However the Unmarshaller class doesn't provide any hooks with which we can do this. I think we'd have to modify the base marshmallow library to do this.
The issue occurs while attempting to load an object with bidirectional relationships on child objects in the
included
data.Below is a minimal example demonstrating the issue. When we try to load the root data object, we run into a
RecursionError
. It seems marshmallow-jsonapi goes into an infinite loop trying to load theincluded
objects when the children have bidirectional relationships.Simple Example:
Error:
RecursionError: maximum recursion depth exceeded
python=3.7
marshmallow=3.2.1
marshmallow-jsonapi=0.22.0
The text was updated successfully, but these errors were encountered: