[Mcp] Properly handle oneOf and anyOf in generated mcp schema so that JSONLD output is actually valid#7962
Merged
soyuka merged 2 commits intoapi-platform:4.3from May 11, 2026
Merged
Conversation
9ffc5c0 to
953c992
Compare
| Q | A | ------------- | --- | Branch? | 4.3 | Tickets | ∅ | License | MIT | Doc PR | ∅ Regression coverage for SchemaFactory: oneOf/anyOf nodes must not get a `type: object` fallback injected, otherwise Hydra's @context union is broken in the generated MCP schema.
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.
So far, the generated output schemas for Mcp does not handle oneOf and anyOf correctly. The JSONLD @context property which can either bei "string" or "object" gets flattended to "object" only, and the schema validation will fail on outputs where the @context is a string (which seems to be the default). Breaking tool use on validating software like Claude Desktop.
This PR fixed this issue.