Skip to content

Commit 358249b

Browse files
fix recursive struct validation during JSON marshaling (#5883)
1 parent f21a82a commit 358249b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/templates/templates.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ func (template *Template) hasMultipleRequests() bool {
521521

522522
// MarshalJSON forces recursive struct validation during marshal operation
523523
func (template *Template) MarshalJSON() ([]byte, error) {
524-
out, marshalErr := json.Marshal(template)
524+
type TemplateAlias Template //avoid recursion
525+
out, marshalErr := json.Marshal((*TemplateAlias)(template))
525526
errValidate := validate.New().Struct(template)
526527
return out, multierr.Append(marshalErr, errValidate)
527528
}

0 commit comments

Comments
 (0)