From 358249bdb4e2f87a7203166ae32b34de0f57b715 Mon Sep 17 00:00:00 2001 From: Dogan Can Bakir <65292895+dogancanbakir@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:06:21 +0300 Subject: [PATCH] fix recursive struct validation during JSON marshaling (#5883) --- pkg/templates/templates.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/templates/templates.go b/pkg/templates/templates.go index 2420858c0..0c59dff4f 100644 --- a/pkg/templates/templates.go +++ b/pkg/templates/templates.go @@ -521,7 +521,8 @@ func (template *Template) hasMultipleRequests() bool { // MarshalJSON forces recursive struct validation during marshal operation func (template *Template) MarshalJSON() ([]byte, error) { - out, marshalErr := json.Marshal(template) + type TemplateAlias Template //avoid recursion + out, marshalErr := json.Marshal((*TemplateAlias)(template)) errValidate := validate.New().Struct(template) return out, multierr.Append(marshalErr, errValidate) }