Interface CommonConfiguration
- All Known Subinterfaces:
GenerateClientCodeConfiguration
,GenerateCodeCommonConfiguration
,GenerateGraphQLSchemaConfiguration
,GeneratePojoConfiguration
,GenerateServerCodeConfiguration
,GraphQLConfiguration
All these methods are directly the property names, to map against a Spring
Configuration
that defines the
Bean
s. These beans can then be reused in Spring Component, thank to Spring IoC and its dependency injection
capability.- Author:
- etienne-sf
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
The default name of the target filename.
This method must be accessible by the Velocity engine.An optional prefix to add to the classnames of the generated java classes for GraphQL enums.An optional suffix to add to the classnames of the generated java classes for GraphQL enums.An optional prefix to add to the classnames of the generated java classes for GraphQL input objects.An optional suffix to add to the classnames of the generated java classes for GraphQL input objects.An optional prefix to add to the classnames of the generated java classes for GraphQL interfaces.An optional suffix to add to the classnames of the generated java classes for GraphQL interfaces.If defined, the plugin loads the GraphQL schema from this json file.(Useless, since 1.18.7)Defines the options that maximum number of tokens that the GraphQL schema parser may read.Get theFile
for the current project's directory.The folder which contains the GraphQL schema file(s) , typically/src/main/resources
of the current project.The pattern to find the graphql schema file(s).default String
Returns the folder in the classpath that should contain the GraphQL schema.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.An optional prefix to add to the classnames of the generated java classes for GraphQL types.An optional suffix to add to the classnames of the generated java classes for GraphQL types.An optional prefix to add to the classnames of the generated java classes for GraphQL unions.An optional suffix to add to the classnames of the generated java classes for GraphQL unions.boolean
True if the plugin is configured to add the Relay connection capabilities to the field marked by the @RelayConnection directive.default boolean
This method is used only inGeneratePojoConfiguration
.boolean
Deprecated.default void
Logs all the common configuration parameters (only when in the debug level)void
Logs all the configuration parameters (only when in the debug level)
-
Field Details
-
DEFAULT_ADD_RELAY_CONNECTIONS
- See Also:
-
DEFAULT_JSON_GRAPHQL_SCHEMA_FILE
- See Also:
-
DEFAULT_MAX_TOKENS
- See Also:
-
DEFAULT_PACKAGE_NAME
- See Also:
-
DEFAULT_PREFIX
- See Also:
-
DEFAULT_SCHEMA_FILE_FOLDER
- See Also:
-
DEFAULT_SCHEMA_FILE_PATTERN
- See Also:
-
DEFAULT_SCHEMA_SUB_FOLDER
- See Also:
-
DEFAULT_SKIP_GENERATION_IF_SCHEMA_HAS_NOT_CHANGED
- See Also:
-
DEFAULT_SUFFIX
- See Also:
-
-
Method Details
-
getEnumPrefix
String getEnumPrefix()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.) -
getEnumSuffix
String getEnumSuffix()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.) -
getInputPrefix
String getInputPrefix()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.) -
getInputSuffix
String getInputSuffix()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.) -
getInterfacePrefix
String getInterfacePrefix()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.) -
getInterfaceSuffix
String getInterfaceSuffix()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.) -
getJsonGraphqlSchemaFilename
String getJsonGraphqlSchemaFilename()If defined, the plugin loads the GraphQL schema from this json file. This allows to generate the code from the result of a GraphQL introspection query executed against an existing GraphQL server, for instance if you don't have its GraphQL schema file.
This json file should have been retrieved by the full introspection query. You can find the introspection query from the
getIntrospectionQuery
of the graphql-js or from this graphql-java class. You then have to run it against the GraphQL server, and store the response into a schema.json file.- Returns:
-
getMaxTokens
Integer getMaxTokens()(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.- Returns:
-
getProjectDir
File getProjectDir()Get theFile
for the current project's directory. This allows to compute the full path of file that are within this project (like custom templates for instance)- Returns:
-
getSchemaFileFolder
File getSchemaFileFolder()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 thejsonSchemaFilename
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 -
getSchemaFilePattern
String getSchemaFilePattern()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.
-
getTargetSchemaSubFolder
Returns the folder in the classpath that should contain the GraphQL schema. The default is the default for spring-graphql, that is: graphql.
- Returns:
-
getTemplates
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.
-
isAddRelayConnections
boolean isAddRelayConnections()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 <A HREF="https://graphql-maven-plugin-project.graphql-java-generator.com/client_add_relay_connection.html>client Relay capability page or the <A HREF="https://graphql-maven-plugin-project.graphql-java-generator.com/server_add_relay_connection.html>server Relay capability page.
-
getTypePrefix
String getTypePrefix()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.) -
getTypeSuffix
String getTypeSuffix()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.) -
getUnionPrefix
String getUnionPrefix()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.) -
getUnionSuffix
String getUnionSuffix()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.) -
isGenerateJacksonAnnotations
default boolean isGenerateJacksonAnnotations()This method is used only inGeneratePojoConfiguration
.- Returns:
- The
GeneratePojoConfiguration
implementation of this method always returns true - See Also:
-
isSkipGenerationIfSchemaHasNotChanged
Deprecated.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.
-
getDefaultTargetSchemaFileName
The default name of the target filename.
This method must be accessible by the Velocity engine. Thus, it can not be a default interface method. -
logConfiguration
void logConfiguration()Logs all the configuration parameters (only when in the debug level) -
logCommonConfiguration
default void logCommonConfiguration()Logs all the common configuration parameters (only when in the debug level)
-