Skip to main content

Merge ExecModule

Overview

MergeModule version 2.0.0 combines one or more workflow objects or arrays in a stable source order. It is a local, side-effect-free transformation: it does not need network access or an IntegrationAccount, and it never writes to an external system.

Version 2 replaces catalog metadata that exposed zero inputs, malformed output names, and only one generic configuration field. It also rejects missing sources, mixed types, malformed keyed records, duplicate source paths, invalid strategies, unsafe aliases, excessive nesting, and result-limit breaches without returning partial data.

Usage

  1. Put the object or array values in workflow state.
  2. Configure sources as an ordered JSON array of paths to those values.
  3. Choose a conflict strategy for object fields or duplicate keyed array records.
  4. For arrays, set merge_key to coalesce object records by a nested key; omit it to concatenate.
  5. Set max_output_items and max_depth for the downstream workload.
  6. Read the result from canonical data; arrays are also available as items. The configured output_field is a compatibility alias.

Inputs

NameTypeRequiredLimitDescription
sourcesobjects or arraysYes1–32 source pathsValues resolved from the ordered sources configuration.

Every resolved value must be an object, or every value must be an array. Mixing object and array sources fails the complete execution. In keyed-array mode, every item must be an object with a non-null value at merge_key.

Outputs

NameTypeConditionDescription
statusstringAlwayssuccess or error.
dataobject or arraySuccessCanonical merged result.
itemsarrayArray successCanonical array result.
merged_dataobject or arrayDefault aliasCompatibility alias selected by the default output_field.
countintegerSuccessTop-level object fields or array items in the result.
sourceCountintegerSuccessNumber of validated sources.
modestringSuccessobject, array_concat, or array_by_key.
errorCodestringErrorStable machine-readable failure code.
errorstringErrorSafe, actionable failure message.

IntegrationAccount Requirements

None. MergeModule operates only on in-memory workflow data and must not receive credentials. Merged data is classified as confidential because combining records can increase sensitivity; downstream workflows must preserve normal ACL and data-handling controls.

Configuration

FieldTypeRequiredDefaultDescription
sourcesJSON arrayYesOrdered workflow paths such as payload.profile.
strategyselectYesoverwriteoverwrite, keep, merge, or array.
deep_mergebooleanNotrueRecursively merge nested objects when strategy is merge.
merge_keytextNoemptyNested key for coalescing array records, such as identity.id.
output_fieldtextNomerged_dataCompatibility alias for canonical data.
max_output_itemsintegerNo10000Maximum result items or top-level object fields; hard cap 100,000.
max_depthintegerNo16Maximum copied or recursively merged container depth; hard cap 32.

Paths support object segments and bounded zero-based indexes, such as payload.groups[0].members. Paths are at most 256 characters. Output aliases are at most 128 characters and cannot shadow canonical status, result, or error fields.

Operations

Object merge

Object fields are visited in source order. First-seen field order is preserved.

StrategyConflict behavior
overwriteThe later value replaces the earlier value.
keepThe first value remains.
mergeNested objects merge recursively when deep_merge is true; other later values replace earlier values.
arrayConflicting values are collected into one array; existing arrays are flattened one level.

Array concatenation

When merge_key is empty, arrays are concatenated in source order. Items retain their original order.

Array merge by key

When merge_key is configured, every item must be an object containing that key. The first occurrence establishes output order. Later records with the same key are combined using the selected strategy. Missing keys and primitive items are rejected rather than silently discarded.

Errors and Failure Modes

Error codeCauseRecovery
VALIDATION_ERRORInvalid source list, path, alias, boolean, integer, or duplicate source path.Correct the named configuration.
INVALID_STRATEGYstrategy is unsupported.Choose one of the four documented strategies.
SOURCE_LIMIT_EXCEEDEDMore than 32 source paths were configured.Partition the merge into bounded stages.
MISSING_SOURCEA configured workflow path is absent or null.Populate the source or remove the path deliberately.
TYPE_MISMATCHObject and array sources were mixed.Normalize all sources to one top-level type.
INVALID_RECORDKeyed-array mode received a primitive item or an object with a non-string field name.Normalize the record before merging.
MISSING_MERGE_KEYA keyed-array record has no non-null merge key.Populate the key or use concatenation mode.
RESULT_LIMIT_EXCEEDEDThe result exceeds max_output_items.Filter, partition, or deliberately raise the bound.
DEPTH_LIMIT_EXCEEDEDNested data exceeds max_depth.Flatten the source or deliberately raise the bound.
EXECUTION_ERRORAn unexpected local failure occurred.Preserve inputs, inspect sanitized diagnostics, and fix the defect before retrying.

Failures clear partial results. Event logs contain only mode, count, or stable error code—not merged payloads.

Example

Configuration:

{
"sources": ["payload.profile", "payload.preferences"],
"strategy": "merge",
"deep_merge": true,
"output_field": "customer",
"max_output_items": 100,
"max_depth": 12
}

Input:

{
"payload": {
"profile": {
"id": "u-1",
"contact": {"name": "Ada", "email": "ada@example.com"}
},
"preferences": {
"contact": {"locale": "en-US"},
"marketingOptIn": true
}
}
}

Expected result:

{
"status": "success",
"data": {
"id": "u-1",
"contact": {
"name": "Ada",
"email": "ada@example.com",
"locale": "en-US"
},
"marketingOptIn": true
},
"customer": {
"id": "u-1",
"contact": {
"name": "Ada",
"email": "ada@example.com",
"locale": "en-US"
},
"marketingOptIn": true
},
"count": 3,
"sourceCount": 2,
"mode": "object"
}

Notes

  • Pagination: none. Inputs are already-materialized workflow values; partition large data upstream.
  • Limits: 32 sources, 256-character paths, 100,000 hard maximum output items, and depth 32.
  • Idempotency: natural and deterministic for the same ordered inputs and configuration.
  • Input mutation: nested objects and arrays are copied into the result; the module does not mutate source containers.
  • Rate limits: none; no provider is called.
  • API constraints: keyed equality follows Java object equality after workflow deserialization. Numeric 7 and string "7" are distinct keys.
  • Destructive behavior: none. No record is created, updated, or deleted outside workflow memory.
  • Testing boundary: focused tests cover recursive object merge, copy isolation, deterministic keyed arrays, limits, malformed records, missing sources, depth, aliases, and metadata serialization.
  • Runtime boundary: merged source, production documentation, public launch content, and deployed /v1/modules/metadata remain separate delivery states.

See the ExecModule catalog and the neighboring Join module.