Skip to content

Conversation

ptoffy
Copy link

@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.

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.

Reference cycle causing infinite loop in production OpenAPI document
2 participants