-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from sourcegraph/fix-union-interface-inline-f…
…ragments fix #241
- Loading branch information
Showing
5 changed files
with
164 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1703,6 +1703,77 @@ func TestInlineFragments(t *testing.T) { | |
} | ||
`, | ||
}, | ||
|
||
{ | ||
Schema: starwarsSchema, | ||
Query: ` | ||
query CharacterSearch { | ||
search(text: "C-3PO") { | ||
... on Character { | ||
name | ||
} | ||
} | ||
} | ||
`, | ||
ExpectedResult: ` | ||
{ | ||
"search": [ | ||
{ | ||
"name": "C-3PO" | ||
} | ||
] | ||
} | ||
`, | ||
}, | ||
|
||
{ | ||
Schema: starwarsSchema, | ||
Query: ` | ||
query CharacterSearch { | ||
hero { | ||
... on Character { | ||
... on Human { | ||
name | ||
} | ||
... on Droid { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
ExpectedResult: ` | ||
{ | ||
"hero": { | ||
"name": "R2-D2" | ||
} | ||
} | ||
`, | ||
}, | ||
|
||
{ | ||
Schema: socialSchema, | ||
Query: ` | ||
query { | ||
admin(id: "0x01") { | ||
... on User { | ||
} | ||
... on Person { | ||
name | ||
} | ||
} | ||
} | ||
`, | ||
ExpectedResult: ` | ||
{ | ||
"admin": { | ||
"email": "[email protected]", | ||
"name": "Albus Dumbledore" | ||
} | ||
} | ||
`, | ||
}, | ||
}) | ||
} | ||
|
||
|
@@ -2946,27 +3017,27 @@ type helloInputMismatch struct { | |
World string | ||
} | ||
|
||
func (r *inputArgumentsHello) Hello(args struct { Input *helloInput }) string { | ||
func (r *inputArgumentsHello) Hello(args struct{ Input *helloInput }) string { | ||
return "Hello " + args.Input.Name + "!" | ||
} | ||
|
||
func (r *inputArgumentsScalarMismatch1) Hello(name string) string { | ||
return "Hello " + name + "!" | ||
} | ||
|
||
func (r *inputArgumentsScalarMismatch2) Hello(args struct { World string }) string { | ||
func (r *inputArgumentsScalarMismatch2) Hello(args struct{ World string }) string { | ||
return "Hello " + args.World + "!" | ||
} | ||
|
||
func (r *inputArgumentsObjectMismatch1) Hello(in helloInput) string { | ||
return "Hello " + in.Name + "!" | ||
} | ||
|
||
func (r *inputArgumentsObjectMismatch2) Hello(args struct { Input *helloInputMismatch }) string { | ||
func (r *inputArgumentsObjectMismatch2) Hello(args struct{ Input *helloInputMismatch }) string { | ||
return "Hello " + args.Input.World + "!" | ||
} | ||
|
||
func (r *inputArgumentsObjectMismatch3) Hello(args struct { Input *struct { Thing string } }) string { | ||
func (r *inputArgumentsObjectMismatch3) Hello(args struct{ Input *struct{ Thing string } }) string { | ||
return "Hello " + args.Input.Thing + "!" | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters