## Summary: We guarantee that we never return a nil response, so you can safely do ``` resp, err := myQuery(...) return resp.Field.SubField, err ``` And furthermore, if the error was a GraphQL error, `resp` may even be nonzero; other, non-failing fields may be set. (This depends on the server, of course.) But we weren't testing either of those. Now we do. ## Test plan: make check Author: benjaminjkraft Reviewers: jvoll, aberkan, dnerdy, MiguelCastillo, mahtabsabet Required Reviewers: Approved By: jvoll Checks: ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint, ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint Pull Request URL: https://github.com/Khan/genqlient/pull/83
42 lines
651 B
GraphQL
42 lines
651 B
GraphQL
type Query {
|
|
me: User
|
|
user(id: ID!): User
|
|
being(id: ID!): Being
|
|
beings(ids: [ID!]!): [Being]!
|
|
lotteryWinner(number: Int!): Lucky
|
|
fail: Boolean
|
|
}
|
|
|
|
type User implements Being & Lucky {
|
|
id: ID!
|
|
name: String!
|
|
luckyNumber: Int
|
|
hair: Hair
|
|
}
|
|
|
|
type Hair { color: String } # silly name to confuse the name-generator
|
|
|
|
type Animal implements Being {
|
|
id: ID!
|
|
name: String!
|
|
species: Species!
|
|
owner: Being
|
|
hair: BeingsHair
|
|
}
|
|
|
|
type BeingsHair { hasHair: Boolean! } # silly name to confuse the name-generator
|
|
|
|
enum Species {
|
|
DOG
|
|
COELACANTH
|
|
}
|
|
|
|
interface Being {
|
|
id: ID!
|
|
name: String!
|
|
}
|
|
|
|
interface Lucky {
|
|
luckyNumber: Int
|
|
}
|