-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fragments support in GraphQlTester
This commit adds support for GraphQL fragments with `GraphQlTester`. Fragments allow to avoid repetition in GraphQL requests by reusing field selection sets. For example, the "releases" fragment can be reused in multiple queries and make the overall document shorter: ``` query frameworkReleases { project(slug: "spring-framework") { name ...releases } } query graphqlReleases { project(slug: "spring-graphql") { name ...releases } } fragment releases on Project { releases { version } } ``` With this change, `GraphQlTester` accepts fragments as `String` or can load them by their name using the configured `DocumentSource`, similarly to the document support. Closes gh-964
- Loading branch information
Showing
6 changed files
with
169 additions
and
3 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
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
3 changes: 3 additions & 0 deletions
3
spring-graphql-test/src/test/resources/graphql-test/friends.graphql
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fragment friendsField on User { | ||
friends | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{me {name, friends}} |