Skip to content

Commit

Permalink
Merge pull request 99designs#133 from mastercactapus/skip-type-mismatch
Browse files Browse the repository at this point in the history
skip struct fields with incompatible types
  • Loading branch information
vektah authored Jun 18, 2018
2 parents 27e61b8 + d0aba4a commit 05d502d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion codegen/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func bindObject(t types.Type, object *Object, imports Imports) error {
}

if structField := findField(underlying, field.GQLName); structField != nil {
prevModifiers := field.Type.Modifiers
field.Type.Modifiers = modifiersFromGoType(structField.Type())
field.GoVarName = structField.Name()

Expand All @@ -190,7 +191,9 @@ func bindObject(t types.Type, object *Object, imports Imports) error {
}

default:
return errors.Errorf("type mismatch on %s.%s, expected %s got %s\n", object.GQLType, field.GQLName, field.Type.FullSignature(), structField.Type())
// type mismatch, require custom resolver for field
field.GoVarName = ""
field.Type.Modifiers = prevModifiers
}
continue
}
Expand Down

0 comments on commit 05d502d

Please sign in to comment.