Skip to content

Added model validation to remove UNSET before field validation #1233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2023

Conversation

JrooTJunior
Copy link
Member

Description

Updated aiogram/types/base.py to include a model validator which removes any 'UNSET' before field validation. This change was necessary to correctly handle parse_mode where 'UNSET' is used as a sentinel value. Without the removal of 'UNSET', it would create issues when passed to model initialization from Bot.method_name. 'UNSET' was also added to typing. Tiny documentation fix was made.

Updated aiogram/types/base.py to include a model validator which removes any 'UNSET' before field validation. This change was necessary to correctly handle `parse_mode` where 'UNSET' is used as a sentinel value. Without the removal of 'UNSET', it would create issues when passed to model initialization from `Bot.method_name`. 'UNSET' was also added to typing. Tiny documentation fix was made.
@JrooTJunior JrooTJunior added bug Something is wrong with the framework 3.x Issue or PR for stable 3.x version labels Jul 29, 2023
@github-actions
Copy link

github-actions bot commented Jul 29, 2023

✔️ Changelog found.

Thank you for adding a description of the changes

@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Merging #1233 (7f5fef1) into dev-3.x (8ad0a1e) will not change coverage.
Report is 2 commits behind head on dev-3.x.
The diff coverage is 100.00%.

❗ Current head 7f5fef1 differs from pull request most recent head 31a54d5. Consider uploading reports for the commit 31a54d5 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##           dev-3.x     #1233   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          363       363           
  Lines         8970      8974    +4     
=========================================
+ Hits          8970      8974    +4     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
aiogram/types/base.py 100.00% <100.00%> (ø)

@JrooTJunior JrooTJunior merged commit 98780df into dev-3.x Jul 29, 2023
@JrooTJunior JrooTJunior deleted the fixed-unset-in-types branch July 29, 2023 21:01
@aiogram aiogram deleted a comment from github-actions bot Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version bug Something is wrong with the framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant