Skip to content

Commit 5c34696

Browse files
Merge pull request #409 from frankkilcommins/extended-jsonpath-support
feat(spec): Add support for JSONPath and XPath where JSONPointer is supported
2 parents 7872665 + 9783f35 commit 5c34696

13 files changed

+387
-102
lines changed

src/arazzo.md

Lines changed: 133 additions & 46 deletions
Large diffs are not rendered by default.

src/schemas/validation/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
# OpenAPI Arazzo 1.0.x JSON Schema
1+
# OpenAPI Arazzo 1.X.Y JSON Schema
22

3-
Here you can find the JSON Schema for validating Arazzo Documents conforming to versions 1.0.x.
3+
Here you can find the JSON Schema for validating Arazzo Documents conforming to versions 1.X.Y, which are published on [https://spec.openapis.org](https://spec.openapis.org).
44

5-
As a reminder, the JSON Schema is not the source of truth for the Specification.
6-
In cases of conflicts between the Specification itself and the JSON Schema, the
7-
Specification wins. Also, some Specification constraints cannot be represented
8-
with the JSON Schema so it's highly recommended to employ other methods to
9-
ensure compliance.
5+
Due to limitations of GitHub pages, the schemas on the spec site are served with `Content-Type: application/octet-stream`, but should be interpreted as `application/schema+json`.
6+
7+
The sources in this directory, which have `WORK-IN-PROGRESS` in their `$id`s, are _not intended for direct use_.
108

119
The iteration version of the JSON Schema can be found in the `$id` field.
1210
For example, the value of `$id: https://spec.openapis.org/arazzo/1.0/schema/2024-10-17` means this iteration was created on October 17, 2024.
1311

1412
## Contributing
1513

14+
As a reminder, the JSON Schema is not the source of truth for the Specification.
15+
In cases of conflicts between the Specification itself and the JSON Schema, the
16+
Specification wins. Also, some Specification constraints cannot be represented
17+
with the JSON Schema so it's highly recommended to employ other methods to
18+
ensure compliance.
19+
1620
To submit improvements to the schema, modify the `schema.yaml` and add test cases for your changes.
1721

1822
The TSC will then:
@@ -22,7 +26,7 @@ The TSC will then:
2226

2327
## Tests
2428

25-
The [test suite](../../tests/v1.0) is part of this package.
29+
The [test suite](../../tests/schema) is part of this package.
2630

2731
```bash
2832
npm install

src/schemas/validation/schema.yaml

Lines changed: 107 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
$id: 'https://spec.openapis.org/arazzo/1.0/schema/WORK-IN-PROGRESS'
1+
$id: 'https://spec.openapis.org/arazzo/1.1/schema/WORK-IN-PROGRESS'
22
$schema: 'https://json-schema.org/draft/2020-12/schema'
33
description: |-
4-
The description of Arazzo v1.0.x documents
4+
The description of Arazzo v1.1.x documents
55
type: object
66
properties:
77
arazzo:
88
description: The version number of the Arazzo Specification
99
type: string
10-
pattern: '^1\.0\.\d+(-.+)?$'
10+
pattern: '^1\.1\.\d+(-.+)?$'
1111
info:
1212
$ref: '#/$defs/info'
1313
sourceDescriptions:
@@ -35,7 +35,7 @@ $ref: '#/$defs/specification-extensions'
3535
unevaluatedProperties: false
3636
$defs:
3737
info:
38-
$comment: https://spec.openapis.org/arazzo/v1.0#info-object
38+
$comment: https://spec.openapis.org/arazzo/v1.1#info-object
3939
description: Provides metadata about the Arazzo description
4040
type: object
4141
properties:
@@ -57,7 +57,7 @@ $defs:
5757
$ref: '#/$defs/specification-extensions'
5858
unevaluatedProperties: false
5959
source-description-object:
60-
$comment: https://spec.openapis.org/arazzo/v1.0#source-description-object
60+
$comment: https://spec.openapis.org/arazzo/v1.1#source-description-object
6161
description: |-
6262
Describes a source description (such as an OpenAPI description)
6363
that will be referenced by one or more workflows described within
@@ -83,7 +83,7 @@ $defs:
8383
$ref: '#/$defs/specification-extensions'
8484
unevaluatedProperties: false
8585
workflow-object:
86-
$comment: https://spec.openapis.org/arazzo/v1.0#workflow-object
86+
$comment: https://spec.openapis.org/arazzo/v1.1#workflow-object
8787
description: Describes the steps to be taken across one or more APIs to achieve an objective
8888
type: object
8989
properties:
@@ -130,11 +130,15 @@ $defs:
130130
- $ref: '#/$defs/failure-action-object'
131131
- $ref: '#/$defs/reusable-object'
132132
outputs:
133-
description: A map between a friendly name and a dynamic output value
133+
description: >
134+
A map between a friendly name and a dynamic output value defined using a
135+
Runtime Expression or Selector Object. Keys must match the regex: ^[a-zA-Z0-9\.\-_]+$
134136
type: object
135137
patternProperties:
136138
'^[a-zA-Z0-9\.\-_]+$':
137-
type: string
139+
oneOf:
140+
- type: string
141+
- $ref: '#/$defs/selector-object'
138142
parameters:
139143
description: A list of parameters that are applicable for all steps described under this workflow
140144
type: array
@@ -149,7 +153,7 @@ $defs:
149153
$ref: '#/$defs/specification-extensions'
150154
unevaluatedProperties: false
151155
step-object:
152-
$comment: https://spec.openapis.org/arazzo/v1.0#step-object'
156+
$comment: https://spec.openapis.org/arazzo/v1.1#step-object'
153157
description: |-
154158
Describes a single workflow step which MAY be a call to an
155159
API operation (OpenAPI Operation Object or another Workflow Object)
@@ -202,11 +206,15 @@ $defs:
202206
- $ref: '#/$defs/failure-action-object'
203207
- $ref: '#/$defs/reusable-object'
204208
outputs:
205-
description: A map between a friendly name and a dynamic output value defined using a runtime expression
209+
description: >
210+
A map between a friendly name and a dynamic output value defined using a
211+
Runtime Expression or Selector Object. Keys must match the regex: ^[a-zA-Z0-9\.\-_]+$
206212
type: object
207213
patternProperties:
208214
'^[a-zA-Z0-9\.\-_]+$':
209-
type: string
215+
oneOf:
216+
- type: string
217+
- $ref: '#/$defs/selector-object'
210218
required:
211219
- stepId
212220
oneOf:
@@ -245,7 +253,7 @@ $defs:
245253
$ref: '#/$defs/specification-extensions'
246254
unevaluatedProperties: false
247255
request-body-object:
248-
$comment: https://spec.openapis.org/arazzo/v1.0#request-body-object
256+
$comment: https://spec.openapis.org/arazzo/v1.1#request-body-object
249257
description: The request body to pass to an operation as referenced by operationId or operationPath
250258
type: object
251259
properties:
@@ -262,7 +270,7 @@ $defs:
262270
$ref: '#/$defs/specification-extensions'
263271
unevaluatedProperties: false
264272
criterion-object:
265-
$comment: https://spec.openapis.org/arazzo/v1.0#criterion-object
273+
$comment: https://spec.openapis.org/arazzo/v1.1#criterion-object
266274
description: |-
267275
An object used to specify the context, conditions, and condition types
268276
that can be used to prove or satisfy assertions specified in Step Object successCriteria,
@@ -275,37 +283,39 @@ $defs:
275283
condition:
276284
description: The condition to apply
277285
type: string
278-
anyOf:
279-
- type: object
280-
properties:
281-
type:
282-
description: The type of condition to be applied
283-
enum:
286+
type:
287+
description: The type of condition to be applied or a reference to an expression type object
288+
oneOf:
289+
- type: string
290+
enum:
284291
- simple
285292
- regex
286293
- jsonpath
287294
- xpath
288295
default: simple
289-
- $ref: '#/$defs/criterion-expression-type-object'
296+
- $ref: '#/$defs/expression-type-object'
290297
required:
291298
- condition
292299
dependentRequired:
293300
type:
294301
- context
295302
$ref: '#/$defs/specification-extensions'
296303
unevaluatedProperties: false
297-
criterion-expression-type-object:
298-
$comment: https://spec.openapis.org/arazzo/v1.0#criterion-expression-type-object
299-
description: An object used to describe the type and version of an expression used within a Criterion Object
304+
expression-type-object:
305+
$comment: https://spec.openapis.org/arazzo/v1.1#expression-type-object
306+
description: An object used to describe the type and version of an expression used within a Criterion Object or Selector Object. If the `version` is omitted, a default value is assumed based on the expression `type`
300307
type: object
301308
properties:
302309
type:
303-
description: The type of condition to be applied
310+
description: The type of selector to use
304311
enum:
305312
- jsonpath
306313
- xpath
314+
- jsonpointer
307315
version:
308-
description: A short hand string representing the version of the expression type
316+
description: >
317+
A short hand string representing the version of the expression type.
318+
If omitted, the default for the selected type will be used.
309319
type: string
310320
required:
311321
- type
@@ -320,7 +330,10 @@ $defs:
320330
then:
321331
properties:
322332
version:
323-
const: draft-goessner-dispatch-jsonpath-00
333+
enum:
334+
- rfc9535
335+
- draft-goessner-dispatch-jsonpath-00
336+
324337
- if:
325338
required:
326339
- type
@@ -334,9 +347,19 @@ $defs:
334347
- xpath-10
335348
- xpath-20
336349
- xpath-30
350+
- xpath-31
351+
352+
- if:
353+
properties:
354+
type:
355+
const: jsonpointer
356+
then:
357+
properties:
358+
version:
359+
const: rfc6901
337360
$ref: '#/$defs/specification-extensions'
338361
success-action-object:
339-
$comment: https://spec.openapis.org/arazzo/v1.0#success-action-object
362+
$comment: https://spec.openapis.org/arazzo/v1.1#success-action-object
340363
description: A single success action which describes an action to take upon success of a workflow step
341364
type: object
342365
properties:
@@ -378,7 +401,7 @@ $defs:
378401
$ref: '#/$defs/specification-extensions'
379402
unevaluatedProperties: false
380403
failure-action-object:
381-
$comment: https://spec.openapis.org/arazzo/v1.0#failure-action-object
404+
$comment: https://spec.openapis.org/arazzo/v1.1#failure-action-object
382405
description: A single failure action which describes an action to take upon failure of a workflow step
383406
type: object
384407
properties:
@@ -437,7 +460,7 @@ $defs:
437460
$ref: '#/$defs/specification-extensions'
438461
unevaluatedProperties: false
439462
reusable-object:
440-
$comment: https://spec.openapis.org/arazzo/v1.0#reusable-object
463+
$comment: https://spec.openapis.org/arazzo/v1.1#reusable-object
441464
description: A simple object to allow referencing of objects contained within the Components Object
442465
type: object
443466
properties:
@@ -457,7 +480,7 @@ $defs:
457480
- reference
458481
unevaluatedProperties: false
459482
parameter-object:
460-
$comment: https://spec.openapis.org/arazzo/v1.0#parameter-object
483+
$comment: https://spec.openapis.org/arazzo/v1.1#parameter-object
461484
description: Describes a single step parameter
462485
type: object
463486
properties:
@@ -473,36 +496,76 @@ $defs:
473496
- cookie
474497
value:
475498
description: The value to pass in the parameter
476-
type:
477-
- string
478-
- boolean
479-
- object
480-
- array
481-
- number
482-
- 'null'
499+
oneOf:
500+
- type:
501+
- string
502+
- boolean
503+
- array
504+
- number
505+
- 'null'
506+
- $ref: '#/$defs/selector-object'
483507
required:
484508
- name
485509
- value
486510
$ref: '#/$defs/specification-extensions'
487511
unevaluatedProperties: false
488512
payload-replacement-object:
489-
$comment: https://spec.openapis.org/arazzo/v1.0#payload-replacement-object
513+
$comment: https://spec.openapis.org/arazzo/v1.1#payload-replacement-object
490514
description: Describes a location within a payload (e.g., a request body) and a value to set within the location
491515
type: object
492516
properties:
493517
target:
494-
description: A JSON Pointer or XPath Expression which MUST be resolved against the request body
518+
description: A JSONPath, JSON Pointer, or XPath Expression which MUST be resolved against the request body
495519
type: string
520+
targetSelectorType:
521+
description: >
522+
The selector expression type to use (e.g., `jsonpath`, `xpath`, or `jsonpointer`).
523+
Should an alternate version be required, the Expression Type Object may be used instead.
524+
If omitted, defaults to JSON Pointer for `application/json` or XPath for XML-based media types.
525+
$ref: '#/$defs/selector-type'
496526
value:
497-
description: The value set within the target location
498-
type: string
527+
description: >
528+
The value to set at the location defined by the target. May be a literal,
529+
a runtime expression string, or a selector object.
530+
oneOf:
531+
- type: string
532+
- $ref: '#/$defs/selector-object'
499533
required:
500534
- target
501535
- value
502536
unevaluatedProperties: false
503537
$ref: '#/$defs/specification-extensions'
538+
selector-type:
539+
description: A selector expression type that may be a simple string enum or an Expression Type Object for version-specific support
540+
oneOf:
541+
- type: string
542+
enum:
543+
- jsonpointer
544+
- jsonpath
545+
- xpath
546+
- $ref: '#/$defs/expression-type-object'
547+
selector-object:
548+
$comment: https://spec.openapis.org/arazzo/v1.1#selector-object
549+
description: An object which enables fine-grained traversal and precise data selection from structured data
550+
type: object
551+
properties:
552+
context:
553+
description: A valid Runtime Expression which MUST evaluate to structured data (e.g., `$response.body`), and sets the context for the selector to be applied on
554+
type: string
555+
selector:
556+
description: A selector expression (e.g., `$.items[0].id`, `/Envelope/Item`) in the form of JSONPath expression, XPath expression, or JSON Pointer expression
557+
type: string
558+
type:
559+
description: The selector expression type to use (e.g., `jsonpath`, `xpath`, or `jsonpointer`) or an Expression Type Object for older version support
560+
$ref: '#/$defs/selector-type'
561+
required:
562+
- context
563+
- selector
564+
- type
565+
unevaluatedProperties: false
566+
$ref: '#/$defs/specification-extensions'
504567
components-object:
505-
$comment: https://spec.openapis.org/arazzo/v1.0#components-object
568+
$comment: https://spec.openapis.org/arazzo/v1.1#components-object
506569
description: Holds a set of reusable objects for different aspects of the Arazzo Specification
507570
type: object
508571
properties:
@@ -534,10 +597,10 @@ $defs:
534597
unevaluatedProperties: false
535598
$ref: '#/$defs/specification-extensions'
536599
specification-extensions:
537-
$comment: https://spec.openapis.org/arazzo/v1.0#specification-extensions
600+
$comment: https://spec.openapis.org/arazzo/v1.1#specification-extensions
538601
description: While the Arazzo Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points
539602
patternProperties:
540603
'^x-': true
541604
schema:
542-
$comment: https://spec.openapis.org/arazzo/v1.0#schema-object
605+
$comment: https://spec.openapis.org/arazzo/v1.1#schema-object
543606
$ref: 'https://json-schema.org/draft/2020-12/schema'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Bad Expression Type Version
4+
version: 1.1.0
5+
sourceDescriptions:
6+
- name: example
7+
url: 'https://example.com/openapi.yaml'
8+
type: openapi
9+
workflows:
10+
- workflowId: wf2
11+
steps:
12+
- stepId: step2
13+
operationId: getThings
14+
outputs:
15+
brokenSelector:
16+
expression: $response.body
17+
selector: '$.items[0]'
18+
type:
19+
type: xpath
20+
version: rfc9535
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Invalid Selector Object (Missing Type)
4+
version: 1.1.0
5+
sourceDescriptions:
6+
- name: example
7+
url: 'https://example.com/openapi.yaml'
8+
type: openapi
9+
workflows:
10+
- workflowId: wf1
11+
steps:
12+
- stepId: step1
13+
operationId: getStuff
14+
outputs:
15+
brokenOutput:
16+
expression: $response.body
17+
selector: $.data.id

0 commit comments

Comments
 (0)