Skip to content
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

Support wider variety of enum validation cases #1456

Merged
merged 7 commits into from
Sep 20, 2024
Merged

Conversation

sydney-runkle
Copy link
Member

@sydney-runkle sydney-runkle commented Sep 18, 2024

Alternative to #1324, thanks @mikeleppane for some of the tests here! Basically, fall back to trying to SomeEnum(input_value), and if that's valid, then return that value. This enables the use of custom __new__ functions as well :).

Fix pydantic/pydantic#9559
Fix pydantic/pydantic#9572
Fix pydantic/pydantic#9248

These to be addressed separately, in another PR soon that deals with the Literal validator:

Copy link

codspeed-hq bot commented Sep 18, 2024

CodSpeed Performance Report

Merging #1456 will not alter performance

Comparing enum-fixes (c4fc1a5) with main (e0b4c94)

Summary

✅ 155 untouched benchmarks

@sydney-runkle sydney-runkle merged commit 8c1a0da into main Sep 20, 2024
28 of 29 checks passed
@sydney-runkle sydney-runkle deleted the enum-fixes branch September 20, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants