Skip to content

Conversation

ptoffy
Copy link
Contributor

@ptoffy ptoffy commented Aug 19, 2025

Motivation

Fixes #769
Currently, as seen in the issue mentioned above, if a recursive schema gets referenced from a multipart-based path, a reference cycle error gets thrown. Since we support recursive type generation already, this shouldn't happen.

Modifications

This PR removes the last dereferenced(in:) method call, which would throw if a reference cycle was found, replacing it with a simple lookup in the OpenAPI components tree. It also replaces DerereferencedJSONSchema with JSONSchema accordingly.

Result

Multipart-based paths can now reference recursive types.

Test Plan

This also adds a test with such a case. We could probably also add a test with a multipart path referencing an array of references instead of just a reference to be thorough.

@czechboy0
Copy link
Contributor

Thank you, @ptoffy - added one comment about the test, I think we need to tweak it to prove out that this change really makes recursive schemas work with multipart.

@ptoffy ptoffy requested a review from czechboy0 August 25, 2025 15:01
Copy link
Contributor

@czechboy0 czechboy0 left a comment

Choose a reason for hiding this comment

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

This looks better, thanks @ptoffy - let's check if CI is green now.

@czechboy0 czechboy0 enabled auto-merge (squash) September 17, 2025 10:23
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Sep 17, 2025
@czechboy0 czechboy0 merged commit d74223c into apple:main Sep 17, 2025
45 of 46 checks passed
@ptoffy ptoffy deleted the fix-recursive-multipart-types branch September 17, 2025 13:04
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.

2 participants