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.
See how, in my SQLAlchemy model, I don't have a user field? Because of the way that serialize() is defined in marshmallow (https://github.com/marshmallow-code/marshmallow/blob/e96bf97656ca3a8299d1382fae26c85f150e7e39/src/marshmallow/fields.py#L301-L306), if the get_value() call returns MISSING, the entire field is skipped, and thus the relationship is not serialized. The problem is, we don't actually need to have an underlying field for the Relationship, it's constructed using the related_kwargs argument, which in my case uses user_id, not user to find the relationship.
I suggest we add a definition for Relationship#serialize() to ensure that it still actually generates the field, even if the value for that field is MISSING.
The text was updated successfully, but these errors were encountered:
I just created a Schema with the following [simplified] definition :
This was based off the model definition here:
See how, in my SQLAlchemy model, I don't have a
user
field? Because of the way thatserialize()
is defined in marshmallow (https://github.com/marshmallow-code/marshmallow/blob/e96bf97656ca3a8299d1382fae26c85f150e7e39/src/marshmallow/fields.py#L301-L306), if theget_value()
call returns MISSING, the entire field is skipped, and thus the relationship is not serialized. The problem is, we don't actually need to have an underlying field for theRelationship
, it's constructed using therelated_kwargs
argument, which in my case usesuser_id
, notuser
to find the relationship.I suggest we add a definition for
Relationship#serialize()
to ensure that it still actually generates the field, even if the value for that field is MISSING.The text was updated successfully, but these errors were encountered: