openapi icon indicating copy to clipboard operation
openapi copied to clipboard

arazzo validate: JSONPath `$.value[0]` rejected (member named value followed by a bracket)

Open kinlane opened this issue 2 weeks ago • 2 comments

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.

kinlane avatar Nov 15 '26 21:11 kinlane

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.

TristanSpeakEasy avatar Nov 16 '26 00:11 TristanSpeakEasy

Sweet. Y'all rock. Will keep an eye out and update.

kinlane avatar Nov 16 '26 00:11 kinlane