arazzo validate: JSONPath `$.value[0]` rejected (member named value followed by a bracket)
openapi arazzo validate rejects JSONPath criteria where a member named value is followed by a bracket segment. These are valid RFC 9535 queries.
Version: v0.0.0-20261102104118-2aeb6618014d (go install, cmd/openapi)
Repro:
arazzo: 1.0.1
info: {title: t, version: 1.0.0}
sourceDescriptions: [{name: p, url: ./petstore.openapi.yaml, type: openapi}]
workflows:
- workflowId: w
steps:
- stepId: s
operationId: listPets
successCriteria:
- context: $response.body
condition: $.value[0]
type: jsonpath
error validation-invalid-syntax invalid jsonpath expression: Error at line 1, column 2: unexpected token when parsing inner segment
$.value[0]
^....
| condition | result |
|---|---|
$.value[0] |
rejected |
$.value[*] |
rejected |
$.value[?(@.id == 'x')] |
rejected |
$.data[0], $.items[0], $.a.b[0] |
accepted |
$.value |
accepted |
$['value'][0] |
accepted |
It looks like value is tokenized as the RFC 9535 value() function name instead of a member-name shorthand. Microsoft Graph and OData list responses put their array under value, so this hits a lot of real workflows: about 70 in the API Evangelist catalog.
Found by arazzo-conformance, a public suite that runs Arazzo tooling against the spec.
Thanks for the really clear report @kinlane, and for running arazzo-conformance against us. The repro table made this quick to track down.
The root cause is in our jsonpath library rather than the Arazzo validator. The tokenizer was treating value (and length, count, match, search) as a function name whenever anything other than a letter followed it, and true/false/null as keywords even straight after a dot. That's why $.value passed but $.value[0] didn't.
The fix is up in speakeasy-api/jsonpath#27. Once that's merged and released I'll bump it here and close this out.
Sweet. Y'all rock. Will keep an eye out and update.