Skip to content

Commit 0b491b9

Browse files
committed
Polishing docs
1 parent 38f1eab commit 0b491b9

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

spring-graphql-docs/modules/ROOT/pages/request-execution.adoc

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ locations, e.g. across multiple modules.
6767

6868
By default, `GraphQlSource.Builder` uses the GraphQL Java `SchemaGenerator` to create the
6969
`graphql.schema.GraphQLSchema`. This works for typical use, but if you need to use a
70-
different generator, e.g. for xref:federation.adoc[federation], you can register a
71-
`schemaFactory` callback:
70+
different generator, you can register a `schemaFactory` callback:
7271

7372
[source,java,indent=0,subs="verbatim,quotes"]
7473
----
@@ -81,24 +80,24 @@ builder.schemaResources(..)
8180
})
8281
----
8382

84-
The xref:request-execution.adoc#execution.graphqlsource[GraphQlSource section] explains how to configure that with Spring Boot.
83+
See the xref:request-execution.adoc#execution.graphqlsource[GraphQlSource] section for how to configure this with Spring Boot.
8584

86-
For an example with Apollo Federation, see
87-
https://github.com/apollographql/federation-jvm-spring-example[federation-jvm-spring-example].
85+
If interested in federation, please see the xref:federation.adoc[Federation] section.
8886

8987

9088
[[execution.graphqlsource.runtimewiring-configurer]]
9189
=== `RuntimeWiringConfigurer`
9290

93-
You can use `RuntimeWiringConfigurer` to register:
91+
A `RuntimeWiringConfigurer` is useful to register the following:
9492

9593
- Custom scalar types.
96-
- xref:request-execution.adoc#execution.graphqlsource.directives[Directives] handling code.
97-
- Default xref:request-execution.adoc#execution.graphqlsource.default-type-resolver[`TypeResolver`] for interface and union types.
98-
- `DataFetcher` for a field although applications will typically use xref:controllers.adoc[Annotated Controllers], and
99-
those are detected and registered as ``DataFetcher``s by `AnnotatedControllerConfigurer`,
100-
which is a `RuntimeWiringConfigurer`. The xref:boot-starter.adoc[Boot Starter] automatically registers
101-
`AnnotatedControllerConfigurer`.
94+
- Code that handles xref:request-execution.adoc#execution.graphqlsource.directives[Directives].
95+
- Direct `DataFetcher` registrations.
96+
- and more...
97+
98+
TIP: Spring applications typically do not need to perform direct `DataFetcher` registrations.
99+
Instead, controller method are registered as ``DataFetcher``s via
100+
`AnnotatedControllerConfigurer`, which is a `RuntimeWiringConfigurer`.
102101

103102
NOTE: GraphQL Java, server applications use Jackson only for serialization to and from maps of data.
104103
Client input is parsed into a map. Server output is assembled into a map based on the field selection set.
@@ -116,15 +115,11 @@ public class GraphQlConfig {
116115
117116
@Bean
118117
public RuntimeWiringConfigurer runtimeWiringConfigurer(BookRepository repository) {
119-
120118
GraphQLScalarType scalarType = ... ;
121119
SchemaDirectiveWiring directiveWiring = ... ;
122-
DataFetcher dataFetcher = QuerydslDataFetcher.builder(repository).single();
123-
124120
return wiringBuilder -> wiringBuilder
125121
.scalar(scalarType)
126-
.directiveWiring(directiveWiring)
127-
.type("Query", builder -> builder.dataFetcher("book", dataFetcher));
122+
.directiveWiring(directiveWiring);
128123
}
129124
}
130125
----
@@ -160,7 +155,7 @@ classNameTypeResolver.setClassNameExtractor((klass) -> {
160155
builder.defaultTypeResolver(classNameTypeResolver);
161156
----
162157

163-
The xref:request-execution.adoc#execution.graphqlsource[GraphQlSource section] explains how to configure that with Spring Boot.
158+
See the xref:request-execution.adoc#execution.graphqlsource[GraphQlSource] section for how to configure this with Spring Boot.
164159

165160

166161
[[execution.graphqlsource.directives]]
@@ -342,7 +337,7 @@ builder.schemaResources(..)
342337
.configureGraphQl(graphQLBuilder -> graphQLBuilder.preparsedDocumentProvider(provider))
343338
----
344339

345-
The xref:request-execution.adoc#execution.graphqlsource[GraphQlSource section] explains how to configure that with Spring Boot.
340+
See the xref:request-execution.adoc#execution.graphqlsource[GraphQlSource] section for how to configure this with Spring Boot.
346341

347342

348343

0 commit comments

Comments
 (0)