Skip to content
Last updated

spec-action-stepId-defined

The stepId of a success or failure action must reference a step defined in the current workflow.

ArazzoCompatibility
1.x✅

Design principles

An action with the goto type can transfer the workflow to another step with the stepId field. A failure action with the retry type can do the same. The Arazzo specification requires that step to be within the current workflow. A tool cannot run an action that points to a missing step, or to a step of another workflow.

The spec-action-stepId-defined rule checks the actions listed in the onSuccess and onFailure fields of a step, and in the successActions and failureActions fields of a workflow. This rule checks an action from components in every workflow that references it. The same action can be valid in one workflow and not valid in another. The rule does not check the stepId of an action with the end type, because the field is not relevant there.

To transfer to a step of another workflow, reference that workflow with the workflowId field instead.

Configuration

OptionTypeDescription
severitystringPossible values: off, warn, error. Default error (in recommended configuration).

An example configuration:

rules:
  spec-action-stepId-defined: error

Examples

Given the following configuration:

rules:
  spec-action-stepId-defined: error

Example of an incorrect action that references a step the workflow does not define:

workflows:
  - workflowId: place-order
    steps:
      - stepId: list-menu-items
        operationId: cafe-api.listMenuItems
        onSuccess:
          - name: continue-to-order
            type: goto
            stepId: submit-order
      - stepId: create-order
        operationId: cafe-api.createOrder

Example of a correct action that references a step of the same workflow:

workflows:
  - workflowId: place-order
    steps:
      - stepId: list-menu-items
        operationId: cafe-api.listMenuItems
        onSuccess:
          - name: continue-to-order
            type: goto
            stepId: create-order
      - stepId: create-order
        operationId: cafe-api.createOrder

Resources