E528 Support specification of `strict` on `Enum` type fields by sydney-runkle · Pull Request #7761 · pydantic/pydantic · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@sydney-runkle
Copy link
Contributor
@sydney-runkle sydney-runkle commented Oct 6, 2023

Change Summary

Support specification of strict on Enum type fields
More broadly, this allows for the strict specification to be added to lax-or-strict schema, where it's expected but for some reason wasn't allowed to be added.

Fix #7759

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @lig

@sydney-runkle
Copy link
Contributor Author

Please review

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.

Fix looks good to me.

I half wonder whether there's a way that we could inspect the core_schema methods to figure out what the allowed constraints could be (but probably that's a complex algorithm which isn't great to run on startup time).

@sydney-runkle sydney-runkle merged commit 822e841 into main Oct 8, 2023
@sydney-runkle sydney-runkle deleted the fix-strict-with-enum-issue branch October 8, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

52CD None yet

Development

Successfully merging this pull request may close these issues.

RuntimeError: Unable to apply constraint strict to schema lax-or-strict when trying to set strictness on enum fields

4 participants

0