templates: Skip validation for interface{}

Signed-off-by: Jingwen Peng <pengsrc@yunify.com>
This commit is contained in:
Jingwen Peng 2017-08-23 11:01:11 +08:00 committed by Aspire
parent 4d932f5467
commit c8a32f716c
1 changed files with 3 additions and 2 deletions

View File

@ -195,7 +195,7 @@
{{end}}
{{end}}
{{if eq $property.Type "object"}}
{{if and (eq $property.Type "object") (ne $property.ExtraType "") }}
if v.{{$property.ID | camelCase}} != nil {
if err := v.{{$property.ID | camelCase}}.Validate(); err != nil {
return err
@ -223,7 +223,8 @@
{{$isNotString := ne $property.ExtraType "string"}}
{{$isNotInteger := ne $property.ExtraType "integer"}}
{{$isNotTimestamp := ne $property.ExtraType "timestamp"}}
{{if and $isNotString $isNotInteger $isNotTimestamp}}
{{$isNotInterface := ne $property.ExtraType "object"}}
{{if and $isNotString $isNotInteger $isNotTimestamp $isNotInterface}}
if len(v.{{$property.ID | camelCase}}) > 0 {
for _, property := range v.{{$property.ID | camelCase}} {
if err := property.Validate(); err != nil {