fix(library): do not emit unevaluatedProperties for non-object schemas#2774
Merged
fix(library): do not emit unevaluatedProperties for non-object schemas#2774
Conversation
When `Type` is explicitly set and does not include `Object`, skip emitting `unevaluatedProperties` in all serialization paths (v3.1+ native property, v2.0/v3.0 extension, and direct v2.0 serialization). Closes: unevaluatedProperties emitted for array/string/number/integer/boolean/null schemas Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix
fix(library): do not emit unevaluatedProperties for non-object schemas
Mar 13, 2026
unevaluatedProperties emission for non-object schemas
baywet
approved these changes
Mar 13, 2026
|
adrian05-ms
approved these changes
Mar 13, 2026
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.



unevaluatedProperties: falsewas being serialized on schemas whosetypeisarray,string,number,integer,boolean, ornull— types for which this keyword has no semantic effect in JSON Schema 2020-12.Changes Made
WriteJsonSchemaKeywords(v3.1+ native property): skipunevaluatedPropertieswhenTypeis set and does not include theObjectflagSerializeInternal(v2.0/v3.0x-jsonschema-unevaluatedPropertiesextension): same guardSerializeAsV2private method: same guardGuard condition:
!Type.HasValue || (Type.Value & JsonSchemaType.Object) != 0Preserves emission when
Typeis unset (required foranyOf/oneOf/allOfcomposition patterns) and when type includesobject.Before:
After:
Type of Change
Testing
New tests cover:
array,string,number,integer,boolean,null) not emittingunevaluatedProperties: falsein v3.1UnevaluatedPropertiesSchemain v3.1objecttype still emitsunevaluatedPropertiesTypestill emitsunevaluatedPropertiesChecklist
Versions applicability
Additional Notes
This fix intentionally does not handle mixed types (e.g.,
["object", "array"]) or complex composition scenarios as out of scope for this PR.Original prompt
unevaluatedPropertiesfor non-object schemas #2762🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.