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
| Property | Type | Description |
|---|---|---|
type | string | Must be map. |
set | object | Key-value pairs of fields to add or update in the pipeline. |
drop | array | List 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.
- type: "map"
set:
status: "pending"
retryCount: 0
isActive: true2. Pipeline References
Copy a value from one pipeline field to another using the ${variableName} syntax.
- 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.
- 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
resultbut the next service expectstext, 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
- name: "PrepareUserOutput"
type: "map"
set:
user_id: "${id}"
displayName: "${firstName} ${lastName}"
role: "MEMBER"
drop:
- "password"
- "id"Data Flow
Initial Pipeline:
{
"id": "USR-123",
"firstName": "John",
"lastName": "Doe",
"password": "secret_hash_123"
}Resulting Pipeline:
{
"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)
