diff options
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/field.gotpl')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/codegen/field.gotpl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl index c0f6fcae..1970614b 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl +++ b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl @@ -107,6 +107,11 @@ if data, ok := tmp.({{ .TypeReference.GO | ref }}) ; ok { return data, nil } + {{- if .TypeReference.IsNilable -}} + else if tmp == nil { + return nil, nil + } + {{- end }} return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ .TypeReference.GO }}`, tmp) {{- else -}} ctx = rctx // use context from middleware stack in children |