Skip to content

MAP Step

The MAP step allows you to perform direct data transformation within the pipeline without calling an external service. It is the most common way to prepare data for downstream steps or clean up the pipeline after a process is complete.

Properties

PropertyTypeDescription
typestringMust be map.
setobjectKey-value pairs of fields to add or update in the pipeline.
droparrayList of pipeline field names to remove.

The set Operation

The set property allows you to add new variables to the pipeline or update existing ones. It supports two modes of assignment:

1. Literal Values

Assign a fixed value (string, number, boolean, object, or array) directly.

yaml
- type: "map"
  set:
    status: "pending"
    retryCount: 0
    isActive: true

2. Pipeline References

Copy a value from one pipeline field to another using the ${variableName} syntax.

yaml
- type: "map"
  set:
    customerName: "${input.profile.name}"

The drop Operation

ESB pipelines can grow large and cluttered. Use the drop property to remove temporary variables or sensitive data that are no longer needed.

yaml
- type: "map"
  drop:
    - "tempPassword"
    - "rawResponse"

Best Practices

  • Initialization: Use a MAP step at the beginning of a flow to initialize default values or constants.
  • Renaming: If a service outputs result but the next service expects text, use a MAP step to "rename" the variable (text: "${result}").
  • Cleanup: Always drop large JSON responses or temporary calculation variables at the end of a flow to keep the final output lean.

Example: Data Transformation

In this example, we prepare a user object by copying fields and setting a default, while cleaning up sensitive input data.

Step Definition

yaml
- name: "PrepareUserOutput"
  type: "map"
  set:
    user_id: "${id}"
    displayName: "${firstName} ${lastName}"
    role: "MEMBER"
  drop:
    - "password"
    - "id"

Data Flow

Initial Pipeline:

json
{
  "id": "USR-123",
  "firstName": "John",
  "lastName": "Doe",
  "password": "secret_hash_123"
}

Resulting Pipeline:

json
{
  "firstName": "John",
  "lastName": "Doe",
  "user_id": "USR-123",
  "displayName": "John Doe",
  "role": "MEMBER"
}

(Note: 'password' and 'id' were dropped, while 'user_id', 'displayName', and 'role' were added)

Released under the ISC License.