Skip to content
Discussion options

You must be logged in to vote

This is not a bug, but just how it works.
Pydantic tries to validate data using all types in Union and collect all error messages.

You can make error message cleaner using discriminated unions: https://docs.pydantic.dev/latest/concepts/unions/#discriminated-unions

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
2 participants
Converted from issue

This discussion was converted from issue #3708 on February 27, 2023 22:26.