Skip to content

I suspect a breaking change related to "include_relationships=True" and schema.load() in version 1.4.1 #664

Open
@Curiouspaul1

Description

@Curiouspaul1

Hi ! I recently had to do some testing on my local for some portion of our code that's been running happily on staging. I didn't specify a version number for my local container instance, as such it pulled 1.4.1 which is the latest. I noticed that it seems to enforce implicitly defined fields (from the include_relationships=True option), during a schema.load() which I THINK isn't the desired or USUAL behavior.

Typically (in previous versions specifically 1.1.0 ) we've been able to deserialize into objects with schemas defined with the include_relationships option set to True - without having to provide values for relationship fields (which intuitively makes sense), however for some reason it's raising a Validation (Missing field) error on 1.4.1 . This behavior wasn't reproducable on 1.1.0 (not that I would know if this is on later versions in: 1.1.0 < version < 1.4.1 because we've not used any other up until my recent local testing which used 1.4.1).

class UserSchema(Base):
    class Meta:
        model = User
        include_relationships=True  # includes for example an 'address' relationship attr (could be something like a 'backref' or explicitly declared field on the sqlalchemy model)
        include_fk = True
        load_instance = True

# usage and expected behavior
schema = UserSchema(unknown='exclude', session=session)
user = schema.load(**data)
# returns <User> object

# Observed behavior
# .. same steps
# throws 'Missing data for required 'address' field - error'

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions