fix: allow function names and keywords as JSONPath member names in Arazzo criteria
Why
openapi arazzo validate rejected 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 under value, 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
- Bumped
github.com/speakeasy-api/jsonpathto v0.7.1 in the root andcmd/openapimodules. The other workspace modules only hadgo.sumupdates frommise run mod-tidy. - Added
TestCriterion_Validate_JsonPathKeywordMemberNames_Success, covering the conditions from the issue pluslength/keyword member names and a realvalue()function call. - Updated the expected-error ignore string for the Ritza stress test.
$.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
- One stricter behaviour arrives with v0.7.1: an unknown function such as
$[?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).- Ran the #301 repro through
openapi arazzo validate: it fails on v0.7.0 and validates cleanly on the fixed jsonpath.
Summary by cubic
Fixes openapi arazzo validate rejecting 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 under value. The fix bumps github.com/speakeasy-api/jsonpath to 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 as length() and are now a parse error, matching RFC 9535, so documents relying on that would now fail validation. Closes #301.