Add support for interfaces, part 3: automatically add __typename (#56)
## Summary: In #52, I added support for interface types, but with the simplifying restriction (among others) that the user must request the field `__typename`. In this commit, I remove this restriction. The basic idea is simple: we preprocess the query to add `__typename`. The implementation isn't much more complicated! Although it required some new wiring in a few places. Issue: https://github.com/Khan/genqlient/issues/8 ## Test plan: make check Author: benjaminjkraft Reviewers: dnerdy, aberkan, 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/56
This commit is contained in:
@@ -59,7 +59,7 @@ func TestVariables(t *testing.T) {
|
||||
func TestInterfaceNoFragments(t *testing.T) {
|
||||
_ = `# @genqlient
|
||||
query queryWithInterfaceNoFragments($id: ID!) {
|
||||
being(id: $id) { __typename id name }
|
||||
being(id: $id) { id name }
|
||||
me { id name }
|
||||
}`
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestInterfaceNoFragments(t *testing.T) {
|
||||
func TestInterfaceListField(t *testing.T) {
|
||||
_ = `# @genqlient
|
||||
query queryWithInterfaceListField($ids: [ID!]!) {
|
||||
beings(ids: $ids) { __typename id name }
|
||||
beings(ids: $ids) { id name }
|
||||
}`
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user