Class GenerateGraphQLSchemaTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.graphql_java_generator.gradleplugin.CommonTask
com.graphql_java_generator.gradleplugin.GenerateGraphQLSchemaTask
All Implemented Interfaces:
com.graphql_java_generator.plugin.conf.CommonConfiguration, com.graphql_java_generator.plugin.conf.GenerateGraphQLSchemaConfiguration, Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

public class GenerateGraphQLSchemaTask extends CommonTask implements com.graphql_java_generator.plugin.conf.GenerateGraphQLSchemaConfiguration

The generateGraphQLSchema goal generates GraphQL schema, based on the source GraphQL schemas, and possibly containing additional stuff, like the Relay connection objects.

It can be used to:
  • Generate several GraphQL schema files into one file, for instance with additional schema files that would use the extend GraphQL keyword
  • Reformat the schema file
  • Generate the GraphQL schema with the Relay Connection stuff (Node interface, XxxEdge and XxxConnection types), thanks to the addRelayConnections plugin parameter.

This goal is, by default, attached to the Initialize maven phase, to be sure that the GraphQL schema are generated before the code generation would need it, if relevant.

Note: The attribute have no default values: their default values is read from the GenerateCodeCommonExtension, whose attributes can be either the default value, or a value set in the build script.

  • Constructor Details

    • GenerateGraphQLSchemaTask

      @Inject public GenerateGraphQLSchemaTask(org.gradle.api.file.ProjectLayout projectLayout)
    • GenerateGraphQLSchemaTask

      public GenerateGraphQLSchemaTask(GenerateGraphQLSchemaExtension extension, org.gradle.api.file.ProjectLayout projectLayout)
  • Method Details

    • execute

      public void execute() throws IOException
      Throws:
      IOException
    • getResourceEncoding

      @Input public String getResourceEncoding()
      Specified by:
      getResourceEncoding in interface com.graphql_java_generator.plugin.conf.GenerateGraphQLSchemaConfiguration
    • setResourceEncoding

      public String setResourceEncoding(String resourceEncoding)
    • getTargetFolder

      @InputDirectory public File getTargetFolder()
      Specified by:
      getTargetFolder in interface com.graphql_java_generator.plugin.conf.GenerateGraphQLSchemaConfiguration
    • setTargetFolder

      public void setTargetFolder(String targetFolder)
      Parameters:
      targetFolder - A folder, relative to the project dir (not the the build dir)
    • getTargetSchemaFileName

      @Input public String getTargetSchemaFileName()
      Specified by:
      getTargetSchemaFileName in interface com.graphql_java_generator.plugin.conf.GenerateGraphQLSchemaConfiguration
    • setTargetSchemaFileName

      public void setTargetSchemaFileName(String targetSchemaFileName)
    • getExtension

      protected GenerateGraphQLSchemaExtension getExtension()
      Overrides:
      getExtension in class CommonTask
    • isGenerateJacksonAnnotations

      @Internal public boolean isGenerateJacksonAnnotations()
      Specified by:
      isGenerateJacksonAnnotations in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
      Overrides:
      isGenerateJacksonAnnotations in class CommonTask