Skip to content

Commit

Permalink
check nullable arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
asamusev committed Dec 3, 2018
1 parent 6b00509 commit be51904
Show file tree
Hide file tree
Showing 13 changed files with 264 additions and 23 deletions.
2 changes: 1 addition & 1 deletion codegen/templates/args.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{- range $directive := $arg.Directives }}
func(ctx context.Context, n graphql.Resolver) (res interface{}, err error) {
{{- range $dArg := $directive.Args }}
{{- if and $dArg.IsPtr $dArg.Value }}{{ $dArg.GoVarName }} := {{ $dArg.Value }}{{ end -}}
{{- if and $dArg.IsPtr (not (eq ($dArg.Value|dump) "nil")) }}{{ $dArg.GoVarName }} := {{ $dArg.Value|dump }}{{ end -}}
{{- end }}
return e.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "tmp" "n" }})
},
Expand Down
2 changes: 1 addition & 1 deletion codegen/templates/data.go

Large diffs are not rendered by default.

179 changes: 170 additions & 9 deletions codegen/testserver/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit be51904

Please sign in to comment.