Repository navigation
Handle array-end pointers as CLI resolution errors - #94
Open
Zhuyuyangyy wants to merge 1 commit into
Open
Zhuyuyangyy wants to merge 1 commit into
Zhuyuyangyy wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused CLI guard uses the existing error path, preserves API behavior, and has regression coverage for the affected cases.
No open issues 🎉
What changed in this PR
This PR handles array-end pointers as normal CLI resolution errors instead of allowing an uncaught serialization error. The Python API’s sentinel behavior remains unchanged.
Changes:
- Routes
EndOfListresults through the existing error-reporting and nonzero-exit path. - Adds regression tests for empty and nonempty arrays, nested arrays, continued batch processing, and valid object members named
-.
| File | Description |
|---|---|
| tests.py | Adds regression coverage for array-end errors and valid hyphen keys. |
| bin/jsonpointer | Rejects EndOfList results before JSON serialization. |
Review effort: Balanced
This branch has not been deployed
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.
Problem
Resolving an array-end token (
-) through the CLI returns anEndOfListsentinel. Passing that sentinel tojson.dumps()raises an uncaughtTypeError, prints a traceback, and prevents subsequent files from being processed.For example:
Change
Handle
EndOfListas a normal resolution failure in the CLI, using the existing error-reporting and nonzero-exit path. The Python API and its sentinel behavior are unchanged. An object member named-still resolves normally.Tests
Added regression coverage for empty and nonempty arrays, nested arrays, batches with the failing file before or after a successful file, and valid object members named
-.Before the fix, the two new error-handling tests fail (five failing subtests). After the fix:
This contribution was prepared with AI assistance; the reproduction and tests above were run against the checked-out code.