diff --git a/spring-graphql-docs/src/docs/asciidoc/index.adoc b/spring-graphql-docs/src/docs/asciidoc/index.adoc index efa2b407..b25d6bfe 100644 --- a/spring-graphql-docs/src/docs/asciidoc/index.adoc +++ b/spring-graphql-docs/src/docs/asciidoc/index.adoc @@ -264,38 +264,18 @@ For an example with Apollo Federation, see https://github.com/apollographql/federation-jvm-spring-example[federation-jvm-spring-example]. -[[execution.graphqlsource.schema-traversal]] -==== Schema Traversal - -You can register a `graphql.schema.GraphQLTypeVisitor` via -`builder.schemaResources(..).typeVisitors(..)` if you want to traverse the schema after -it is created, and possibly apply changes to the `GraphQLCodeRegistry`. Keep in mind, -however, that such a visitor cannot change the schema. See -<>, if you need to make changes to the schema. - - -[[execution.graphqlsource.schema-transformation]] -==== Schema Transformation - -You can register a `graphql.schema.GraphQLTypeVisitor` via -`builder.schemaResources(..).typeVisitorsToTransformSchema(..)` if you want to traverse -and transform the schema after it is created, and make changes to the schema. Keep in mind -that this is more expensive than <> so generally -prefer traversal to transformation unless you need to make schema changes. - - [[execution.graphqlsource.runtimewiring-configurer]] ==== `RuntimeWiringConfigurer` You can use `RuntimeWiringConfigurer` to register: - - Custom scalar types. - - Directives handling code. - - `TypeResolver`, if you need to override the - <> for a type. - - `DataFetcher` for a field, although most applications will simply configure - `AnnotatedControllerConfigurer`, which detects annotated, `DataFetcher` handler methods. - The <> adds the `AnnotatedControllerConfigurer` by default. +- Custom scalar types. +- <> handling code. +- Default <> for interface and union types. +- `DataFetcher` for a field although applications will typically use <>, and +those are detected and registered as `DataFetcher`s by `AnnotatedControllerConfigurer`, +which is a `RuntimeWiringConfigurer`. The <> automatically registers +`AnnotatedControllerConfigurer`. NOTE: GraphQL Java, server applications use Jackson only for serialization to and from maps of data. 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. [[execution.graphqlsource.default-type-resolver]] -==== Default `TypeResolver` +==== `TypeResolver` `GraphQlSource.Builder` registers `ClassNameTypeResolver` as the default `TypeResolver` to use for GraphQL Interfaces and Unions that don't already have such a registration @@ -359,33 +339,6 @@ builder.defaultTypeResolver(classNameTypeResolver); The <> explains how to configure that with Spring Boot. -[[execution.graphqlsource.operation-caching]] -==== Operation Caching - -GraphQL Java must _parse_ and _validate_ an operation before executing it. This may impact -performance significantly. To avoid the need to re-parse and validate, an application may -configure a `PreparsedDocumentProvider` that caches and reuses Document instances. The -{graphql-java-docs}/execution/#query-caching[GraphQL Java docs] provide more details on -query caching through a `PreparsedDocumentProvider`. - -In Spring GraphQL you can register a `PreparsedDocumentProvider` through -`GraphQlSource.Builder#configureGraphQl`: -. - -[source,java,indent=0,subs="verbatim,quotes"] ----- -// Typically, accessed through Spring Boot's GraphQlSourceBuilderCustomizer -GraphQlSource.Builder builder = ... - -// Create provider -PreparsedDocumentProvider provider = ... - -builder.schemaResources(..) - .configureRuntimeWiring(..) - .configureGraphQl(graphQLBuilder -> graphQLBuilder.preparsedDocumentProvider(provider)) ----- - -The <> explains how to configure that with Spring Boot. [[execution.graphqlsource.directives]] ==== Directives @@ -421,6 +374,55 @@ https://github.com/graphql-java/graphql-java-extended-validation[Extended Valida library. +[[execution.graphqlsource.schema-transformation]] +==== Schema Transformation + +You can register a `graphql.schema.GraphQLTypeVisitor` via +`builder.schemaResources(..).typeVisitorsToTransformSchema(..)` if you want to traverse +and transform the schema after it is created, and make changes to the schema. Keep in mind +that this is more expensive than <> so generally +prefer traversal to transformation unless you need to make schema changes. + + +[[execution.graphqlsource.schema-traversal]] +==== Schema Traversal + +You can register a `graphql.schema.GraphQLTypeVisitor` via +`builder.schemaResources(..).typeVisitors(..)` if you want to traverse the schema after +it is created, and possibly apply changes to the `GraphQLCodeRegistry`. Keep in mind, +however, that such a visitor cannot change the schema. See +<>, if you need to make changes to the schema. + + +[[execution.graphqlsource.operation-caching]] +==== Operation Caching + +GraphQL Java must _parse_ and _validate_ an operation before executing it. This may impact +performance significantly. To avoid the need to re-parse and validate, an application may +configure a `PreparsedDocumentProvider` that caches and reuses Document instances. The +{graphql-java-docs}/execution/#query-caching[GraphQL Java docs] provide more details on +query caching through a `PreparsedDocumentProvider`. + +In Spring GraphQL you can register a `PreparsedDocumentProvider` through +`GraphQlSource.Builder#configureGraphQl`: +. + +[source,java,indent=0,subs="verbatim,quotes"] +---- +// Typically, accessed through Spring Boot's GraphQlSourceBuilderCustomizer +GraphQlSource.Builder builder = ... + +// Create provider +PreparsedDocumentProvider provider = ... + +builder.schemaResources(..) + .configureRuntimeWiring(..) + .configureGraphQl(graphQLBuilder -> graphQLBuilder.preparsedDocumentProvider(provider)) +---- + +The <> explains how to configure that with Spring Boot. + + [[execution.reactive-datafetcher]] === Reactive `DataFetcher`