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

Fix str subclass validation for enums #1273

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Fix str subclass validation for enums #1273

wants to merge 4 commits into from

Conversation

sydney-runkle
Copy link
Member

@sydney-runkle sydney-runkle changed the title Various enum fixes for upcoming patch Fix str subclass validation for enums Apr 18, 2024
Copy link

codspeed-hq bot commented Apr 18, 2024

CodSpeed Performance Report

Merging #1273 will not alter performance

Comparing enum_fixes (0d7f714) with main (4adf47f)

Summary

✅ 155 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.

Do we have the same problem for int subclasses? (I think bools cannot be subclassed.)

I wonder if there's a more general structural issue here (like e.g. maybe lookup.validate should take a strict argument)?

tests/validators/test_enums.py Outdated Show resolved Hide resolved
sydney-runkle and others added 2 commits April 18, 2024 10:49
Co-authored-by: David Hewitt <david.hewitt@pydantic.dev>
@sydney-runkle
Copy link
Member Author

Alright, so we want to move forward with this by modifying how we validate enums (moving away from the literal validation logic). Definitely something we still want to fix, but going to wait on 2.7.2 for this one 👍

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 error with str Enum field and numpy's str_ type
2 participants