From 0343ad96058bf32535291f44066b3b1cb811d59c Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Tue, 18 Jan 2022 12:30:30 +0000 Subject: [PATCH] Update docs with section on Schema Creation Closes gh-226 --- .../src/docs/asciidoc/index.adoc | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/spring-graphql-docs/src/docs/asciidoc/index.adoc b/spring-graphql-docs/src/docs/asciidoc/index.adoc index 92f61133..9c0ccd75 100644 --- a/spring-graphql-docs/src/docs/asciidoc/index.adoc +++ b/spring-graphql-docs/src/docs/asciidoc/index.adoc @@ -188,7 +188,6 @@ support for <>, <>, and <>. - [[execution-graphqlsource-schema-resources]] ==== Schema Resources @@ -200,6 +199,27 @@ via `FileSystemResource`, to byte content via `ByteArrayResource`, or implement `Resource` that loads schema files from a remote location or storage. +[[execution-graphqlsource-schema-creation]] +==== Schema Creation + +By default, `GraphQlSource.Builder` uses the GraphQL Java `GraphQLSchemaGenerator` to +create the `graphql.schema.GraphQLSchema`. This works for most applications, but if +necessary, you can hook into the schema creation through the builder: + +[source,java,indent=0,subs="verbatim,quotes"] +---- +GraphQlSource graphQlSource = GraphQlSource.builder() + .schemaResources(..) + .configureRuntimeWiring(..) + .schemaFactory((typeDefinitionRegistry, runtimeWiring) -> { + // create `GraphQLSchema` + }) + .build(); +---- + +The primary reason for this is to create the schema through a federation library. + + [[execution-graphqlsource-runtimewiring-configurer]] ==== `RuntimeWiringConfigurer`