From 1efc152e4f9399a908620d1d4c1198b9662cb181 Mon Sep 17 00:00:00 2001 From: Kei Kamikawa Date: Fri, 30 Apr 2021 10:58:45 +0900 Subject: [PATCH] supported INPUT_OBJECT directive --- codegen/field.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/codegen/field.go b/codegen/field.go index d1eceb002ef..3a90530b9a7 100644 --- a/codegen/field.go +++ b/codegen/field.go @@ -89,6 +89,11 @@ func (b *builder) bindField(obj *Object, f *Field) (errret error) { if err != nil { errret = err } + for _, dir := range obj.Directives { + if dir.IsLocation(ast.LocationInputObject) { + dirs = append(dirs, dir) + } + } f.Directives = append(dirs, f.Directives...) } }() @@ -420,7 +425,8 @@ func (f *Field) ImplDirectives() []*Directive { loc = ast.LocationInputFieldDefinition } for i := range f.Directives { - if !f.Directives[i].Builtin && f.Directives[i].IsLocation(loc, ast.LocationObject) { + if !f.Directives[i].Builtin && + (f.Directives[i].IsLocation(loc, ast.LocationObject) || f.Directives[i].IsLocation(loc, ast.LocationInputObject)) { d = append(d, f.Directives[i]) } }