95609f77a1
## Summary: One sharp edge of the new `bindings` setting (when used for composite types) is this: the (presumably struct) type to which you're binding may expect to have particular fields, but it's GraphQL so you could have requested some other set of fields. Now, if you ask us, we check. Specifically, I've added a new setting under the `bindings` items, which says: everywhere we query this must select these fields. (Or use its own inline `# @genqlient(bind: ...)`.) It must select exactly those fields, in order, no more, no less. This was fairly easy to implement; actually comparing the selections was surprisingly much code but it's all pretty straightforward. ## Test plan: make check Author: benjaminjkraft Reviewers: dnerdy, aberkan, csilvers, MiguelCastillo Required Reviewers: Approved by: dnerdy Checks: ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Test (1.13), ✅ Lint, ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Test (1.13), ✅ Lint Pull request URL: https://github.com/Khan/genqlient/pull/70
18 lines
595 B
GraphQL
18 lines
595 B
GraphQL
query GetPokemonSiblings($input: PokemonInput!) {
|
|
user(query: {hasPokemon: $input}) {
|
|
# this will override the default mapping to internal/testutil.ID:
|
|
# @genqlient(bind: "string")
|
|
id
|
|
# this is normally an enum, but here we make it a (list of) string:
|
|
# @genqlient(bind: "[]string")
|
|
roles
|
|
name
|
|
# this is mapped globally to internal/testutil.Pokemon:
|
|
# note field ordering matters, but whitespace shouldn't.
|
|
pokemon { species level }
|
|
# this overrides said mapping:
|
|
# @genqlient(bind: "-")
|
|
genqlientPokemon: pokemon { species level }
|
|
}
|
|
}
|