Skip to content

Commit

Permalink
Fix(Data Mapper): fixed missing connection (#6527)
Browse files Browse the repository at this point in the history
fixed missing connection
  • Loading branch information
DanielleCogs authored Feb 3, 2025
1 parent e806c0c commit d7e9bb4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libs/data-mapper-v2/src/mapHandling/MapDefinitionSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ const applyValueAtPath = (mapDefinition: MapDefinitionEntry, path: OutputPathIte
});
};

// this gets the first child of 'if' or 'for' to determine order
// key always starts with 'if' or 'for'
const findKeyInMap = (mapDefinition: MapDefinitionEntry, key: string): string | undefined => {
if (mapDefinition[key]) {
return key;
Expand All @@ -498,9 +500,15 @@ const findKeyInMap = (mapDefinition: MapDefinitionEntry, key: string): string |
if (typeof mapDefinition[currentKey] === 'object') {
const foundKey = findKeyInMap(mapDefinition[currentKey] as MapDefinitionEntry, key);
if (foundKey) {
const childKey = Object.keys((mapDefinition[currentKey] as MapDefinitionEntry)[foundKey])[0];
return childKey;
if (mapDefinition[currentKey] && Object.keys((mapDefinition[currentKey] as MapDefinitionEntry)[foundKey])) {
const childKey = Object.keys((mapDefinition[currentKey] as MapDefinitionEntry)[foundKey])[0];
if (!childKey) {
return foundKey;
}
return childKey;
}
}
return foundKey;
}
}

Expand Down

0 comments on commit d7e9bb4

Please sign in to comment.