@@ -264,38 +264,18 @@ For an example with Apollo Federation, see
264
264
https://github.com/apollographql/federation-jvm-spring-example[federation-jvm-spring-example].
265
265
266
266
267
- [[execution.graphqlsource.schema-traversal]]
268
- ==== Schema Traversal
269
-
270
- You can register a `graphql.schema.GraphQLTypeVisitor` via
271
- `builder.schemaResources(..).typeVisitors(..)` if you want to traverse the schema after
272
- it is created, and possibly apply changes to the `GraphQLCodeRegistry`. Keep in mind,
273
- however, that such a visitor cannot change the schema. See
274
- <<execution.graphqlsource.schema-transformation>>, if you need to make changes to the schema.
275
-
276
-
277
- [[execution.graphqlsource.schema-transformation]]
278
- ==== Schema Transformation
279
-
280
- You can register a `graphql.schema.GraphQLTypeVisitor` via
281
- `builder.schemaResources(..).typeVisitorsToTransformSchema(..)` if you want to traverse
282
- and transform the schema after it is created, and make changes to the schema. Keep in mind
283
- that this is more expensive than <<execution.graphqlsource.schema-traversal>> so generally
284
- prefer traversal to transformation unless you need to make schema changes.
285
-
286
-
287
267
[[execution.graphqlsource.runtimewiring-configurer]]
288
268
==== `RuntimeWiringConfigurer`
289
269
290
270
You can use `RuntimeWiringConfigurer` to register:
291
271
292
- - Custom scalar types.
293
- - Directives handling code.
294
- - `TypeResolver`, if you need to override the
295
- <<execution.graphqlsource.default-type-resolver>> for a type.
296
- - `DataFetcher` for a field, although most applications will simply configure
297
- `AnnotatedControllerConfigurer`, which detects annotated, `DataFetcher` handler methods.
298
- The <<boot-starter>> adds the `AnnotatedControllerConfigurer` by default .
272
+ - Custom scalar types.
273
+ - <<execution.graphqlsource.directives>> handling code.
274
+ - Default <<execution.graphqlsource.default-type-resolver>> for interface and union types.
275
+ - `DataFetcher` for a field although applications will typically use <<controllers>>, and
276
+ those are detected and registered as `DataFetcher`s by `AnnotatedControllerConfigurer`,
277
+ which is a `RuntimeWiringConfigurer`. The <<boot-starter>> automatically registers
278
+ `AnnotatedControllerConfigurer`.
299
279
300
280
NOTE: GraphQL Java, server applications use Jackson only for serialization to and from maps of data.
301
281
Client input is parsed into a map. Server output is assembled into a map based on the field selection set.
@@ -333,7 +313,7 @@ number of factories that are then invoked in sequence.
333
313
334
314
335
315
[[execution.graphqlsource.default-type-resolver]]
336
- ==== Default `TypeResolver`
316
+ ==== `TypeResolver`
337
317
338
318
`GraphQlSource.Builder` registers `ClassNameTypeResolver` as the default `TypeResolver`
339
319
to use for GraphQL Interfaces and Unions that don't already have such a registration
@@ -359,33 +339,6 @@ builder.defaultTypeResolver(classNameTypeResolver);
359
339
360
340
The <<execution.graphqlsource, GraphQlSource section>> explains how to configure that with Spring Boot.
361
341
362
- [[execution.graphqlsource.operation-caching]]
363
- ==== Operation Caching
364
-
365
- GraphQL Java must _parse_ and _validate_ an operation before executing it. This may impact
366
- performance significantly. To avoid the need to re-parse and validate, an application may
367
- configure a `PreparsedDocumentProvider` that caches and reuses Document instances. The
368
- {graphql-java-docs}/execution/#query-caching[GraphQL Java docs] provide more details on
369
- query caching through a `PreparsedDocumentProvider`.
370
-
371
- In Spring GraphQL you can register a `PreparsedDocumentProvider` through
372
- `GraphQlSource.Builder#configureGraphQl`:
373
- .
374
-
375
- [source,java,indent=0,subs="verbatim,quotes"]
376
- ----
377
- // Typically, accessed through Spring Boot's GraphQlSourceBuilderCustomizer
378
- GraphQlSource.Builder builder = ...
379
-
380
- // Create provider
381
- PreparsedDocumentProvider provider = ...
382
-
383
- builder.schemaResources(..)
384
- .configureRuntimeWiring(..)
385
- .configureGraphQl(graphQLBuilder -> graphQLBuilder.preparsedDocumentProvider(provider))
386
- ----
387
-
388
- The <<execution.graphqlsource, GraphQlSource section>> explains how to configure that with Spring Boot.
389
342
390
343
[[execution.graphqlsource.directives]]
391
344
==== Directives
@@ -421,6 +374,55 @@ https://github.com/graphql-java/graphql-java-extended-validation[Extended Valida
421
374
library.
422
375
423
376
377
+ [[execution.graphqlsource.schema-transformation]]
378
+ ==== Schema Transformation
379
+
380
+ You can register a `graphql.schema.GraphQLTypeVisitor` via
381
+ `builder.schemaResources(..).typeVisitorsToTransformSchema(..)` if you want to traverse
382
+ and transform the schema after it is created, and make changes to the schema. Keep in mind
383
+ that this is more expensive than <<execution.graphqlsource.schema-traversal>> so generally
384
+ prefer traversal to transformation unless you need to make schema changes.
385
+
386
+
387
+ [[execution.graphqlsource.schema-traversal]]
388
+ ==== Schema Traversal
389
+
390
+ You can register a `graphql.schema.GraphQLTypeVisitor` via
391
+ `builder.schemaResources(..).typeVisitors(..)` if you want to traverse the schema after
392
+ it is created, and possibly apply changes to the `GraphQLCodeRegistry`. Keep in mind,
393
+ however, that such a visitor cannot change the schema. See
394
+ <<execution.graphqlsource.schema-transformation>>, if you need to make changes to the schema.
395
+
396
+
397
+ [[execution.graphqlsource.operation-caching]]
398
+ ==== Operation Caching
399
+
400
+ GraphQL Java must _parse_ and _validate_ an operation before executing it. This may impact
401
+ performance significantly. To avoid the need to re-parse and validate, an application may
402
+ configure a `PreparsedDocumentProvider` that caches and reuses Document instances. The
403
+ {graphql-java-docs}/execution/#query-caching[GraphQL Java docs] provide more details on
404
+ query caching through a `PreparsedDocumentProvider`.
405
+
406
+ In Spring GraphQL you can register a `PreparsedDocumentProvider` through
407
+ `GraphQlSource.Builder#configureGraphQl`:
408
+ .
409
+
410
+ [source,java,indent=0,subs="verbatim,quotes"]
411
+ ----
412
+ // Typically, accessed through Spring Boot's GraphQlSourceBuilderCustomizer
413
+ GraphQlSource.Builder builder = ...
414
+
415
+ // Create provider
416
+ PreparsedDocumentProvider provider = ...
417
+
418
+ builder.schemaResources(..)
419
+ .configureRuntimeWiring(..)
420
+ .configureGraphQl(graphQLBuilder -> graphQLBuilder.preparsedDocumentProvider(provider))
421
+ ----
422
+
423
+ The <<execution.graphqlsource, GraphQlSource section>> explains how to configure that with Spring Boot.
424
+
425
+
424
426
425
427
[[execution.reactive-datafetcher]]
426
428
=== Reactive `DataFetcher`
0 commit comments