Repository navigation
Expand repeated sibling references in the MCP input schema - #3424
Merged
bnasslahsen merged 1 commit intoNov 6, 2026
Merged
Conversation
OpenApiSchemaConverter added every visited schema to its cycle-detection set and never removed it again. When two properties referenced the same component, the second occurrence was treated as a circular reference and emitted as a bare {"type":"object"}, dropping its properties from the tool input schema.
Remove the schema from the set once its branch is converted, so the set only holds the current resolution path. Real cycles are still cut off.
Signed-off-by: Mario David <mario.david@faktorzehn.de>
bnasslahsen
added a commit
that referenced
this pull request
Nov 6, 2026
…ling-refs Expand repeated sibling references in the MCP input schema. Fixes #3425
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenApiSchemaConverter.applySchemaToNodeadds every visited schema to an identity-basedvisitedset for cycle detection, but never removes it again. The set therefore contains all schemas seen so far in the tree, not only the ones on the current resolution path.When two properties reference the same component (e.g.
homeandworkboth pointing toAddress), the second occurrence is treated as a circular reference and emitted as a bare{"type":"object"}. Its properties are missing from the MCP tool input schema, so the schema is incomplete for any request body that reuses a component more than once.Fix
Remove the schema from
visitedin afinallyblock once its branch has been converted, so the set only holds the current path. The previous method body moved unchanged intoapplySchemaContent. Real cycles are still cut off.Tests
Two new tests in
OpenApiSchemaConverterTest:testSiblingReferencesToSameSchemaAreExpanded: two properties referencing the same component are both fully expanded. Fails without the fix.testSiblingReferencesStillBreakCircularReferences: sibling references to a self-referencing component are both expanded, while the inner cycle is still cut off. Fails without the fix../mvnw -pl springdoc-openapi-starter-common-mcp testpasses (34 tests).