Package 

Class SchemaGenerator

  • 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, mutaitons, 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-resouces block or another closable object as the internals can take up a lot of resources.

    • Method Summary

      Modifier and Type Method Description
      GraphQLSchema generateSchema(List<TopLevelObject> queries, List<TopLevelObject> mutations, List<TopLevelObject> subscriptions, Set<KType> additionalTypes, Set<KType> additionalInputTypes) 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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.