Skip to content

Support Pydantic 2.11+ in discriminated union decorator #165

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

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

Conversation

tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented May 28, 2025

Internal changes in pydantic mean that the previous use of GenericAlias
no longer works. Parameterising the type directly with SubClass[args]
still works even if the type checking isn't happy about it.

Fixes DiamondLightSource/blueapi#908

Instructions to reviewer on how to test:

  1. Run tests with pydantic 2.11+
  2. Check tests pass

Checks for reviewer

  • Would the PR title make sense to a user on a set of release notes

Internal changes in pydantic mean that the previous use of GenericAlias
no longer works. Parameterising the type directly with SubClass[args]
still works even if the type checking isn't happy about it.
@tpoliaw tpoliaw force-pushed the pydantic_211_support branch from 6bf5583 to 7692d1d Compare June 5, 2025 10:56
@tpoliaw tpoliaw requested a review from DiamondJoseph June 5, 2025 11:11
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.

Movable type referencing is broken in Pydantic 2.11 due to internal changes.
1 participant