Repository navigation
fix: allow function names and keywords as JSONPath member names in Arazzo criteria - #304
Merged
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would auto-approve. Bounded dependency bump to jsonpath v0.7.1 fixes Arazzo criteria rejecting valid RFC 9535 keyword/function member names; tests pin the corrected behavior, and the stricter parse of unknown functions matches the spec.
View guided diff | Turn on auto-fix | Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Why
openapi arazzo validaterejected valid RFC 9535 JSONPath criteria that use a function name or keyword as a member name, such as$.value[0],$.value[?(@.id == 'x')]or$.true. Microsoft Graph and OData list responses put their arrays undervalue, so this broke a lot of real workflows. Thanks to @kinlane for the report, found via arazzo-conformance.The bug was in the jsonpath tokenizer and is fixed upstream in speakeasy-api/jsonpath#27 (released as v0.7.1).
Closes #301
What changed
github.com/speakeasy-api/jsonpathto v0.7.1 in the root andcmd/openapimodules. The other workspace modules only hadgo.sumupdates frommise run mod-tidy.TestCriterion_Validate_JsonPathKeywordMemberNames_Success, covering the conditions from the issue pluslength/keyword member names and a realvalue()function call.$.length == 5is still rejected (a comparison outside a filter isn't valid RFC 9535), but the error now points at the==(column 9) instead of the space afterlength(column 8).Review notes
$[?foo(@.a) > 1]used to be silently treated aslength()and is now a parse error. That matches RFC 9535, but it could surface new validation errors on documents that were relying on it.Testing
mise cipassed locally (format, mod-check, lint, README examples, tests, CLI integration tests, build).$.value[0]rejected (member named value followed by a bracket) #301 repro throughopenapi arazzo validate: it fails on v0.7.0 and validates cleanly on the fixed jsonpath.Summary by cubic
Fixes
openapi arazzo validaterejecting valid RFC 9535 JSONPath criteria that use function names or keywords as member names, such as$.value[0],$.value[?(@.id == 'x')], or$.true. This broke real workflows, since Microsoft Graph and OData list responses put arrays undervalue. The fix bumpsgithub.com/speakeasy-api/jsonpathto v0.7.1, adds tests covering keyword and function-name member names (value,length,count,match,search), and updates the expected error string for the Ritza stress test. One stricter behavior arrives with the bump: unknown functions like$[?foo(@.a) > 1]were silently treated aslength()and are now a parse error, matching RFC 9535, so documents relying on that would now fail validation. Closes #301.Written for commit 1866a0b. Summary will update on new commits.