mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-01-31 15:53:10 +08:00
fix recursive struct validation during JSON marshaling (#5883)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user