github.com/AngusLu/go-swagger@v0.28.0/generator/templates/schemaembedded.gotmpl (about) 1 {{ define "schemaEmbedded" }} 2 type {{ pascalize .Name }} struct { 3 {{ if .ElemType.IsNullable }}*{{ end }}{{ .ElemType.GoType }} 4 } 5 6 func ({{.ReceiverName }} {{ if or .IsTuple .IsComplexObject }}*{{ end }}{{ if .Discriminates }}{{ camelize .Name }}{{ else if .IsExported }}{{ pascalize .Name }}{{ else }}{{ .Name }}{{ end }}) Validate(formats strfmt.Registry) error { 7 var f interface{} = {{ .ReceiverName }}.{{ dropPackage .ElemType.GoType }} 8 if v, ok := f.(runtime.Validatable) ; ok { 9 return v.Validate(formats) 10 } 11 return nil 12 } 13 14 func ({{.ReceiverName }} {{ if or .IsTuple .IsComplexObject }}*{{ end }}{{ if .Discriminates }}{{ camelize .Name }}{{ else if .IsExported }}{{ pascalize .Name }}{{ else }}{{ .Name }}{{ end }}) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 15 var f interface{} = {{ .ReceiverName }}.{{ dropPackage .ElemType.GoType }} 16 if v, ok := f.(runtime.ContextValidatable) ; ok { 17 return v.ContextValidate(ctx, formats) 18 } 19 return nil 20 } 21 {{- end }}