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

Fix schema build for nested dataclasses / TypedDicts with discriminators #8950

Merged
merged 4 commits into from Mar 5, 2024

Conversation

sydney-runkle
Copy link
Member

@sydney-runkle sydney-runkle commented Mar 5, 2024

Revisit the changes made in #7646, which introduced a few bugs for edge cases when building schemas for nested dataclasses / TypedDicts with discriminators.

Fix #8271
Fix #8628

Selected Reviewer: @hramezani

Copy link

cloudflare-pages bot commented Mar 5, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5c151c5
Status: ✅  Deploy successful!
Preview URL: https://2a687d8e.pydantic-docs2.pages.dev
Branch Preview URL: https://fix-discriminators-for-datac.pydantic-docs2.pages.dev

View logs

@sydney-runkle
Copy link
Member Author

Please review

Copy link

codspeed-hq bot commented Mar 5, 2024

CodSpeed Performance Report

Merging #8950 will not alter performance

Comparing fix-discriminators-for-dataclasses (5c151c5) with main (b09e06c)

Summary

✅ 10 untouched benchmarks

Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
Copy link
Member

@adriangb adriangb left a comment

Choose a reason for hiding this comment

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

If this fixes the new test cases and doesn't break others this seems good to me. Great job on the comments by the way!

Do we have any sort of benchmark tests for this stuff? My main concern with future changes is that evidently modifying 1 line of code can take us from linear to exponential complexity. Maybe we can add a really naive test that just calls time() on 1 input and time() on 1000 input and make sure it's <= 5k times slower (so give or take linear)?

@sydney-runkle
Copy link
Member Author

@adriangb,

Good question. To my knowledge, we don't have extensive performance testing for these things. I've opened an issue here: #8953. I'd like to address this issue before the patch release so that we can verify that we've improved things significantly.

@sydney-runkle sydney-runkle merged commit a25882c into main Mar 5, 2024
54 checks passed
@sydney-runkle sydney-runkle deleted the fix-discriminators-for-dataclasses branch March 5, 2024 17:29
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
4 participants