Skip to content

Commit 30269c6

Browse files
author
denkweit
committed
fixes optional slice bug
1 parent 857a114 commit 30269c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modelgen/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (m *Plugin) MutateConfig(cfg *config.Config) error {
170170
typ = binder.CopyModifiersFromAst(field.Type, typ)
171171

172172
tag := `json:"` + field.Name + `"`
173-
if schemaType.Kind == ast.InputObject {
173+
if schemaType.Kind == ast.InputObject && !field.Type.NonNull {
174174
switch typ.(type) {
175175
case *types.Slice:
176176
optionalTypeName := fmt.Sprintf("Optional%sSlice", field.Type.Name())

0 commit comments

Comments
 (0)