Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Add python validators for decimal constraints (max_digits
anddecimal_places
)#10506
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cloudflare-workers-and-pagesbot commentedSep 27, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Deploying pydantic-docs with |
Latest commit: | 9adef0c |
Status: | ✅ Deploy successful! |
Preview URL: | https://99e28bdc.pydantic-docs.pages.dev |
Branch Preview URL: | https://add-decimal-validators.pydantic-docs.pages.dev |
codspeed-hqbot commentedSep 27, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#10506 willnot alter performanceComparing Summary
|
github-actionsbot commentedSep 27, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Coverage reportClick to see where and how coverage changed
This report was generated bypython-coverage-comment-action |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Alex Hall <alex.mojaki@gmail.com>
I think it's alright if I merge this (given the approval and iterations on feedback), but if there's anything left unaddressed, happy to open another PR on Monday! |
01b5929
intomainUh oh!
There was an error while loading.Please reload this page.
I'm wondering: why is the Python validation only called when a validator is already present? Can we avoid duplication between pydantic-core and here? Other thing, seems like |
Good question. I think this issue helps to explain things:#10036 Specifically, we use these Python validators for cases where it'd violate our promise to maintain the order of annotations if we directly applied the constraint to the core schema. But, the validator is still compatible with the type after the custom validator is called, so we can use these python wrappers. |
Uh oh!
There was an error while loading.Please reload this page.
Closes#10498
This specifically addresses issues where there is annotated metadata applied between the type and the decimal constraints.
For this sample:
The output used to be: