Skip to content

Commit 930b8c7

Browse files
committed
Added support for AsyncAPI v3
Also cleaned up the spec to make it very clear that step-object can be oneOf openapi-step-object or asyncapi-step-object or workflow-step-object For AsyncAPI we really need support for timeout, fork and join. However, these are also useful for OpenAPI so added it at the base step object. For OpenAPI we need at least one successCriteria but for AsyncAPI it can be optional.
1 parent 91e6d8c commit 930b8c7

File tree

1 file changed

+127
-18
lines changed

1 file changed

+127
-18
lines changed

src/schemas/validation/schema.yaml

Lines changed: 127 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ $defs:
7777
enum:
7878
- arazzo
7979
- openapi
80+
- asyncapi
8081
required:
8182
- name
8283
- url
@@ -152,9 +153,20 @@ $defs:
152153
$comment: https://spec.openapis.org/arazzo/v1.0#step-object'
153154
description: |-
154155
Describes a single workflow step which MAY be a call to an
155-
API operation (OpenAPI Operation Object or another Workflow Object)
156+
API operation (OpenAPI Operation Object or AsyncAPI Operation Object or another Workflow Object)
157+
oneOf:
158+
- $ref: '#/$defs/openapi-step-object'
159+
- $ref: '#/$defs/asyncapi-step-object'
160+
- $ref: '#/$defs/workflow-step-object'
161+
step-object-base:
156162
type: object
157163
properties:
164+
stepType:
165+
description: Indicates the kind of workflow step, either OpenAPI or AsyncAPI, defaults to OpenAPI if not specified
166+
enum:
167+
- openapi
168+
- asyncapi
169+
default: openapi
158170
stepId:
159171
description: Unique string to represent the step
160172
$anchor: stepId
@@ -165,12 +177,23 @@ $defs:
165177
operationId:
166178
description: The name of an existing, resolvable operation, as defined with a unique operationId and existing within one of the sourceDescriptions
167179
type: string
168-
operationPath:
169-
description: A reference to a Source combined with a JSON Pointer to reference an operation
170-
type: string
171-
workflowId:
172-
description: The workflowId referencing an existing workflow within the Arazzo description
173-
$ref: '#workflowId'
180+
timeout:
181+
description: The duration in milliseconds to wait before timing out the step
182+
type: integer
183+
fork:
184+
description: Specifies whether the step should be forked into parallel execution, allowing for non-blocking execution
185+
type: boolean
186+
join:
187+
description: Manages the synchronization of forked steps before the execution proceeds
188+
oneOf:
189+
- type: boolean
190+
description: If set to `true`, the current step will wait until **all** forked steps have completed
191+
- type: array
192+
description: A specified list of step IDs that need to finish before this step can proceed
193+
uniqueItems: true
194+
minItems: 1
195+
items:
196+
$ref: '#stepId'
174197
parameters:
175198
description: A list of parameters that MUST be passed to an operation or workflow as referenced by operationId, operationPath, or workflowId
176199
type: array
@@ -209,14 +232,24 @@ $defs:
209232
type: string
210233
required:
211234
- stepId
212-
oneOf:
213-
- required:
214-
- operationId
215-
- required:
216-
- operationPath
217-
- required:
218-
- workflowId
235+
openapi-step-object:
219236
allOf:
237+
- $ref: '#/$defs/step-object-base'
238+
- type: object
239+
properties:
240+
stepType:
241+
description: Identifier for OpenAPI step
242+
const: openapi
243+
operationPath:
244+
description: A reference to a Source combined with a JSON Pointer to reference an operation
245+
type: string
246+
successCriteria:
247+
description: A list of assertions to determine the success of the step
248+
type: array
249+
uniqueItems: true
250+
minItems: 1
251+
items:
252+
$ref: '#/$defs/criterion-object'
220253
- if:
221254
oneOf:
222255
- required:
@@ -228,25 +261,100 @@ $defs:
228261
parameters:
229262
items:
230263
oneOf:
231-
- $ref: '#/$defs/reusable-object'
232264
- $ref: '#/$defs/parameter-object'
233265
required:
234266
- in
267+
- $ref: '#/$defs/reusable-object'
268+
- oneOf:
269+
- required:
270+
- operationId
271+
- required:
272+
- operationPath
273+
$ref: '#/$defs/specification-extensions'
274+
unevaluatedProperties: false
275+
asyncapi-step-object:
276+
allOf:
277+
- $ref: '#/$defs/step-object-base'
278+
- type: object
279+
properties:
280+
stepType:
281+
description: Identifier for AsyncAPI step
282+
const: asyncapi
283+
channelPath:
284+
description: A reference to a Source combined with a JSON Pointer to reference an async channel
285+
type: string
286+
correlationId:
287+
description: ID to correlate async responses with their requests, only specified for async receive steps
288+
type:
289+
- string
290+
- number
291+
- boolean
292+
- object
293+
- array
294+
action:
295+
description: Specifies the intended operation on the async channel, indicating whether the action is sending data to the channel or receiving data from the channel
296+
enum:
297+
- "send"
298+
- "receive"
299+
successCriteria:
300+
description: A list of assertions to determine the success of the step
301+
type: array
302+
uniqueItems: true
303+
minItems: 0
304+
items:
305+
$ref: '#/$defs/criterion-object'
306+
required:
307+
- stepType
235308
- if:
236-
required:
237-
- workflowId
309+
oneOf:
310+
- required:
311+
- operationId
312+
- required:
313+
- channelPath
238314
then:
239315
properties:
240316
parameters:
241317
items:
242318
oneOf:
243319
- $ref: '#/$defs/parameter-object'
320+
required:
321+
- in
244322
- $ref: '#/$defs/reusable-object'
323+
- if:
324+
required:
325+
- correlationId
326+
then:
327+
properties:
328+
action:
329+
const: receive
330+
required:
331+
- action
332+
- oneOf:
333+
- required:
334+
- operationId
335+
- required:
336+
- channelPath
337+
- action
245338
$ref: '#/$defs/specification-extensions'
246339
unevaluatedProperties: false
340+
workflow-step-object:
341+
allOf:
342+
- $ref: '#/$defs/step-object-base'
343+
- type: object
344+
properties:
345+
workflowId:
346+
description: The workflowId referencing an existing workflow within the Arazzo description
347+
$ref: '#workflowId'
348+
parameters:
349+
items:
350+
oneOf:
351+
- $ref: '#/$defs/parameter-object'
352+
- $ref: '#/$defs/reusable-object'
353+
required:
354+
- workflowId
247355
request-body-object:
248356
$comment: https://spec.openapis.org/arazzo/v1.0#request-body-object
249-
description: The request body to pass to an operation as referenced by operationId or operationPath
357+
description: The request body to pass to an operation as referenced by operationId or operationPath or channelPath
250358
type: object
251359
properties:
252360
contentType:
@@ -471,6 +579,7 @@ $defs:
471579
- query
472580
- header
473581
- cookie
582+
- channel
474583
value:
475584
description: The value to pass in the parameter
476585
type:

0 commit comments

Comments
 (0)