This is my attempt to get the Traits overlay example working with Speakeasy's overlay tooling.
The original example is here.
openapi: 3.1.0
info:
title: API with a paged collection
version: 1.0.0
paths:
/items:
get:
x-oai-traits: ['paged']
responses:
200:
description: OK
overlay: 1.0.0
info:
title: Apply Traits
version: 1.0.0
actions:
- target: $.paths.*.get[[email protected]]
update:
parameters:
- name: top
in: query
schema:
type: integer
- name: skip
in: query
schema:
type: integer
What about the JSON Path Plus package? It has an online tool too:
https://jsonpath.com
Interesting that I see it offers two modes -- "RFC 9535" and "JSONPath Plus".
Of course, it only accepts JSON and not YAML, so here's the same schemas as above but in JSON:
Original OpenAPI
And let's try a few queries:
RFC 9535 mode
$.paths.*.get[[email protected]]
- syntax error$.paths.*.get[?@['x-oai-paged']]
- no syntax error but no nodes selected$.paths[[email protected] && @.get['x-oai-paged']]
-- works and selects the expect objectJSONPath Plus mode
$.paths.*.get[[email protected]]
- no syntax error but no nodes selected$.paths.*.get[?@['x-oai-paged']]
- no syntax error but no nodes selected$.paths[[email protected] && @.get['x-oai-paged']]
-- no syntax error but no nodes selected$.paths.*.get[?(@.x-oai-paged)]
- syntax error$.paths.*.get[?(@['x-oai-paged'])]
-- no syntax error but no nodes selected$.paths.*.get[?(@['x-oai-paged'] == true)]
-- no syntax error but no nodes selected$.paths[?(@.get && @.get['x-oai-paged'])]
-- works and selects the expect objectHMMMMM.