graphql:generateGraphQLSchema
Full name:
com.graphql-java-generator:graphql-maven-plugin:2.8: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.
- The goal is thread-safe and supports parallel builds.
- 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 . |
<enumPrefix> |
String |
- |
An optional prefix to add to the classnames of the generated java classes for GraphQL enums. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.enumPrefix . |
<enumSuffix> |
String |
- |
An optional suffix to add to the classnames of the generated java classes for GraphQL enums. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.enumSuffix . |
<inputPrefix> |
String |
- |
An optional prefix to add to the classnames of the generated java classes for GraphQL input objects. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.inputPrefix . |
<inputSuffix> |
String |
- |
An optional suffix to add to the classnames of the generated java classes for GraphQL input objects. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.javaClassSuffix . |
<interfacePrefix> |
String |
- |
An optional prefix to add to the classnames of the generated java classes for GraphQL interfaces. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.interfacePrefix . |
<interfaceSuffix> |
String |
- |
An optional suffix to add to the classnames of the generated java classes for GraphQL interfaces. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.interfaceSuffix . |
<jsonGraphqlSchemaFilename> |
String |
- |
(no description) User property is: com.graphql_java_generator.mavenplugin.jsonGraphqlSchemaFilename . |
<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 which contains the GraphQL schema file(s) , typically Caution: this default value for this folder is 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<String,String> |
- |
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 . |
<typePrefix> |
String |
- |
An optional prefix to add to the classnames of the generated java classes for GraphQL types. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.typePrefix . |
<typeSuffix> |
String |
- |
An optional suffix to add to the classnames of the generated java classes for GraphQL types. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.typeSuffix . |
<unionPrefix> |
String |
- |
An optional prefix to add to the classnames of the generated java classes for GraphQL unions. The prefix is added at the beginning of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.unionPrefix . |
<unionSuffix> |
String |
- |
An optional suffix to add to the classnames of the generated java classes for GraphQL unions. The suffix is added at the end of the java classname, and must be compatible with java naming rules (no space, dot, comma, etc.) User property is: com.graphql_java_generator.mavenplugin.unionSuffix . |
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
<enumPrefix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.enumPrefix
<enumSuffix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.enumSuffix
<inputPrefix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.inputPrefix
<inputSuffix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.javaClassSuffix
<interfacePrefix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.interfacePrefix
<interfaceSuffix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.interfaceSuffix
<jsonGraphqlSchemaFilename>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.jsonGraphqlSchemaFilename
<maxTokens>
- Type:
java.lang.Integer
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.maxTokens
- Default:
2147483647
<resourceEncoding>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.resourceEncoding
- Default:
UTF-8
<schemaFileFolder>
The folder which contains the GraphQL schema file(s) , typically /src/main/resources
of the current project. That's where the GraphQL schema(s) are expected to be: in this folder, or one of these subfolders. If the jsonSchemaFilename
is set, then this parameter controls where this json schema file is.
Caution: this default value for this folder is /src/main/resources
, for compatibility with first versions of this plugin. It's different from the spring-graphql default one, which is /src/main/resources/graphql
- 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>
- Type:
java.io.File
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.targetFolder
- Default:
/generated-resources/graphql-maven-plugin_generate-relay-schema
<targetSchemaFileName>
- 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<java.lang.String, java.lang.String>
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.templates
<typePrefix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.typePrefix
<typeSuffix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.typeSuffix
<unionPrefix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.unionPrefix
<unionSuffix>
- Type:
java.lang.String
- Required:
No
- User Property:
com.graphql_java_generator.mavenplugin.unionSuffix