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

Handle validators on vanilla dataclass fields #5857

Merged
merged 4 commits into from
May 25, 2023
Merged

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented May 24, 2023

Partially addresses #5271.

Still need to add a test or two, but opening the PR now so work doesn't end up duplicated.

See #5271 (comment) for at least one test we can add.

@cloudflare-pages
Copy link

cloudflare-pages bot commented May 24, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: f329cf7
Status: ✅  Deploy successful!
Preview URL: https://834e957a.pydantic-docs2.pages.dev
Branch Preview URL: https://v2-dataclass-improvements.pydantic-docs2.pages.dev

View logs

@dmontagu
Copy link
Contributor Author

@adriangb If you are totally against this change we can leave it, but if you'd just want to see other tests pass first, I'm open to any suggestions.

@adriangb
Copy link
Member

If you feel confident that this doesn't break under edge cases then let's go for it

@dmontagu
Copy link
Contributor Author

dmontagu commented May 24, 2023

I wouldn't say confident, but it seems sound to me. I'll give a bit more thorough review of where we construct schemas related to dataclasses before merging.

@adriangb there's nothing similar with TypedDict now is there? I think we can't do decorators on those (in not-small-part related to inability to inspect class hierarchy), just making sure though.

@adriangb
Copy link
Member

It should work for TypedDict on the latest typing-extensions version and Python 3.12.

@dmontagu dmontagu enabled auto-merge (squash) May 25, 2023 22:37
@dmontagu dmontagu merged commit 1c38660 into main May 25, 2023
50 checks passed
@dmontagu dmontagu deleted the v2-dataclass-improvements branch May 25, 2023 22:48
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.

None yet

2 participants