-
- All Implemented Interfaces:
-
java.io.Closeable
,java.lang.AutoCloseable
public class SchemaGenerator implements Closeable
Generate a schema object given some configuration and top level objects for the queries, mutations, and subscriptions.
This class maintains the state of the schema while generation is taking place. It is passed into the internal functions, so they can use the cache and add additional types and directives into the schema as they parse the Kotlin code.
This class should be used from a try-with-resources block or another closable object as the internals can take up a lot of resources.
-
-
Constructor Summary
Constructors Constructor Description SchemaGenerator(SchemaGeneratorConfig config)
-
Method Summary
Modifier and Type Method Description GraphQLSchema
generateSchema(List<TopLevelObject> queries, List<TopLevelObject> mutations, List<TopLevelObject> subscriptions, Set<KType> additionalTypes, Set<KType> additionalInputTypes, TopLevelObject schemaObject)
Generate a schema given a list of objects to parse for the queries, mutations, and subscriptions. Unit
close()
Clear the generator type cache, reflection scan, additional types, and the saved directives. -
-
Constructor Detail
-
SchemaGenerator
SchemaGenerator(SchemaGeneratorConfig config)
-
-
Method Detail
-
generateSchema
GraphQLSchema generateSchema(List<TopLevelObject> queries, List<TopLevelObject> mutations, List<TopLevelObject> subscriptions, Set<KType> additionalTypes, Set<KType> additionalInputTypes, TopLevelObject schemaObject)
Generate a schema given a list of objects to parse for the queries, mutations, and subscriptions.
-
close
Unit close()
Clear the generator type cache, reflection scan, additional types, and the saved directives. You may want call this after you have called generateSchema and performed some other actions which is why we have a separate method to explicitly clear.
If you use the built in com.expediagroup.graphql.generator.toSchema, we will handle clean up of resources for you.
-
-
-
-