Skip to content

Support discriminator metadata outside union type alias#12785

Merged
Viicos merged 3 commits intomainfrom
vp/discriminated-unions-typealias
Mar 2, 2026
Merged

Support discriminator metadata outside union type alias#12785
Viicos merged 3 commits intomainfrom
vp/discriminated-unions-typealias

Conversation

@Viicos
Copy link
Copy Markdown
Member

@Viicos Viicos commented Feb 8, 2026

Change Summary

Fixes #12771, fixes #11043, fixes #12843.

Related issue number

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

@Viicos Viicos added the relnotes-fix Used for bugfixes. label Feb 8, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 8, 2026

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 8, 2026

Merging this PR will not alter performance

✅ 212 untouched benchmarks


Comparing vp/discriminated-unions-typealias (ef22223) with main (2c51321)

Open in CodSpeed

@Viicos Viicos requested a review from davidhewitt February 8, 2026 12:37
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 8, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  types.py
  pydantic/_internal
  _discriminated_union.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Copy Markdown
Member

@friendlymatthew friendlymatthew left a comment

Choose a reason for hiding this comment

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

Nice

This prevents users from defining non union types that actually
produce a union core schema.
Also fix coverage
@Viicos Viicos force-pushed the vp/discriminated-unions-typealias branch from 5414d7b to ef22223 Compare March 2, 2026 11:26
@Viicos Viicos merged commit d286c73 into main Mar 2, 2026
83 checks passed
@Viicos Viicos deleted the vp/discriminated-unions-typealias branch March 2, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotes-fix Used for bugfixes.

Projects

None yet

2 participants