Skip to content
Last updated

spec-step-dependsOn-defined

Each value in the dependsOn list of a step must reference a defined step.

ArazzoCompatibility
1.0.x❌
1.1.x✅

Design principles

Arazzo 1.1.0 adds the dependsOn field to a step. The field lists the steps that must complete before the step runs. The Arazzo specification requires each value in the list to be a stepId. A tool cannot wait for a step that does not exist.

The spec-step-dependsOn-defined rule checks the three forms of a value:

  • A plain stepId must match a step of the current workflow.
  • A reference to a step of another workflow must have the form $workflows.<workflowId>.steps.<stepId>. It must name a workflow of the same document and a step of that workflow.
  • A reference to a step of another Arazzo document must have the form $sourceDescriptions.<name>.<workflowId>.steps.<stepId>.

The rule reports every other value that starts with $, such as $steps.create-order or $sourceDescriptions.loyalty.earn-points.

The rule does not open the other Arazzo document, so it does not check that the workflow and the step exist there. The spec-sourceDescriptions-defined rule reports a reference to a source description that is not defined.

Configuration

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

An example configuration:

rules:
  spec-step-dependsOn-defined: error

Examples

Given the following configuration:

rules:
  spec-step-dependsOn-defined: error

Example of an incorrect step that depends on a missing step, and on a step of a missing workflow:

workflows:
  - workflowId: place-order
    steps:
      - stepId: create-order
        operationId: cafe-api.createOrder
      - stepId: get-order
        operationId: cafe-api.getOrderById
        dependsOn:
          - submit-order
          - $workflows.checkout.steps.create-order

Example of a correct step that depends on steps of the same workflow, of another workflow, and of an Arazzo source description:

sourceDescriptions:
  - name: cafe-api
    type: openapi
    url: openapi.yaml
  - name: loyalty
    type: arazzo
    url: loyalty.arazzo.yaml
workflows:
  - workflowId: browse-menu
    steps:
      - stepId: list-menu-items
        operationId: cafe-api.listMenuItems
  - workflowId: place-order
    steps:
      - stepId: create-order
        operationId: cafe-api.createOrder
      - stepId: get-order
        operationId: cafe-api.getOrderById
        dependsOn:
          - create-order
          - $workflows.browse-menu.steps.list-menu-items
          - $sourceDescriptions.loyalty.earn-points.steps.add-points

Resources