Code generated by the Graphql Maven Plugin is generated applying a set of Velocity templates to the input GraphQL Schmea. Templates are located in the project at graphql-maven-plugin-logic/src/main/resources/templates
If for any reason you may need to customize the template to modify the generated code this can be done by using the plugin parameter templates
Here there's an example of plugin configuration to use customized templates
<project ...> ... <build> <plugins> ... <plugin> <groupId>com.graphql-java-generator</groupId> <artifactId>graphql-maven-plugin</artifactId> <version>1.12.3</version> <executions> <execution> <goals> <goal>graphql</goal> </goals> </execution> </executions> <configuration> <mode>client</mode> <templates> <QUERY_MUTATION>classpath/entry/to/customtemplate.java.vm</QUERY_MUTATION> </templates> </configuration> <dependencies> <!-- Dependency containing your templates--> <dependency> <groupId>...</groupId> <artifactId>...</artifactId> <version>...</version> </dependency> </dependencies> </plugin> </plugins> </build> ... </project>
templates param is a map where the key is the ID of the template to customize and the value is a classpath entry to the resources containing the customized template
Customize templates shall be provided in a dependency configured in the plugin
Both client and server templates can be customized.
The available template IDs that can be configured for customization are:
Available on the project there is an example of this behavior: