graphql:graphql

Full name:

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

Description:

This goal is deprecated. The graphql goal generates the java code from one or more GraphQL schemas. It allows to work in Java with graphQL, in a schema first approach.

It will be maintained in the future 2.x versions. The generateClientCode and generateServerCode should be used instead.
The graphql goal has two main modes:
  • client mode: it does the same jobs as the generateClientCode goal. It generates a class for each query, mutation and subscription type. These classes contain the methods to call the queries, mutations and subscriptions. That is: to execute a query against the GraphQL server, you just have to call one of this method. It also generates the POJOs from the GraphQL schema. The GraphQL response is stored in these POJOs, for an easy and standard use in Java.
  • server mode: it does the same jobs as the generateServerCode goal. It generates the whole heart of the GraphQL server. The developer has only to develop request to the data. That is the main method (in a jar project) or the main server (in a war project), and all the Spring wiring, based on graphql-java-spring, itself being build on top of graphql-java. It also generates the POJOs. An option allows to annotate them with the standard JPA annotations, to make it easy to link with a database. This goal generates the interfaces for the DataFetchersDelegate (often named providers) that the server needs to implement

Attributes:

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

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.
<copyRuntimeSources> boolean -

Flag to enable copy sources for graphql-java-runtime library to target source code directory. It allows to control whether the runtime code is embedded in the generated code or not.

The default behavior is the old one, that is: the runtime code is embedded. This means that when you upgrade the plugin version, just build the project and everything is coherent.

If you set this parameter to false, the runtime is no more copied with the generated code. You then have to add the runtime dependency in the pom dependencies: it's the com.graphql-java-generator:graphql-java-runtime dependency, with the exact same version as the plugin version.

This also allows you to create your own runtime, and change the "standard" behavior. But of course, you'll have to check the compatibility with all the next versions.


Default value is: true.
User property is: com.graphql_java_generator.mavenplugin.copyRuntimeSources.
<customScalars> List -

This parameter contains the list of custom scalars implementations. One such implementation must be provided for each custom scalar defined in the GraphQL implemented by the project for its GraphQL schema. It's a list, where the key is the scalar name, as defined in the GraphQL schema, and the value is the full class name of the implementation of GraphQLScalarType.

This parameter is a list of customScalars. For each one, you must define the name, the javaType and exactly one of these fields: graphQLScalarTypeClass, graphQLScalarTypeStaticField or graphQLScalarTypeGetter.

Here is the detail:

  • graphQLTypeName: The type name, as defined in the GraphQL schema, for instance Date
  • javaType: The full class name for the java type that contains the data for this type, once in the Java code, for instance java.util.Date
  • graphQLScalarTypeClass: The full class name for the GraphQLScalarType that will manage this Custom Scalar. This class must be a subtype of GraphQLScalarType. Bu the constructor of GraphQLScalarType has been deprecated, so you'll find no sample for that in this project
  • graphQLScalarTypeStaticField: The full class name followed by the static field name that contains the GraphQLScalarType that will manage this Custom Scalar. For instance, the graphql-java package provides several custom scalars like graphql.Scalars.GraphQLLong. You can also use the graphql-java-extended-scalars project, that provides other custom scalars like graphql.scalars.ExtendedScalars.NonNegativeInt.
  • graphQLScalarTypeGetter: The full class name followed by the static method name that returns the GraphQLScalarType that will manage this Custom Scalar. For instance: org.mycompany.MyScalars.getGraphQLLong() or com.graphql_java_generator.customscalars.GraphQLScalarTypeDate. This call may contain parameters, provided that this a valid java command.

Please have a look at the allGraphQLCases (both client and server) samples for more information. The allGraphQLCases client pom is a good sample.


User property is: com.graphql_java_generator.mavenplugin.customScalars.
<generateBatchLoaderEnvironment> boolean -

(only for server mode) Indicates if the plugin should generate add the BatchLoaderEnvironment parameter to the batchLoader methods, in DataFetchersDelegate. This parameter allows to get the context of the Batch Loader, including the context associated to the id, when using the id has been added by the DataLoader.load() method.

For instance, if you have the method below, for a field named oneWithIdSubType in a DataFetcherDelegate:

@Override
public CompletableFuture<AllFieldCasesWithIdSubtype> oneWithIdSubType(
                DataFetchingEnvironment dataFetchingEnvironment, DataLoader<UUID, AllFieldCasesWithIdSubtype> dataLoader,
                AllFieldCases source, Boolean uppercase) {
        return dataLoader.load(UUID.randomUUID());
}

then, in the AllFieldCasesWithIdSubtype DataFetcherDelegate, you can retrieve the uppercase this way:

@Override
public List<AllFieldCasesWithIdSubtype> batchLoader(List<UUID> keys, BatchLoaderEnvironment environment) {
        List<AllFieldCasesWithIdSubtype> list = new ArrayList<>(keys.size());
        for (UUID id : keys) {
                // Let's manage the uppercase parameter, that was associated with this key
                Boolean uppercase = (Boolean) environment.getKeyContexts().get(id);
                if (uppercase != null && uppercase) {
                        item.setName(item.getName().toUpperCase());
                }

                // Do something with the id and the uppercase value
        }
        return list;
}

For more complex cases, you can store a Map with all the needed values, instead of just the parameter value.

Default value is false


Default value is: false.
User property is: com.graphql_java_generator.mavenplugin.generateBatchLoaderEnvironment.
<generateDataLoaderForLists> boolean -

(only for server mode) Defines how the methods in the data fetchers delegates are generated. The detailed information is available in the Wiki server page

When generateDataLoaderForLists is false (default mode), the data loaders are used only for fields that don't return a list. In other words, for fields which type is a sub-object with an id, two methods are generated: one which returns a CompletableFuture, and one which returns a none CompletableFuture result (that is used by the generated code only if no data loader is available).

When generateDataLoaderForLists is true, the above behavior is extended to fields that are a list.

Note: if set to true, this plugin parameter make the use of data loader mandatory for every field which type is a list of GraphQL objects, which have an id. This may not be suitable, for instance when your data is stored in a relational database, where you would need a first query to retrieve the ids and push them into the data loader, then another one to retrieve the associated values. If you want to use data loader for only some of particular fields, you should consider using the generateDataLoaderForLists. You'll find more information on the Wiki server page.

This parameter is available since version 1.18.4


Default value is: false.
User property is: com.graphql_java_generator.mavenplugin.generateDataLoaderForLists.
<generateDeprecatedRequestResponse> boolean -

Since 1.7.1 version

Generates a XxxxResponse class for each query/mutation/subscription, and (if separateUtilityClasses is true) Xxxx classes in the util subpackage. This allows to keep compatibility with code Developed with the 1.x versions of the plugin.

The best way to use the plugin is to directly use the Xxxx query/mutation/subscription classes, where Xxxx is the query/mutation/subscription name defined in the GraphQL schema.


Default value is: true.
User property is: com.graphql_java_generator.mavenplugin.generateDeprecatedRequestResponse.
<generateJPAAnnotation> boolean -

(only for server mode) Indicates whether the plugin should generate the JPA annotations, for generated objects.

Default value is false


Default value is: false.
User property is: com.graphql_java_generator.mavenplugin.generateJPAAnnotation.
<javaTypeForIDType> String -

The javaTypeForIDType is the java class that is used in the generated code for GraphQL fields that are of the GraphQL ID type. The default value is java.util.UUID. Valid values are: java.lang.String, java.lang.Long and java.util.UUID.

This parameter is only valid for the server mode. When generating the client code, the ID is always generated as a String type, as recommended in the GraphQL doc.

In other words: when in server mode and javaTypeForIDType is not set, all GraphQL ID fields are UUID attributes in java. When in server mode and javaTypeForIDType is set to the X type, all GraphQL ID fields are X attributes in java.

Note: you can override this, by using the schema personalization capability. For more information, please have a look at the Schema Personalization doc page.


Default value is: java.util.UUID.
User property is: com.graphql_java_generator.mavenplugin.javaTypeForIDType.
<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.
<mode> PluginMode - The generation mode: either client or server. Choose client to generate the code which can query a graphql server or server to generate a code for the server side.
Default value is: client.
User property is: com.graphql_java_generator.mavenplugin.mode.
<packageName> String - The package name that will contain the generated classes
Default value is: com.generated.graphql.
User property is: com.graphql_java_generator.mavenplugin.packageName.
<scanBasePackages> String -

(only for server mode) A comma separated list of package names, without double quotes, that will also be parsed by Spring, to discover Spring beans, Spring repositories and JPA entities when the server starts. You should use this parameter only for packages that are not subpackage of the package defined in the _packageName_ parameter and not subpackage of com.graphql_java_generator

This allows for instance, to set packageName to your.app.package.graphql, and to define your Spring beans, like the DataFetcherDelegates or your Spring data repositories in any other folder, by setting for instance scanBasePackages to your.app.package.impl, your.app.package.graphql, or just your.app.package


Default value is: null.
User property is: com.graphql_java_generator.mavenplugin.scanBasePackages.
<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.
<schemaPersonalizationFile> String -

schemaPersonalizationFile is the file name where the GraphQL maven plugin will find personalization that it must apply before generating the code. This applies to the server mode only. See the doc on the plugin web site for more details.

The standard file would be something like /src/main/graphql/schemaPersonalizationFile.json, which avoids to embed this compile time file within your maven artifact (as it is not in the /src/main/java nor in the /src/main/resources folders).


Default value is: null.
User property is: com.graphql_java_generator.mavenplugin.schemaPersonalizationFile.
<separateUtilityClasses> boolean -

Indicates whether the utility classes (that is: the classes that are not match an item in the GraphQL schema) are generated in the same package than the classes that matches the GraphQL schema.

That is: internal technical classes, java classes that contain the method to execute the queries/mutations/subscriptions, Jackson deserializer for custom scalars...

The default value is false, to maintain the previous behavior. In this case, all classes are generated in the packageName, or the default package if this parameter is not defined.

If true, the GraphQL classes are generated in the package defined in the packageName plugin parameter. And all the utility classes are generated in the util subpackage of this package.


Default value is: false.
User property is: com.graphql_java_generator.mavenplugin.separateUtilityClasses.
<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.
<sourceEncoding> String - The encoding charset for the generated source files
Default value is: UTF-8.
User property is: com.graphql_java_generator.mavenplugin.sourceEncoding.
<springBeanSuffix> String - Retrieves the suffix that will be applied to the name of the Spring Beans that are generated for this schema. It's mandatory if you' using a Spring app and have more than one GraphQL schemas. The default value is an empty String.
User property is: com.graphql_java_generator.mavenplugin.springBeanSuffix.
<targetResourceFolder> File - The folder where resources will be generated
Default value is: ./target/generated-resources/graphql-maven-plugin.
User property is: com.graphql_java_generator.mavenplugin.targetResourceFolder.
<targetSourceFolder> File - The folder where source code for the generated classes will be generated
Default value is: ./target/generated-sources/graphql-maven-plugin.
User property is: com.graphql_java_generator.mavenplugin.targetSourceFolder.
<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

<copyRuntimeSources>

Flag to enable copy sources for graphql-java-runtime library to target source code directory. It allows to control whether the runtime code is embedded in the generated code or not.

The default behavior is the old one, that is: the runtime code is embedded. This means that when you upgrade the plugin version, just build the project and everything is coherent.

If you set this parameter to false, the runtime is no more copied with the generated code. You then have to add the runtime dependency in the pom dependencies: it's the com.graphql-java-generator:graphql-java-runtime dependency, with the exact same version as the plugin version.

This also allows you to create your own runtime, and change the "standard" behavior. But of course, you'll have to check the compatibility with all the next versions.

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

<customScalars>

This parameter contains the list of custom scalars implementations. One such implementation must be provided for each custom scalar defined in the GraphQL implemented by the project for its GraphQL schema. It's a list, where the key is the scalar name, as defined in the GraphQL schema, and the value is the full class name of the implementation of GraphQLScalarType.

This parameter is a list of customScalars. For each one, you must define the name, the javaType and exactly one of these fields: graphQLScalarTypeClass, graphQLScalarTypeStaticField or graphQLScalarTypeGetter.

Here is the detail:

  • graphQLTypeName: The type name, as defined in the GraphQL schema, for instance Date
  • javaType: The full class name for the java type that contains the data for this type, once in the Java code, for instance java.util.Date
  • graphQLScalarTypeClass: The full class name for the GraphQLScalarType that will manage this Custom Scalar. This class must be a subtype of GraphQLScalarType. Bu the constructor of GraphQLScalarType has been deprecated, so you'll find no sample for that in this project
  • graphQLScalarTypeStaticField: The full class name followed by the static field name that contains the GraphQLScalarType that will manage this Custom Scalar. For instance, the graphql-java package provides several custom scalars like graphql.Scalars.GraphQLLong. You can also use the graphql-java-extended-scalars project, that provides other custom scalars like graphql.scalars.ExtendedScalars.NonNegativeInt.
  • graphQLScalarTypeGetter: The full class name followed by the static method name that returns the GraphQLScalarType that will manage this Custom Scalar. For instance: org.mycompany.MyScalars.getGraphQLLong() or com.graphql_java_generator.customscalars.GraphQLScalarTypeDate. This call may contain parameters, provided that this a valid java command.

Please have a look at the allGraphQLCases (both client and server) samples for more information. The allGraphQLCases client pom is a good sample.

  • Type: java.util.List
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.customScalars

<generateBatchLoaderEnvironment>

(only for server mode) Indicates if the plugin should generate add the BatchLoaderEnvironment parameter to the batchLoader methods, in DataFetchersDelegate. This parameter allows to get the context of the Batch Loader, including the context associated to the id, when using the id has been added by the DataLoader.load() method.

For instance, if you have the method below, for a field named oneWithIdSubType in a DataFetcherDelegate:

@Override
public CompletableFuture<AllFieldCasesWithIdSubtype> oneWithIdSubType(
                DataFetchingEnvironment dataFetchingEnvironment, DataLoader<UUID, AllFieldCasesWithIdSubtype> dataLoader,
                AllFieldCases source, Boolean uppercase) {
        return dataLoader.load(UUID.randomUUID());
}

then, in the AllFieldCasesWithIdSubtype DataFetcherDelegate, you can retrieve the uppercase this way:

@Override
public List<AllFieldCasesWithIdSubtype> batchLoader(List<UUID> keys, BatchLoaderEnvironment environment) {
        List<AllFieldCasesWithIdSubtype> list = new ArrayList<>(keys.size());
        for (UUID id : keys) {
                // Let's manage the uppercase parameter, that was associated with this key
                Boolean uppercase = (Boolean) environment.getKeyContexts().get(id);
                if (uppercase != null && uppercase) {
                        item.setName(item.getName().toUpperCase());
                }

                // Do something with the id and the uppercase value
        }
        return list;
}

For more complex cases, you can store a Map with all the needed values, instead of just the parameter value.

Default value is false

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

<generateDataLoaderForLists>

(only for server mode) Defines how the methods in the data fetchers delegates are generated. The detailed information is available in the Wiki server page

When generateDataLoaderForLists is false (default mode), the data loaders are used only for fields that don't return a list. In other words, for fields which type is a sub-object with an id, two methods are generated: one which returns a CompletableFuture, and one which returns a none CompletableFuture result (that is used by the generated code only if no data loader is available).

When generateDataLoaderForLists is true, the above behavior is extended to fields that are a list.

Note: if set to true, this plugin parameter make the use of data loader mandatory for every field which type is a list of GraphQL objects, which have an id. This may not be suitable, for instance when your data is stored in a relational database, where you would need a first query to retrieve the ids and push them into the data loader, then another one to retrieve the associated values. If you want to use data loader for only some of particular fields, you should consider using the generateDataLoaderForLists. You'll find more information on the Wiki server page.

This parameter is available since version 1.18.4

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

<generateDeprecatedRequestResponse>

Since 1.7.1 version

Generates a XxxxResponse class for each query/mutation/subscription, and (if separateUtilityClasses is true) Xxxx classes in the util subpackage. This allows to keep compatibility with code Developed with the 1.x versions of the plugin.

The best way to use the plugin is to directly use the Xxxx query/mutation/subscription classes, where Xxxx is the query/mutation/subscription name defined in the GraphQL schema.

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

<generateJPAAnnotation>

(only for server mode) Indicates whether the plugin should generate the JPA annotations, for generated objects.

Default value is false

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

<javaTypeForIDType>

The javaTypeForIDType is the java class that is used in the generated code for GraphQL fields that are of the GraphQL ID type. The default value is java.util.UUID. Valid values are: java.lang.String, java.lang.Long and java.util.UUID.

This parameter is only valid for the server mode. When generating the client code, the ID is always generated as a String type, as recommended in the GraphQL doc.

In other words: when in server mode and javaTypeForIDType is not set, all GraphQL ID fields are UUID attributes in java. When in server mode and javaTypeForIDType is set to the X type, all GraphQL ID fields are X attributes in java.

Note: you can override this, by using the schema personalization capability. For more information, please have a look at the Schema Personalization doc page.

  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.javaTypeForIDType
  • Default: java.util.UUID

<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

<mode>

The generation mode: either client or server. Choose client to generate the code which can query a graphql server or server to generate a code for the server side.
  • Type: com.graphql_java_generator.plugin.conf.PluginMode
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.mode
  • Default: client

<packageName>

The package name that will contain the generated classes
  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.packageName
  • Default: com.generated.graphql

<scanBasePackages>

(only for server mode) A comma separated list of package names, without double quotes, that will also be parsed by Spring, to discover Spring beans, Spring repositories and JPA entities when the server starts. You should use this parameter only for packages that are not subpackage of the package defined in the _packageName_ parameter and not subpackage of com.graphql_java_generator

This allows for instance, to set packageName to your.app.package.graphql, and to define your Spring beans, like the DataFetcherDelegates or your Spring data repositories in any other folder, by setting for instance scanBasePackages to your.app.package.impl, your.app.package.graphql, or just your.app.package

  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.scanBasePackages
  • Default: null

<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

<schemaPersonalizationFile>

schemaPersonalizationFile is the file name where the GraphQL maven plugin will find personalization that it must apply before generating the code. This applies to the server mode only. See the doc on the plugin web site for more details.

The standard file would be something like /src/main/graphql/schemaPersonalizationFile.json, which avoids to embed this compile time file within your maven artifact (as it is not in the /src/main/java nor in the /src/main/resources folders).

  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.schemaPersonalizationFile
  • Default: null

<separateUtilityClasses>

Indicates whether the utility classes (that is: the classes that are not match an item in the GraphQL schema) are generated in the same package than the classes that matches the GraphQL schema.

That is: internal technical classes, java classes that contain the method to execute the queries/mutations/subscriptions, Jackson deserializer for custom scalars...

The default value is false, to maintain the previous behavior. In this case, all classes are generated in the packageName, or the default package if this parameter is not defined.

If true, the GraphQL classes are generated in the package defined in the packageName plugin parameter. And all the utility classes are generated in the util subpackage of this package.

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

<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

<sourceEncoding>

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

<springBeanSuffix>

Retrieves the suffix that will be applied to the name of the Spring Beans that are generated for this schema. It's mandatory if you' using a Spring app and have more than one GraphQL schemas. The default value is an empty String.
  • Type: java.lang.String
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.springBeanSuffix

<targetResourceFolder>

The folder where resources will be generated
  • Type: java.io.File
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.targetResourceFolder
  • Default: ./target/generated-resources/graphql-maven-plugin

<targetSourceFolder>

The folder where source code for the generated classes will be generated
  • Type: java.io.File
  • Required: No
  • User Property: com.graphql_java_generator.mavenplugin.targetSourceFolder
  • Default: ./target/generated-sources/graphql-maven-plugin

<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