From 1b622c34cac71fc2ab38e768a2f67a51d70940b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Wed, 25 Sep 2024 10:36:42 +0200 Subject: [PATCH] fix(code-gen/go): fix issues on combined parent-child calling wrong parent --- .../main/resources/templates/go/complex-type-template.go.ftlh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh b/code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh index e729ca86d30..31b0fbe0a5d 100644 --- a/code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh +++ b/code-generation/language-go/src/main/resources/templates/go/complex-type-template.go.ftlh @@ -1564,7 +1564,7 @@ func (m *_${type.name}) SerializeWithWriteBuffer(ctx context.Context, writeBuffe } return nil } - return m.${type.getParentType().orElseThrow().name}Contract.(*_${type.getParentType().orElseThrow().name}).serializeParent(ctx, writeBuffer, m, ser) + return <#if type.isDiscriminatedParentTypeDefinition()>pm.${type.getParentType().orElseThrow().name}Contract.(*_${type.getParentType().orElseThrow().name}).serializeParent(ctx, writeBuffer, m, ser) <#else> if popErr := writeBuffer.PopContext("${type.name}"); popErr != nil { return errors.Wrap(popErr, "Error popping for ${type.name}")<@emitImport import="github.com/pkg/errors" />