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

ValidationError missing reference to model being validated #1344

Closed
slahn opened this issue Jun 25, 2024 · 1 comment
Closed

ValidationError missing reference to model being validated #1344

slahn opened this issue Jun 25, 2024 · 1 comment
Assignees

Comments

@slahn
Copy link

slahn commented Jun 25, 2024

In pydantic 1.x, ValidationError has a model property which references the model being validated.
We used this when deciding what error to show to the user.

It doesn't seem possible to get this information in 2.x.
Would you consider adding it back?

(I'm guessing this issue belongs in core and not in pydantic. If it's in the wrong place, let me know)

@sydney-runkle
Copy link
Member

Good question - I don't think we'll add this back, but we will allow subclassing of ValidationError, which will enable support for something like this on the user side.

See pydantic/pydantic#9686 to track that progress. Going to close this as resolved for now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants