Skip to content

Commit

Permalink
Fix(Data Mapper): deserialization string bug fix (#4567)
Browse files Browse the repository at this point in the history
fixed deserialization bug

Co-authored-by: Danielle Cogburn <dacogburn@microsoft.com>
  • Loading branch information
DanielleCogs and Danielle Cogburn committed Apr 8, 2024
1 parent 90daa29 commit f48f2fe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const DevApiTester = () => {
<Stack tokens={{ childrenGap: '8px' }}>
<TextField
label="Schema filename"
placeholder="Schema filename (w/o extension)"
placeholder="Schema filename WITH extension"
value={schemaFilename ?? ''}
onChange={(_e, newValue) => setSchemaFilename(newValue ?? '')}
/>
Expand Down
2 changes: 1 addition & 1 deletion libs/data-mapper/src/lib/utils/DataMap.Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ export const qualifyLoopRelativeSourceKeys = (targetKey: string): string => {
srcKeys.forEach((srcKey) => {
if (!srcKey.includes(curSrcParentKey) && srcKey !== '*') {
const fullyQualifiedSrcKey = `${curSrcParentKey}/${srcKey}`;
qualifiedTargetKey = qualifiedTargetKey.replace(srcKey, fullyQualifiedSrcKey);
qualifiedTargetKey = qualifiedTargetKey.replace(`(${srcKey}`, `(${fullyQualifiedSrcKey}`);

curSrcParentKey = fullyQualifiedSrcKey;
} else if (srcKey === '*') {
Expand Down
6 changes: 6 additions & 0 deletions libs/data-mapper/src/lib/utils/__test__/DataMapUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,12 @@ describe('utils/DataMap', () => {
)
).toBe('/ns0:TargetSchemaRoot/Looping/ManyToOne/$for(/ns0:SourceSchemaRoot/Looping/ManyToOne/Simple, $a)/RandomKey');
});

it('two loops with child name in source name', () => {
expect(qualifyLoopRelativeSourceKeys('/ns0:X12_00401_856/$for(/Shipment/HL-S)/ns0:HL-SLoop/$for(HL)/ns0:HL/HL01')).toBe(
'/ns0:X12_00401_856/$for(/Shipment/HL-S)/ns0:HL-SLoop/$for(/Shipment/HL-S/HL)/ns0:HL/HL01'
);
});
});

describe('getTargetValueWithoutLoops', () => {
Expand Down

0 comments on commit f48f2fe

Please sign in to comment.