graphql:generateGraphQLSchema

Full name:

com.graphql-java-generator:graphql-maven-plugin:1.18.7:generateGraphQLSchema

Description:

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.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: initialize.

Optional Parameters

Name Type Since Description
<addRelayConnections> boolean -

True if the plugin is configured to add the Relay connection capabilities to the field marked by the @RelayConnection directive.

If so, the plugin reads the provided GraphQL schema file(s), and enriches them with the interfaces and types needed to respect the Relay Connection specification. The entry point for that is the @RelayConnection directive.

You'll find all the information on the plugin web site. Please check the server Relay capability page.


Default value is: false.
User property is: com.graphql_java_generator.mavenplugin.addRelayConnections.
<maxTokens> Integer - (Useless, since 1.18.7)Defines the options that maximum number of tokens that the GraphQL schema parser may read. The default value is Integer.MAX_VALUE (=2147483647). If the schema contains more than maxTokens, the build will fail with an error.
Default value is: 2147483647.
User property is: com.graphql_java_generator.mavenplugin.maxTokens.
<resourceEncoding> String - The encoding for the generated resource files
Default value is: UTF-8.
User property is: com.graphql_java_generator.mavenplugin.resourceEncoding.
<schemaFileFolder> File - The folder where the graphql schema file(s) will be searched. The default schema is the main resource folder.
Default value is: src/main/resources.
User property is: com.graphql_java_generator.mavenplugin.schemaFileFolder.
<schemaFilePattern> String -

The pattern to find the graphql schema file(s). The default value is "/*.graphqls" meaning that the maven plugin will search all graphqls files in the "/src/main/resources" folder (please check also the schemaFileFolder plugin parameter).

You can put the star (*) joker in the filename, to retrieve several files at ones, for instance /myschema*.graphqls will retrieve the /src/main/resources/myschema.graphqls and /src/main/resources/myschema_extend.graphqls files.


Default value is: *.graphqls.
User property is: com.graphql_java_generator.mavenplugin.schemaFilePattern.
<skipGenerationIfSchemaHasNotChanged> boolean -

This parameter is now deprecated: it's value used in the plugin is always true, that is: if the generated sources or resources are older than the GraphQL schema file(s), then there is no source or resource generation. In clear, the source and resource generation is executed only if the provided input (GraphQL schema...) has been updated since the last plugin execution.


Default value is: true.
User property is: com.graphql_java_generator.mavenplugin.skipGenerationIfSchemaHasNotChanged.
<targetFolder> File - The folder where the generated GraphQL schema will be stored
Default value is: /generated-resources/graphql-maven-plugin_generate-relay-schema.
User property is: com.graphql_java_generator.mavenplugin.targetFolder.
<targetSchemaFileName> String - The name of the target filename, in which the schema is generated. This file is stored in the folder, defined in the targetFolder plugin parameter.
Default value is: generated_schema.graphqls.
User property is: com.graphql_java_generator.mavenplugin.targetSchemaFileName.
<templates> Map -

Map of the code templates to be used: this allows to override the default templates, and control exactly what code is generated by the plugin.

You can override any of the Velocity templates of the project. The list of templates is defined in the enum CodeTemplate, that you can check here.

You can find a sample in the CustomTemplates client sample.

Important notice: Please note that the default templates may change in the future. And some of these modifications would need to be reported into the custom templates. We'll try to better expose a stable public API in the future.


User property is: com.graphql_java_generator.mavenplugin.templates.

Parameter Details

<addRelayConnections>

True if the plugin is configured to add the Relay connection capabilities to the field marked by the @RelayConnection directive.

If so, the plugin reads the provided GraphQL schema file(s), and enriches them with the interfaces and types needed to respect the Relay Connection specification. The entry point for that is the @RelayConnection directive.

You'll find all the information on the plugin web site. Please check the server Relay capability page.

  • Type: boolean
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.addRelayConnections
  • Default: false

<maxTokens>

(Useless, since 1.18.7)Defines the options that maximum number of tokens that the GraphQL schema parser may read. The default value is Integer.MAX_VALUE (=2147483647). If the schema contains more than maxTokens, the build will fail with an error.
  • Type: java.lang.Integer
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.maxTokens
  • Default: 2147483647

<resourceEncoding>

The encoding for the generated resource files
  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.resourceEncoding
  • Default: UTF-8

<schemaFileFolder>

The folder where the graphql schema file(s) will be searched. The default schema is the main resource folder.
  • Type: java.io.File
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.schemaFileFolder
  • Default: src/main/resources

<schemaFilePattern>

The pattern to find the graphql schema file(s). The default value is "/*.graphqls" meaning that the maven plugin will search all graphqls files in the "/src/main/resources" folder (please check also the schemaFileFolder plugin parameter).

You can put the star (*) joker in the filename, to retrieve several files at ones, for instance /myschema*.graphqls will retrieve the /src/main/resources/myschema.graphqls and /src/main/resources/myschema_extend.graphqls files.

  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.schemaFilePattern
  • Default: *.graphqls

<skipGenerationIfSchemaHasNotChanged>

This parameter is now deprecated: it's value used in the plugin is always true, that is: if the generated sources or resources are older than the GraphQL schema file(s), then there is no source or resource generation. In clear, the source and resource generation is executed only if the provided input (GraphQL schema...) has been updated since the last plugin execution.

  • Type: boolean
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.skipGenerationIfSchemaHasNotChanged
  • Default: true

<targetFolder>

The folder where the generated GraphQL schema will be stored
  • Type: java.io.File
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.targetFolder
  • Default: /generated-resources/graphql-maven-plugin_generate-relay-schema

<targetSchemaFileName>

The name of the target filename, in which the schema is generated. This file is stored in the folder, defined in the targetFolder plugin parameter.
  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.targetSchemaFileName
  • Default: generated_schema.graphqls

<templates>

Map of the code templates to be used: this allows to override the default templates, and control exactly what code is generated by the plugin.

You can override any of the Velocity templates of the project. The list of templates is defined in the enum CodeTemplate, that you can check here.

You can find a sample in the CustomTemplates client sample.

Important notice: Please note that the default templates may change in the future. And some of these modifications would need to be reported into the custom templates. We'll try to better expose a stable public API in the future.

  • Type: java.util.Map
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.templates