Arazzo: OpenAPI Workflows
The Arazzo Specification is a new addition to the OpenAPI Specification that allows you to define sequences of operations for your API.
An Arazzo description is a separate document that references your OpenAPI document and describes how to combine operations from your OpenAPI document into step-by-step sequences.
Arazzo descriptions are useful for:
- Defining complex sequences of operations that involve multiple API calls.
- Documenting the expected behavior of your API in a more structured way than a narrative description.
- Generating code to execute the sequences of operations.
- Generating tests to verify that the sequences of operations behave as expected.
- Generating documentation that explains how to use the sequences of operations.
Arazzo Description Structure
An Arazzo description is a JSON or YAML document that follows the structure defined by the Arazzo Specification.
Field Name | Type | Required |
---|---|---|
arazzo | string | ✅ |
The version of the Arazzo Specification that the document uses. The value must be a supported version number.
Field Name | Type | Required |
---|---|---|
sourceDescriptions | [Source Description Object] | ✅ |
An array of source description objects defining the OpenAPI or other documents containing the operations referenced by the workflows. The array must contain at least one source.
Field Name | Type | Required |
---|---|---|
workflows | [Workflow Object] | ✅ |
An array of workflow objects defining the workflows. The array must contain at least one workflow.
workflowsSpec: 1.0.0-prereleaseinfo:title: Speakeasy Bar Workflowssummary: Workflows for managing the Speakeasy Bar APIdescription: >This document defines workflows for managing the [Speakeasy Bar API](https://bar.example.com), includingcreating new drinks, managing inventory, and processing orders.version: 4.6.3sourceDescriptions:- name: speakeasyBarurl: https://bar.example.com/openapi.yamltype: openapi- name: printsAndBeepsurl: https://output.example.com/workflows.yamltype: workflowsSpecworkflows:- workflowId: createDrinksummary: Create a new drink in the bar's menuinputs:allOf:- $ref: "#/components/inputs/authenticate"- type: objectproperties:drink_name:type: stringdrink_type:type: stringdrink_price_usd_cent:type: integeringredients:type: arrayitems:type: stringsteps:- stepId: authenticateoperationId: authenticateparameters:- reference: $components.parameters.username- reference: $components.parameters.password- stepId: createDrinkoperationId: createDrinkparameters:- reference: $components.parameters.authorization- name: namein: queryvalue: $inputs.drink_name- name: typein: queryvalue: $inputs.drink_type- name: pricein: queryvalue: $inputs.drink_price_usd_cent- name: ingredientsin: queryvalue: $inputs.ingredients- workflowId: makeDrinksummary: Order a drink and check the order statusinputs:- name: orderTypedescription: The type of ordertype: stringrequired: true- name: productCodedescription: The product code of the drinktype: stringrequired: true- name: quantitydescription: The quantity of the drinktype: integerrequired: truesteps:- stepId: orderDrinkoperationId: createOrderparameters:- name: orderTypein: bodyvalue: $inputs.orderType- name: productCodein: bodyvalue: $inputs.productCode- name: quantityin: bodyvalue: $inputs.quantity- stepId: checkStatusoperationId: getOrderparameters:- name: orderNumberin: pathvalue: $orderDrink.orderNumbersuccessCriteria:- type: simplecondition: $checkStatus.status == 'completed'onSuccess:- name: printReceipttype: gotoworkflowId: $sourceDescriptions.printsAndBeeps.printReceiptcriteria:- type: simplecondition: $checkStatus.status == 'completed'onFailure:- name: beepLoudlytype: gotoworkflowId: $sourceDescriptions.printsAndBeeps.beepLoudlycriteria:- type: simplecondition: $checkStatus.status == 'failed'- workflowId: addIngredientsummary: Add a new ingredient to the bar's inventoryinputs:- name: usernamedescription: The username of the managertype: stringrequired: true- name: passworddescription: The password of the managertype: stringrequired: true- name: ingredient_namedescription: The name of the ingredienttype: stringrequired: true- name: ingredient_typedescription: The type of the ingredienttype: stringrequired: true- name: ingredient_stockdescription: The stock of the ingredienttype: integerrequired: true- name: productCodedescription: The product code of the ingredienttype: stringrequired: truesteps:- stepId: authenticateoperationId: authenticateparameters:- reference: $components.parameters.usernamevalue: admin- reference: $components.parameters.password- stepId: addIngredientoperationId: createIngredientparameters:- reference: $components.parameters.authorization- name: namein: queryvalue: $inputs.ingredient_name- name: typein: queryvalue: $inputs.ingredient_type- name: stockin: queryvalue: $inputs.ingredient_stock- name: productCodein: queryvalue: $inputs.productCodecomponents:inputs:authenticate:type: objectproperties:username:type: stringpassword:type: stringparameters:authorization:name: Authorizationin: headervalue: $authenticate.outputs.tokenusername:name: usernamein: bodyvalue: $inputs.usernamepassword:name: passwordin: bodyvalue: $inputs.password
This table shows all fields at the root of the Arazzo Specification:
Field Name | Type | Required | Description |
---|---|---|---|
arazzo | string | ✅ | The version of the Arazzo Specification that the document uses. The value must be a supported version number. |
info | Info Object | ✅ | Provides metadata about the Arazzo description. |
sourceDescriptions | [Source Description Object] | ✅ | An array of source description objects defining the OpenAPI or other documents containing the operations referenced by the workflows. The array must contain at least one source. |
workflows | [Workflow Object] | ✅ | An array of workflow objects defining the workflows. The array must contain at least one workflow. |
components | Components Object | An element to hold reusable schemas for the workflow, for example, inputs and parameters. | |
x-* | Extensions | Any number of extension fields can be added to the Arazzo description that can be used by tooling and vendors. When provided at this level, the extensions generally apply to the entire document. |
Arazzo Specification Versions
The arazzo
field contains the version number of the Arazzo Specification that the document conforms to. Tooling should use this value to interpret the document correctly.
The current version of the Arazzo Specification is 1.0.0-prerelease, but keep in mind that the specification is still under development.
Info Object
Provides metadata about the Arazzo description.
Field Name | Type | Required | Description |
---|---|---|---|
title | string | ✅ | A human-readable title for the set of workflows. |
summary | string | A short summary of the Arazzo description. | |
description | string | A longer description of the Arazzo description. CommonMark syntax (opens in a new tab) may be used for rich text representation. | |
version | string | ✅ | A version string indicating the version of the Arazzo document. |
x-* | Extensions | Any number of extension fields can be added that can be used by tooling and vendors. |
Below is an example of an info
object in an Arazzo document:
# from ./assets/arazzo.yaml.txt 2:8
Source Description Object
A source description points to an OpenAPI document containing the operations referenced by the workflows in this document. It may also reference other Arazzo documents.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | ✅ | A name for the source document, used to reference it from other parts of the Arazzo description. The name must be unique within the sourceDescriptions array and may only contain alphanumeric characters, underscores, and dashes. |
url | string | ✅ | The URL of the source document. This identifier must conform to RFC 3986 section 4.1 (opens in a new tab) for absolute URLs or section 4.2 (opens in a new tab) for relative URIs. |
type | string | The type of the source document. Supported values are openapi , indicating an OpenAPI document, or arazzo indicating another Arazzo description. Additional values may be supported in future versions of the specification. | |
x-* | Extensions | Any number of extension fields can be added to the source description object that can be used by tooling and vendors. |
Below is an example of two source description objects in an Arazzo description document:
# from ./assets/arazzo.yaml.txt 9:15
Workflow Object
A workflow object defines a sequence of operations.
Field Name | Type | Required | Description |
---|---|---|---|
workflowId | string | ✅ | A unique identifier for the workflow. This is used to reference the workflow from other parts of the Arazzo description. May contain only alphanumeric characters, underscores, and dashes. |
summary | string | A short summary of what the workflow does. | |
description | string | A longer description of the workflow. CommonMark syntax (opens in a new tab) may be used for rich text representation. | |
inputs | JSON Schema (opens in a new tab) | A schema defining the input parameters for the workflow. | |
dependsOn | [string ] | An array of workflow IDs that this workflow depends on. The workflows in the array must be executed before this workflow. | |
steps | [Step Object] | ✅ | An ordered array of step objects defining the steps of the workflow. The array must contain at least one step. |
successActions | [Success Action Object | Reusable Object] | An array of success action objects and reusable objects specifying actions to take for each step of this workflow that completes successfully. Individual steps may override the workflow object’s success actions. Reusable objects must reference success actions defined in the components/successActions of this Arazzo document. | |
failureActions | [Failure Action Object | Reusable Object] | An array of failure action objects and reusable objects specifying actions to take for each step of this workflow that fails. Individual steps may override the workflow object’s failure actions. Reusable objects must reference success actions defined in the components/failureActions of this Arazzo document. | |
outputs | Map[string , {Runtime Expression}] | A map of output values produced by the workflow. The keys are the names of the outputs, and the values are runtime expressions that extract the output values from the results of the workflow steps. | |
parameters | [Parameter Object | Reusable Object] | An array of parameters applicable to all steps in this workflow. Individual steps may override the workflow object’s parameters. A reusable object must reference an object in this document’s components/parameters of this Arazzo document. | |
x-* | Extensions | Any number of extension fields can be added to the workflow object that can be used by tooling and vendors. |
Below is an example of a workflow object:
# from ./assets/arazzo.yaml.txt 17:55
Step Object
A step object defines a single operation to perform as part of a workflow.
Field Name | Type | Required | Description |
---|---|---|---|
stepId | string | ✅ | A unique identifier for the step within the workflow. Used to reference the step’s outputs from other parts of the workflow. May contain only alphanumeric characters, underscores, and dashes. |
description | string | A description of what the step does. CommonMark syntax (opens in a new tab) may be used for rich text representation. | |
operationId | string | The operationId of the operation to execute for this step. Must match an operationId in one of the sourceDescriptions . This field is mutually exclusive with operationPath and workflowId . | |
operationPath | string | A JSON Pointer to the operation to execute for this step, relative to one of the sourceDescriptions . This field is mutually exclusive with operationId and workflowId . | |
workflowId | string | The ID of a workflow in this document to execute as a sub-workflow. This field is mutually exclusive with operationId and operationPath . | |
parameters | [Parameter Object | Reusable Object] | An array of parameters to pass to the operation for this step. Overrides any parameters defined at the workflow level. | |
requestBody | Request Body Object | The request body to send for the operation. | |
successCriteria | [Criterion Object] | An array of criteria for determining if the step succeeded. All criteria must be met for the step to be considered successful. Individual criteria are defined using criterion objects. | |
onSuccess | [Success Action Object | Reusable Object] | An array of actions to take if the step succeeds. Overrides any success actions defined at the workflow level. Individual actions are defined using success action objects. | |
onFailure | [Failure Action Object | Reusable Object] | An array of actions to take if the step fails. Overrides any failure actions defined at the workflow level. Individual actions are defined using failure action objects. | |
outputs | Map[string , {Runtime Expression}] | A map of output values produced by the step. The keys are the names of the outputs, and the values are runtime expressions that extract the output values from the result of the operation. | |
x-* | Extensions | Any number of extension fields can be added to the step object that can be used by tooling and vendors. |
Below is an example of step objects in an Arazzo description document:
# from ./assets/arazzo.yaml.txt 34:55
Parameter Object
A parameter object defines a single parameter to pass to an operation in a workflow step.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | ✅ | The name of the parameter. |
in | string | ✅ | The location of the parameter. Possible values are path , query , header , cookie . Required for parameters passed to an operation. Must be omitted for parameters passed to a workflow, where the parameter is always passed in the workflow’s inputs object. See Parameter Location. |
value | Any | {Runtime Expression} | The value of the parameter. Can be a literal value, or a runtime expression that will be evaluated and passed to the operation or workflow. | |
x-* | Extensions | Any number of extension fields can be added to the parameter object that can be used by tooling and vendors. |
Parameter Location
For parameters passed to an operation, the in
field specifies the location of the parameter. The possible values are:
path
- The parameter is part of the operation’s URL path.query
- The parameter is appended to the operation’s URL as a query parameter.header
- The parameter is sent in the request headers.cookie
- The parameter is sent in a cookie.
For parameters passed to a workflow, the in
field must be omitted. Workflow parameters are always passed in the workflow’s inputs
object.
Arazzo Parameter Object Examples
# from ./assets/arazzo.yaml.txt 42:55
Success Action Object
A success action object defines an action to take when a workflow step succeeds.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | ✅ | The name of the action. Names are case-sensitive and must be unique within the successActions array of a step or workflow. |
type | string | ✅ | The type of action to take. Possible values are:end - End the workflow.goto - Move to another step in the workflow. Requires either stepId or workflowId to be specified. |
stepId | string | The stepId of the step to execute next if type is goto . Mutually exclusive with workflowId . | |
workflowId | string | The workflowId of the workflow to execute if type is goto . Mutually exclusive with stepId . | |
criteria | [Criterion Object] | An array of criteria that determine whether the action should be executed. All criteria must be met for the action to execute. If not provided, the action will always execute. | |
x-* | Extensions | Any number of extension fields can be added to the success action object that can be used by tooling and vendors. |
Below is an example of a success action object:
# from ./assets/arazzo.yaml.txt 93:99
Failure Action Object
A failure action object defines an action to take when a workflow step fails.
Field Name | Type | Required | Description |
---|---|---|---|
name | string | ✅ | The name of the action. Names are case-sensitive and must be unique within the failureActions array of a step or workflow. |
type | string | ✅ | The type of action to take. Possible values are:end - End the workflow, returning the specified outputs if provided.goto - Move to another step in the workflow. Requires either stepId or workflowId to be specified.retry - Retry the failed step. Requires retryAfter and optionally retryLimit to be specified. |
stepId | string | The stepId of the step to execute next if type is goto . Mutually exclusive with workflowId . | |
workflowId | string | The workflowId of the workflow to execute if type is goto . Mutually exclusive with stepId . | |
retryAfter | Number | The number of seconds to wait before retrying the failed step if type is retry . Must be a non-negative integer. The specification is ambiguous about whether this field also applies when type is goto . | |
retryLimit | Integer | The maximum number of times to retry the failed step if type is retry . Must be a non-negative integer. If not provided, the step will be retried indefinitely until it succeeds or the workflow is canceled. | |
criteria | [Criterion Object] | An array of criteria that determine whether the action should be executed. All criteria must be met for the action to execute. | |
x-* | Extensions | Any number of extension fields can be added to the failure action object that can be used by tooling and vendors. |
Below is an example of a failure action object:
# from ./assets/arazzo.yaml.txt 100:106
Components Object
The components
object holds reusable objects that can be referenced from other parts of the Arazzo description.
Field Name | Type | Description |
---|---|---|
inputs | Map[string , JSON Schema ] | An object containing reusable JSON Schemas (opens in a new tab) that can be referenced from workflow inputs . |
parameters | Map[string , Parameter Object] | An object containing reusable parameter objects. |
successActions | Map[string , Success Action Object] | An object containing reusable success action objects. |
failureActions | Map[string , Failure Action Object] | An object containing reusable failure action objects. |
x-* | Extensions | Any number of extension fields can be added to the components object that can be used by tooling and vendors. |
The keys in the components
object may only contain alphanumeric characters, underscores, and dashes.
Arazzo Components Object Example
# from ./assets/arazzo.yaml.txt 157:178
The components defined in an Arazzo description are scoped to that document. Components defined in one Arazzo description cannot be referenced from another Arazzo description.
Reusable Object
A reusable object allows you to reference objects like success actions and failure actions defined in the components
object from locations within steps or workflows.
Field Name | Type | Required | Description |
---|---|---|---|
reference | {Runtime Expression} | ✅ | A runtime expression used to reference the desired object from the components object. |
value | string | The value of the referenced parameter. Only used for parameters. |
Arazzo Reusable Object Example
# from ./assets/arazzo.yaml.txt 138:140
Criterion Object
A criterion object is used to specify assertions in the successCriteria
field of a step object, or the criteria
field of a success action object or failure action object.
Criterion objects support three types of assertions:
simple
- Basic comparisons using literals, operators, and runtime expressions. This is the default if notype
is specified.regex
- Applies a regular expression pattern to a context defined by a runtime expression.JSONPath
- Applies a JSONPath (opens in a new tab) expression to a context defined by a runtime expression. The root node of the JSONPath is the context.
Literals
Literals are constant values that can be used in simple
conditions. The following data types are supported:
Type | Literal Value |
---|---|
boolean | true or false |
null | null |
number | A number of type int32 , int64 , float , or double . |
string | Strings must be enclosed in single quotes (’). To include a literal single quote, escape it with another single quote (”). |
Operators
Simple conditions support the following operators:
Operator | Description |
---|---|
< | Less than |
<= | Less than or equal |
> | Greater than |
>= | Greater than or equal |
== | Equal |
!= | Not equal |
! | Not |
&& | And |
|| | Or |
() | Grouping |
[] | Array index (0-based) |
. | Property dereference |
String comparisons are case-insensitive.
A criterion object consists of the following fields:
Field Name | Type | Required | Description |
---|---|---|---|
context | {Runtime Expression} | A runtime expression that defines the context for regex and JSONPath conditions. Must be provided if type is specified. | |
condition | string | ✅ | The assertion to evaluate. For simple conditions, combines literals, operators, and runtime expressions. For regex and JSONPath conditions, provides the expression to evaluate against the context . |
type | string | The type of assertion. Allowed values are simple , regex , or JSONPath . Defaults to simple if not provided. | |
x-* | Extensions | Any number of extension fields can be added to the criterion object that can be used by tooling and vendors. |
Arazzo Criterion Object Examples
Simple Condition - Check if a drink was successfully created
- condition: $statusCode == 201
Simple Condition - Check if the bar is open
- condition: $response.body.isOpen == true
Regex Condition - Check if the drink name matches a pattern
- context: $response.body.drinkNamecondition: "^Sazerac"type: regex
JSONPath Condition - Check if the ingredient list contains “whiskey”
- context: $response.bodycondition: $..ingredients[?(@.name == 'whiskey')]type: JSONPath
Simple Condition - Check if the customer is over 21
- condition: $response.body.customer.age >= 21
JSONPath Condition - Check if there are any available tables
- context: $response.bodycondition: $[?length(@.tables[?(@.available == true)]) > 0]type: JSONPath
Request Body Object
The request body object describes the payload and Content-Type
to send with the request when executing an operation in a workflow step.
Field Name | Type | Required | Description |
---|---|---|---|
contentType | string | The Content-Type header for the request payload. If omitted, defaults to the Content-Type of the referenced operation. | |
payload | Any | The literal payload value to send in the request body. Can contain runtime expressions which will be evaluated before sending the request. | |
replacements | [Payload Replacement Object] | An array of payload replacement objects specifying values to insert into specific locations in the payload. | |
x-* | Extensions | Any number of extension fields can be added to the request body object that can be used by tooling and vendors. |
Request Body Object Examples
JSON Payload (Template)
contentType: application/jsonpayload: |{"order": {"drinkId": "{$inputs.drink_id}","customerId": "{$inputs.customer_id}","quantity": {$inputs.quantity}}}
JSON Payload (Object)
contentType: application/jsonpayload:order:drinkId: $inputs.drink_idcustomerId: $inputs.customer_idquantity: $inputs.quantity
JSON Payload (Runtime Expression)
contentType: application/jsonpayload: $inputs.orderPayload
XML Payload (Template)
contentType: application/xmlpayload: |<order><drinkId>{$inputs.drink_id}</drinkId><customerId>{$inputs.customer_id}</customerId><quantity>{$inputs.quantity}</quantity></order>
Form Data Payload (Object)
contentType: application/x-www-form-urlencodedpayload:drinkId: $inputs.drink_idcustomerId: $inputs.customer_idquantity: $inputs.quantity
Form Data Payload (String)
contentType: application/x-www-form-urlencodedpayload: "drinkId={$inputs.drink_id}&customerId={$inputs.customer_id}&quantity={$inputs.quantity}"
Payload Replacement Object
A payload replacement object specifies a location within the request payload and the value to insert at that location.
Field Name | Type | Required | Description |
---|---|---|---|
target | string | ✅ | A JSON Pointer (opens in a new tab) or XPath (opens in a new tab) expression that identifies the location in the payload to insert the value . For JSON payloads, use JSON Pointer. For XML payloads, use XPath. |
value | Any | ✅ | The value to insert at the specified target location. Can be a literal or a runtime expression that will be evaluated before sending the request. |
x-* | Extensions | Any number of extension fields can be added to the payload replacement object that can be used by tooling and vendors. |
Payload Replacement Object Examples
Runtime Expression Value
target: /drinkIdvalue: $inputs.drink_id
Literal Value
target: /quantityvalue: 2
Runtime Expressions
Runtime expressions allow you to reference values that will be available when a workflow is executed, such as values from the HTTP request or response, the event that triggered the workflow, or outputs from previous workflow steps.
The syntax for runtime expressions is {expression}
, where expression
is one of the following:
Expression | Description |
---|---|
$url | The full URL of the request |
$method | The HTTP method of the request |
$statusCode | The HTTP status code of the response |
$request.header.{name} | The value of the specified request header |
$request.query.{name} | The value of the specified query parameter from the request URL |
$request.path.{name} | The value of the specified path parameter from the request URL |
$request.body | The entire request body |
$request.body#/path/to/property | The value of the specified JSON pointer path from the request body |
$response.header.{name} | The value of the specified response header |
$response.body | The entire response body |
$response.body#/path/to/property | The value of the specified JSON pointer path from the response body |
$inputs.{name} | The value of the specified workflow input |
$outputs.{name} | The value of the specified workflow output |
$steps.{stepId}.{outputName} | The value of the specified output from the step with ID {stepId} |
$workflows.{id}.{inputName} | The value of the specified input from the workflow with ID {id} |
$workflows.{id}.{outputName} | The value of the specified output from the workflow with ID {id} |
Runtime Expression Examples
Expression | Example Value |
---|---|
$request.header.Authorization | Bearer abc123 |
$request.query.drinkId | 12345 |
$response.body#/drinks/0/name | "Negroni" |
$inputs.orderType | "pickup" |
$steps.submitOrder.outputs.orderId | "a8b9c6d4e5f001" |
Arazzo Specification Extensions
The Arazzo Specification allows custom properties to be added at certain points using specification extensions.
Extension properties are always prefixed by "x-"
and can have any valid JSON value.
For example:
x-internal-id: abc123x-vendor-parameter:vendorId: 123channelId: abc
The extensions defined by the Arazzo Specification are:
Context | Description |
---|---|
Arazzo Description | Applies to the entire Arazzo description document |
Info Object | Applies to the info object |
Source Description Object | Applies to all the source description objects |
Workflow Object | Applies to all workflow objects |
Step Object | Applies to all step objects |
Parameter Object | Applies to all parameter objects |
Success Action Object | Applies to all success action objects |
Failure Action Object | Applies to all failure action objects |
Criterion Object | Applies to all criterion objects |
Request Body Object | Applies to all request body objects |
Payload Replacement Object | Applies to all payload replacement objects |
Reusable Object | Applies to all reusable objects |
Components Object | Applies to the components object |
The specification extension key formats ^x-oai-
and ^x-oas-
are reserved for extensions defined by the OpenAPI Initiative (opens in a new tab).
Extension properties can be used to add additional features, metadata, or configuration options to the Arazzo description that are not directly supported by the current version of the specification. However, additional tooling may be required to process custom extensions.