fix: allow additional properties by default per JSON Schema spec #617
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": false
if they want to disallow additional properties.Migration guide:
Types of changes