fix: allow additional properties by default per JSON Schema spec#617
Merged
tzolov merged 1 commit intomodelcontextprotocol:mainfrom Oct 14, 2025
Merged
Conversation
- Remove automatic additionalProperties: false injection (JSON Schema spec compliance) - Support String input for structuredContent in validate() method - Move tests to mcp-json-jackson2 module with proper dependencies - Replace wildcard imports with explicit imports Complies with JSON Schema Test Suite: https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/15e4505/tests/draft2020-12/additionalProperties.json\#L112 Fixes modelcontextprotocol#584 BREAKING CHANGE: Additional properties now allowed by default when not explicitly specified. Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com> Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
tzolov
added a commit
that referenced
this pull request
Oct 14, 2025
- Remove automatic additionalProperties: false injection (JSON Schema spec compliance) - Support String input for structuredContent in validate() method - Move tests to mcp-json-jackson2 module with proper dependencies - Replace wildcard imports with explicit imports Complies with JSON Schema Test Suite: https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/15e4505/tests/draft2020-12/additionalProperties.json\#L112 Fixes #584 BREAKING CHANGE: Additional properties now allowed by default when not explicitly specified. Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
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.
Summary
Fix JSON Schema validation to comply with the official JSON Schema specification by allowing additional properties by default when not explicitly specified in schemas. Also adds support for String input in the validate() method.
Complies with JSON Schema Test Suite:
https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/15e4505/tests/draft2020-12/additionalProperties.json#L112
Fixes #584
Motivation and Context
This fix ensures the SDK behaves correctly according to the JSON Schema specification, preventing false validation failures and improving interoperability with other JSON Schema validators.
Additionally, the validator now supports String input for
structuredContent, allowing direct JSON string validation without requiring pre-parsing.Breaking Changes
YES - This is a breaking change.
Users who relied on the previous non-compliant behavior (additional properties rejected by default) will need to update their schemas to explicitly set
"additionalProperties": falseif they want to disallow additional properties.Migration guide:
Types of changes