From 7515408419dbc596301e1dcbd5cd81490fd2bd9e Mon Sep 17 00:00:00 2001 From: Kenneth Aasan Date: Fri, 7 Oct 2022 13:24:41 +0200 Subject: [PATCH] fix: fixes renderUnmarshalProperty --- src/generators/typescript/presets/CommonPreset.ts | 2 +- .../preset/__snapshots__/MarshallingPreset.spec.ts.snap | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/generators/typescript/presets/CommonPreset.ts b/src/generators/typescript/presets/CommonPreset.ts index b8ae9e9519..5a6d5f1c68 100644 --- a/src/generators/typescript/presets/CommonPreset.ts +++ b/src/generators/typescript/presets/CommonPreset.ts @@ -79,7 +79,7 @@ ${renderer.indent(renderMarshalProperties(model))} function renderUnmarshalProperty(modelInstanceVariable: string, model: ConstrainedMetaModel) { if (model instanceof ConstrainedReferenceModel && !(model.ref instanceof ConstrainedEnumModel)) { - return `$\{${model.type}.unmarshal(${modelInstanceVariable})}`; + return `${model.type}.unmarshal(${modelInstanceVariable})`; } return `${modelInstanceVariable}`; } diff --git a/test/generators/typescript/preset/__snapshots__/MarshallingPreset.spec.ts.snap b/test/generators/typescript/preset/__snapshots__/MarshallingPreset.spec.ts.snap index bf8475fbcd..48933560c8 100644 --- a/test/generators/typescript/preset/__snapshots__/MarshallingPreset.spec.ts.snap +++ b/test/generators/typescript/preset/__snapshots__/MarshallingPreset.spec.ts.snap @@ -77,12 +77,12 @@ exports[`Marshalling preset should render un/marshal code 1`] = ` instance.numberProp = obj[\\"numberProp\\"]; } if (obj[\\"nestedObject\\"] !== undefined) { - instance.nestedObject = \${NestedTest.unmarshal(obj[\\"nestedObject\\"])}; + instance.nestedObject = NestedTest.unmarshal(obj[\\"nestedObject\\"]); } if (instance.additionalProperties === undefined) {instance.additionalProperties = new Map();} for (const [key, value] of Object.entries(obj).filter((([key,]) => {return ![\\"stringProp\\",\\"enumProp\\",\\"numberProp\\",\\"nestedObject\\",\\"additionalProperties\\"].includes(key);}))) { - instance.additionalProperties.set(key, \${NestedTest.unmarshal(value as any)}); + instance.additionalProperties.set(key, NestedTest.unmarshal(value as any)); } return instance;