8000 Coerce validator constraints to their valid type by Viicos · Pull Request #1661 · pydantic/pydantic-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Coerce validator constraints to their valid type #1661

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
Mar 5, 2025
Merged

Conversation

Viicos
Copy link
Member
@Viicos Viicos commented Mar 4, 2025

Change Summary

Fixes pydantic/pydantic#11341, fixes #1608.

I've applied the coercion for decimals and ints as per pydantic/pydantic#11341 (comment), should we extend to others? I'm thinking datetime types as well?

Related issue number

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Copy link
codspeed-hq bot commented Mar 4, 2025

CodSpeed Performance Report

Merging #1661 will not alter performance

Comparing constraints-coercion (7b3904e) with main (0761adb)

Summary

✅ 157 untouched benchmarks

Copy link
Contributor
@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking datetime types as well?

Yes, if I recall, datetime types are the last main category where this matters.

@Viicos
Copy link
Member Author
Viicos commented Mar 5, 2025

@davidhewitt I went and did datetime and date, am I missing anything? timedelta has the gx/lx constraints as well, but I'm wondering if we should.

@Viicos Viicos merged commit a6f3972 into main Mar 5, 2025
28 of 29 checks passed
@Viicos Viicos deleted the constraints-coercion branch March 5, 2025 19:35
@davidhewitt
Copy link
Contributor

Think that's good from me, let's wait for user reports to worry about any other cases.

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.

Validation of core schemas Issues with disabled core schema validation
3 participants
0