Skip to content
Last updated

spec-step-parameters-in-required

Requires the in field on the parameters of a step that calls an operation.

ArazzoCompatibility
1.x✅

Design principles

A step parameter is sent to an operation or passed to another workflow. When the step uses workflowId, its parameters map to the inputs of that workflow, and the in field is not needed. In all other cases the Arazzo specification requires the in field. The in field tells where the parameter goes in the request: path, query, header, or cookie. Arazzo 1.1 also allows querystring. Without the in field, a tool cannot place the value.

The spec-step-parameters-in-required rule reports each parameter without in in a step that does not use workflowId.

The parameters of a workflow apply to all of its steps. The rule reports a workflow parameter without in when at least one step of the workflow does not use workflowId. To pass a value only to the steps that use workflowId, define the parameter in those steps.

For a parameter taken from components with a reference, the rule checks the referenced parameter and reports the place that uses it. The struct rule reports an in value that the specification does not define.

Configuration

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

An example configuration:

rules:
  spec-step-parameters-in-required: error

Examples

Given the following configuration:

rules:
  spec-step-parameters-in-required: error

Example of an incorrect step parameter:

workflows:
  - workflowId: get-order
    steps:
      - stepId: get-order
        operationId: cafe-api.getOrderById
        parameters:
          - name: orderId
            value: $inputs.orderId

Example of an incorrect workflow parameter, which applies to a step that calls an operation:

workflows:
  - workflowId: get-order
    parameters:
      - name: orderId
        value: $inputs.orderId
    steps:
      - stepId: get-order
        operationId: cafe-api.getOrderById

Example of correct step parameters:

workflows:
  - workflowId: get-order
    steps:
      - stepId: get-order
        operationId: cafe-api.getOrderById
        parameters:
          - name: orderId
            in: path
            value: $inputs.orderId
      - stepId: pay-for-order
        workflowId: pay-for-order
        parameters:
          - name: orderId
            value: $inputs.orderId

Resources