Skip to content

Commit 75d1cb0

Browse files
committed
fix: enhance dependsOn description in schema.yaml and arazzo.md, and add new AsyncAPI examples for test
1 parent 37d911f commit 75d1cb0

10 files changed

+260
-4
lines changed

src/arazzo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Describes a single workflow step which MAY be a call to an API operation ([OpenA
344344
| <a name="stepTimeout"></a>timeout | `integer` | The maximum number of milli-seconds to wait for the step to complete before aborting and failing the step. Consequently this will fail the workflow unless failureActions are defined. |
345345
| <a name="stepCorrelationId"></a>correlationId | `string` | A correlationId in AsyncAPI links a request with its response (or more broadly, to trace a single logical transaction across multiple asynchronous messages). Only applicable to `asyncapi` steps with action `receive` and has to be in-sync with correlationId defined in the AsyncAPI document. |
346346
| <a name="stepAction"></a>action | `send or receive` | Describes the intent of the message flow. Indicates whether the step will send (publish) or receive (subscribe) to a message on a channel described in an AsyncAPI document, Only applicable for `asyncapi` steps. |
347-
| <a name="stepDependsOn"></a>dependsOn | List[`string`] | A list of steps that MUST be completed before this step can be executed. Each value provided MUST be a `stepdId`. If you depend on a step from another workflow, you MUST use the full reference format with the workflow id. The keys MUST follow the regular expression: `^\$(?:workflows\.[^.]+\.)?steps\.[^.]+$`. |
347+
| <a name="stepDependsOn"></a>dependsOn | List[`string`] | A list of steps that MUST be completed before this step can be executed. Each value provided MUST be a `stepdId`. If you depend on a step from another workflow, you MUST use the full reference format with the workflow id. The keys MUST follow the regular expression: `^\$(?:workflows\.[^.]+\.)?steps\.[^.]+$`. If your step depends on the output of a non-blocking/async step, then you SHOULD use dependsOn in your current step and reffer to the async step |
348348

349349
This object MAY be extended with [Specification Extensions](#specification-extensions).
350350

src/schemas/validation/schema.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ $defs:
179179
description: The duration in milliseconds to wait before timing out the step
180180
type: integer
181181
dependsOn:
182-
description: Specifies a list of step identifiers that must complete (or be waited for) before the current step can begin execution. If you depend on a step from another workflow, you MUST use the full reference format with the workflow id.
182+
description: Specifies a list of step identifiers that must complete (or be waited for) before the current step can begin execution. Steps referred by dependsOn SHOULD be non-blocking/async steps. If you depend on a step from another workflow, you MUST use the full reference format with the workflow id.
183183
type: array
184184
uniqueItems: true
185185
minItems: 1
186186
items:
187187
type: string
188-
pattern: ^\\$(?:workflows\\.[^.]+\\.)?steps\\.[^.]+$
188+
pattern: ^\$(?:workflows\.[^.]+\.)?steps\.[^.]+$
189189
parameters:
190190
description: A list of parameters that MUST be passed to an operation or workflow as referenced by operationId, operationPath, or workflowId
191191
type: array
@@ -254,10 +254,10 @@ $defs:
254254
parameters:
255255
items:
256256
oneOf:
257+
- $ref: '#/$defs/reusable-object'
257258
- $ref: '#/$defs/parameter-object'
258259
required:
259260
- in
260-
- $ref: '#/$defs/reusable-object'
261261
- oneOf:
262262
- required:
263263
- operationId
@@ -341,6 +341,8 @@ $defs:
341341
- $ref: '#/$defs/reusable-object'
342342
required:
343343
- workflowId
344+
$ref: '#/$defs/specification-extensions'
345+
unevaluatedProperties: false
344346
request-body-object:
345347
$comment: https://spec.openapis.org/arazzo/v1.1#request-body-object
346348
description: The request body to pass to an operation as referenced by operationId or operationPath or channelPath
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/openapi.yaml
8+
type: openapi
9+
workflows:
10+
- workflowId: basicWorkflow
11+
steps:
12+
- stepId: step1
13+
channelPath: createUser
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/asyncapi.yaml
8+
type: asyncapi
9+
workflows:
10+
- workflowId: basicWorkflow
11+
steps:
12+
- stepId: step1
13+
operationId: createUser
14+
action: send
15+
correlationId: invalid
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/asyncapi.yaml
8+
type: asyncapi
9+
workflows:
10+
- workflowId: basicWorkflow
11+
steps:
12+
- stepId: step1
13+
operationId: createUser
14+
action: invalid
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI with Correlation ID for Receive Action
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/asyncapi.yaml
8+
type: asyncapi
9+
workflows:
10+
- workflowId: basicWorkflow
11+
steps:
12+
- stepId: step1
13+
operationId: createUser
14+
action: receive
15+
correlationId: id123
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI with Depends On
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/asyncapi.yaml
8+
type: asyncapi
9+
workflows:
10+
- workflowId: dependsOnWorkflow
11+
steps:
12+
- stepId: step1
13+
operationId: createUser
14+
action: send
15+
- stepId: step2
16+
operationId: fetchUserId
17+
action: receive
18+
correlationId: id123
19+
timeout: 6000
20+
outputs:
21+
userId: "$message.payload.userId"
22+
- stepId: step3
23+
operationId: updateUser
24+
action: send
25+
dependsOn:
26+
- "$steps.step2"
27+
parameters:
28+
- name: userId
29+
in: header
30+
value: "$steps.fetchUserId.outputs.userId"
31+
- stepId: step4
32+
operationId: deleteUser
33+
action: send
34+
dependsOn:
35+
- "$workflows.dependsOnWorkflow.steps.step2"
36+
parameters:
37+
- name: userId
38+
in: header
39+
value: "$steps.fetchUserId.outputs.userId"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/asyncapi.yaml
8+
type: asyncapi
9+
workflows:
10+
- workflowId: basicWorkflow
11+
steps:
12+
- stepId: step1
13+
channelPath: createUser
14+
action: receive
15+
correlationId: id123
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
arazzo: 1.1.0
2+
info:
3+
title: Minimal Arazzo Example for AsyncAPI
4+
version: 1.0.0
5+
sourceDescriptions:
6+
- name: exampleAPI
7+
url: https://example.com/asyncapi.yaml
8+
type: asyncapi
9+
workflows:
10+
- workflowId: basicWorkflow
11+
steps:
12+
- stepId: step1
13+
operationId: createUser
14+
action: send
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
arazzo: "1.1.0"
2+
info:
3+
title: "Arazzo Workflow"
4+
version: "1.1.0"
5+
sourceDescriptions:
6+
- name: "LocationApi"
7+
url: "./workflow/openapi/location.yaml"
8+
type: "openapi"
9+
- name: "ProductApi"
10+
url: "./workflow/openapi/product.yaml"
11+
type: "openapi"
12+
- name: "AsyncOrderApi"
13+
url: "./workflow/asyncapi/order.yaml"
14+
type: "asyncapi"
15+
- name: "WarehouseApi"
16+
url: "./workflow/openapi/warehouse.yaml"
17+
type: "openapi"
18+
- name: "OrderApi"
19+
url: "./workflow/openapi/order.yaml"
20+
type: "openapi"
21+
workflows:
22+
- workflowId: "OrderId"
23+
inputs:
24+
required:
25+
- "createOrderSend"
26+
- "getUserLocation"
27+
type: "object"
28+
properties:
29+
createOrderSend:
30+
required:
31+
- "requestId"
32+
type: "object"
33+
properties:
34+
requestId:
35+
type: "string"
36+
getUserLocation:
37+
required:
38+
- "userEmail"
39+
type: "object"
40+
properties:
41+
userEmail:
42+
type: "string"
43+
format: "email"
44+
steps:
45+
- stepId: "getUserLocation"
46+
operationId: "$sourceDescriptions.LocationApi.getUserLocation"
47+
parameters:
48+
- name: "userEmail"
49+
in: "query"
50+
value: "$inputs.getUserLocation.userEmail"
51+
successCriteria:
52+
- condition: "$statusCode == 200"
53+
outputs:
54+
userId: "$response.body#/userId"
55+
locationCode: "$response.body#/locationCode"
56+
- stepId: "getProducts"
57+
operationId: "$sourceDescriptions.ProductApi.getProducts"
58+
parameters:
59+
- name: "locationCode"
60+
in: "query"
61+
value: "$steps.getUserLocation.outputs.locationCode"
62+
successCriteria:
63+
- condition: "$statusCode == 200"
64+
onSuccess:
65+
- name: "IsArrayEmpty"
66+
type: "end"
67+
criteria:
68+
- condition: "$response.body#/0 == null"
69+
outputs:
70+
productId: "$response.body#/0/productId"
71+
inventory: "$response.body#/0/inventory"
72+
- stepId: "createOrderSend"
73+
operationId: "$sourceDescriptions.AsyncOrderApi.createOrder"
74+
action: "send"
75+
parameters:
76+
- name: "requestId"
77+
in: "header"
78+
value: "$inputs.createOrderSend.requestId"
79+
requestBody:
80+
payload:
81+
userId: "$steps.getUserLocation.outputs.userId"
82+
productId: "$steps.getProducts.outputs.productId"
83+
inventory: "$steps.getProducts.outputs.inventory"
84+
outputs:
85+
requestId: "$message.header.requestId"
86+
- stepId: "createOrderReceive"
87+
operationId: "$sourceDescriptions.AsyncOrderApi.createOrder"
88+
action: "receive"
89+
correlationId: "$steps.createOrderSend.outputs.requestId"
90+
timeout: 6000
91+
outputs:
92+
orderId: "$message.payload.orderId"
93+
- stepId: "reserveInventory"
94+
operationId: "$sourceDescriptions.WarehouseApi.reserveInventory"
95+
dependsOn:
96+
- "$steps.createOrderReceive"
97+
parameters:
98+
- name: "orderId"
99+
in: "query"
100+
value: "$steps.createOrderReceive.outputs.orderId"
101+
successCriteria:
102+
- condition: "$statusCode == 200"
103+
- stepId: "orderAccepted"
104+
operationId: "$sourceDescriptions.AsyncOrderApi.orderAccepted"
105+
action: "receive"
106+
correlationId: "$steps.createOrderSend.outputs.requestId"
107+
timeout: 6000
108+
- stepId: "outForDelivery"
109+
operationId: "$sourceDescriptions.AsyncOrderApi.outForDelivery"
110+
action: "send"
111+
dependsOn:
112+
- "$steps.createOrderReceive"
113+
parameters:
114+
- name: "requestId"
115+
in: "header"
116+
value: "$steps.createOrderSend.outputs.requestId"
117+
requestBody:
118+
payload:
119+
orderId: "$steps.createOrderReceive.outputs.orderId"
120+
- stepId: "getOrderDetails"
121+
operationId: "$sourceDescriptions.OrderApi.getOrderDetails"
122+
dependsOn:
123+
- "$steps.createOrderReceive"
124+
parameters:
125+
- name: "orderId"
126+
in: "path"
127+
value: "$steps.createOrderReceive.outputs.orderId"
128+
successCriteria:
129+
- condition: "$statusCode == 200"

0 commit comments

Comments
 (0)