graphql-go / graphql-go/graphql
No error message thrown when accidentally passing incorrect field config type
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 845
- PR merge metrics
- No merged PRs in 30d
Description
**TL;DR: No error message gets thrown if you use the wrong field config type. (E.g. `graphql.Fields` instead of `graphql.InputObjectConfigFieldMap`)**
---
I was bootstrapping a new GraphQL schema using this library, but was seeing behavior identical to #187 when I tried to load up the GraphiQL explorer. (The introspection query failed claiming `__Type` was an unknown type.)
Eventually I managed to minimize the problem down to the inclusion of an InputObjectType--when I included my input object the introspection query failed; when I removed it by changing the argument type to a string, everything worked fine.
I then compared my InputObject declaration to the [InputObject declaration from `introspection_test.go`](https://github.com/graphql-go/graphql/blob/master@{2017-11-03}/introspection_test.go#L839-L850) and realized I was using `Fields: graphql.Fields{ ... }` in my call to `NewInputObject` instead of `Fields: graphql.InputObjectConfigFieldMap{ ... }`.
---
**Ultimately this boils down to: Why is [`InputObject.Fields` an `interface{}`](https://github.com/graphql-go/graphql/blob/master@{2017-11-03}/definition.go#L1125)?** Would this be solved by declaring it to have a more specific type?
Contributor guide
Assessment
This issue has not been assessed yet.