Repository navigation
fix(json-schema): report invalid prefixItems arguments instead of crashing - #12330
Merged
Timothee Guerin (timotheeguerin) merged 1 commit intoOct 26, 2026
Conversation
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Timothee Guerin (timotheeguerin)
marked this pull request as ready for review
October 21, 2026 18:13
Timothee Guerin (timotheeguerin)
requested review from
catalinaperalta,
iscai-msft,
Laurent Mazuel (lmazuel) and
Mark Cowlishaw (markcowl)
as code owners
October 21, 2026 18:13
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused guard prevents invalid state, preserves tuple handling, and includes regression coverage with no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes JSON Schema’s @prefixItems crash by rejecting non-tuple arguments while preserving valid tuple behavior.
Changes:
- Validates arguments before storing prefix items and reports a targeted diagnostic.
- Adds regression coverage for array arguments.
- Includes a package changelog entry.
| File | Description |
|---|---|
| packages/json-schema/test/arrays.test.ts | Tests rejection of array arguments. |
| packages/json-schema/src/lib.ts | Defines the invalid-argument diagnostic. |
| packages/json-schema/src/decorators.ts | Guards against non-tuple arguments. |
| .chronus/changes/fix-json-schema-prefix-items-2026-10-21.md | Documents the crash fix. |
Review effort: Balanced
iscai-msft
approved these changes
Oct 26, 2026
Timothee Guerin (timotheeguerin)
deleted the
fix/json-schema-prefix-items
branch
October 26, 2026 16:03
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.
@prefixItems(string[])passes decorator argument checking but crashes the JSON Schema emitter while iterating its prefix types.Reject non-tuple arguments at the decorator with a diagnostic pointing to the argument. Valid tuples such as
@prefixItems([string, int32])retain their existing output.Fixes #4742