fix: handle MappedAsDataclass in create_update_dict by pctablet505 · Pull Request #1575 · fastapi-users/fastapi-users · GitHub
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

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
@pctablet505
pctablet505 force-pushed the fix-1440-create-update-dict-dataclass branch from 8c57575 to e24ba19 Compare August 21, 2026 15:19
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