Skip to content

Commit b1f75d1

Browse files
authored
Check for required fields while parsing the schema (#594)
1 parent bca10e9 commit b1f75d1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/exec/packer/packer.go

+6
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ func (b *Builder) MakeStructPacker(values []*ast.InputValueDefinition, typ refle
199199
if sf.PkgPath != "" {
200200
return nil, fmt.Errorf("field %q must be exported", sf.Name)
201201
}
202+
if _, ok := v.Type.(*ast.NonNull); ok {
203+
if sf.Type.Kind() == reflect.Ptr {
204+
return nil, fmt.Errorf("field %q must be a non-pointer since the parameter is required", sf.Name)
205+
}
206+
}
207+
202208
fe.index = sf.Index
203209

204210
ft := v.Type

0 commit comments

Comments
 (0)