diff --git a/spring-graphql-docs/src/docs/asciidoc/index.adoc b/spring-graphql-docs/src/docs/asciidoc/index.adoc index 9b376295..387c16f7 100644 --- a/spring-graphql-docs/src/docs/asciidoc/index.adoc +++ b/spring-graphql-docs/src/docs/asciidoc/index.adoc @@ -179,6 +179,48 @@ support for <>, <>, and +[[execution-graphqlsource-schema-resources]] +==== Schema Resources + +`GraphQlSource.Builder` can be configured with one or more `Resource` instances to be +parsed and merged together. That means schema files can be loaded from just about any +location. By default, the Spring Boot starter <> +from a well-known classpath location, but you can change that to a location on the file system +via `FileSystemResource`, to byte content via `ByteArrayResource`, or implement a custom +`Resource` that loads schema files from a remote location or storage. + + +[[execution-graphqlsource-runtimewiring-configurer]] +==== `RuntimeWiringConfigurer` + +You can add a `RuntimeWiringConfigurer` to `GraphQlSource.Builder` to register: + + - custom scalar types. + - a `TypeResolver`, if you need to override the + <> for a type. + - a `DataFetcher` for a field, although most applications will simply configure + `AnnotatedControllerConfigurer`, which detects annotated, `DataFetcher` handler methods. + The Spring Boot starter adds the `AnnotatedControllerConfigurer` by default. + + +[[execution-graphqlsource-default-type-resolver]] +==== Default `TypeResolver` + +`GraphQlSource.Builder` registers `ClassNameTypeResolver` as the default `TypeResolver` +to use for GraphQL Interfaces and Unions that don't already have such a registration +through a <>. The purpose of +a `TypeResolver` in GraphQL Java is to determine the GraphQL Object type for values +returned from the `DataFetcher` for a GraphQL Interface or Union field. + +`ClassNameTypeResolver` tries to match the simple class name of the value to a GraphQL +Object Type and if it is not successful, it also navigates its super types including +base classes and interfaces, looking for a match. `ClassNameTypeResolver` provides an +option to configure a name extracting function along with `Class` to GraphQL Object type +name mappings that should help to cover more corner cases. + + + + [[execution-reactive-datafetcher]] === Reactive `DataFetcher`