summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-swagger/go-swagger/generator/templates/schemaembedded.gotmpl
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-swagger/go-swagger/generator/templates/schemaembedded.gotmpl')
-rw-r--r--vendor/github.com/go-swagger/go-swagger/generator/templates/schemaembedded.gotmpl21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/go-swagger/go-swagger/generator/templates/schemaembedded.gotmpl b/vendor/github.com/go-swagger/go-swagger/generator/templates/schemaembedded.gotmpl
new file mode 100644
index 000000000..f86c27bc6
--- /dev/null
+++ b/vendor/github.com/go-swagger/go-swagger/generator/templates/schemaembedded.gotmpl
@@ -0,0 +1,21 @@
+{{ define "schemaEmbedded" }}
+type {{ pascalize .Name }} struct {
+ {{ if .ElemType.IsNullable }}*{{ end }}{{ .ElemType.GoType }}
+}
+
+func ({{.ReceiverName }} {{ if or .IsTuple .IsComplexObject }}*{{ end }}{{ if .Discriminates }}{{ camelize .Name }}{{ else if .IsExported }}{{ pascalize .Name }}{{ else }}{{ .Name }}{{ end }}) Validate(formats strfmt.Registry) error {
+ var f interface{} = {{ .ReceiverName }}.{{ dropPackage .ElemType.GoType }}
+ if v, ok := f.(runtime.Validatable) ; ok {
+ return v.Validate(formats)
+ }
+ return nil
+}
+
+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 {
+ var f interface{} = {{ .ReceiverName }}.{{ dropPackage .ElemType.GoType }}
+ if v, ok := f.(runtime.ContextValidatable) ; ok {
+ return v.ContextValidate(ctx, formats)
+ }
+ return nil
+}
+{{- end }}