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

[Bugfix] Detect more schema type reference cycles. #335

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

czechboy0
Copy link
Contributor

Motivation

The newly introduced recursive type support had a slight optimization to minimize the number of boxed types, but it contained a bug that only surfaced on larger real-world documents. It's not really necessary, so removed it and the number of boxed types is still reasonable, plus it doesn't lead to non-compiling code anymore.

Modifications

Removed an optimization that tried to further reduce the number of boxed types, because it actually missed some cycles and produced non-compiling code for some larger OpenAPI documents.

Result

Code now compiles even for more complex cycles.

Test Plan

Added more unit tests, plus tested on some real-world docs with cycles that failed before this change.

@czechboy0 czechboy0 mentioned this pull request Oct 20, 2023
@czechboy0 czechboy0 merged commit 978e498 into apple:main Oct 23, 2023
@czechboy0 czechboy0 deleted the hd-fix-recursion-detector branch October 23, 2023 08:39
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants