Skip to content

fix: handle MappedAsDataclass in create_update_dict - #1575

Open
pctablet505 wants to merge 2 commits into
fastapi-users:masterfrom
pctablet505:fix-1440-create-update-dict-dataclass
Open

fix: handle MappedAsDataclass in create_update_dict#1575
pctablet505 wants to merge 2 commits into
fastapi-users:masterfrom
pctablet505:fix-1440-create-update-dict-dataclass

Conversation

@pctablet505

@pctablet505 pctablet505 commented Jul 15, 2026

Copy link
Copy Markdown

Fixes #1440

When a user model uses SQLAlchemy's MappedAsDataclass, registering a user fails on optional fields because create_update_dict drops unset values that the dataclass __init__ expects as keyword arguments.

This keeps exclude_unset=True for partial updates but passes exclude_unset=False during user creation, so default values for optional fields are included.

@pctablet505
pctablet505 marked this pull request as ready for review July 27, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create_update_dict generated wrong dict when using MappedAsDataclass

1 participant