Interface GraphQLCodegenConfiguration

All Known Implementing Classes:
MappingConfig, MappingContext

public interface GraphQLCodegenConfiguration
Defines all properties that should be parsed in the plugin.
  • Method Details

    • getCustomTypesMapping

      Map<String,String> getCustomTypesMapping()
      Can be used to supply custom mappings for scalars.

      Supports:

      • Map of (GraphqlObjectName.fieldName) to (JavaType)
      • Map of (GraphqlType) to (JavaType)

      E.g.:

      • DateTime --- String
      • Price.amount --- java.math.BigDecimal
      Returns:
      mappings from GraphqlType to JavaType
    • getCustomTemplatesRoot

      File getCustomTemplatesRoot()
      Can be used to specify the root directory for the custom FreeMaker templates
      Returns:
      the directory source for the root directory
    • getCustomTemplates

      Map<String,String> getCustomTemplates()
      Can be used to supply paths to custom FreeMarker templates for code generation.
      Returns:
      a map, where key is a template type and a value is path to a FreeMarker template
    • getCustomAnnotationsMapping

      Map<String,List<String>> getCustomAnnotationsMapping()
      Can be used to supply custom annotations (serializers) for scalars.

      Supports:

      • Map of (GraphqlObjectName.fieldName) to (JavaAnnotation)
      • Map of (GraphqlType) to (JavaAnnotation)

      E.g.: EpochMillis --- @com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = com.example.json .EpochMillisScalarDeserializer.class)

      Returns:
      mappings from GraphqlType to JavaAnnotation
    • getDirectiveAnnotationsMapping

      Map<String,List<String>> getDirectiveAnnotationsMapping()
      Map GraphQL directives to Java annotations.

      Directive fields can be used in annotations via: {{directiveFieldName}}

      Example:

      schema: directive @auth (roles: [String])

      directiveAnnotationsMapping: auth --- @org.springframework.security.access.annotation.Secured({{roles}})

      Returns:
      mappings from GraphQL directives to Java annotations.
    • getGenerateApis

      Boolean getGenerateApis()
      Specifies whether api classes should be generated.
      Returns:
      true is API interfaces should be generated.
    • getGenerateModelsForRootTypes

      Boolean getGenerateModelsForRootTypes()
      Specifies whether model classes should be generated for Query/Subscription/Mutation.
      Returns:
      true is model classes (POJOs) should be generated for GraphQL root types.
    • getApiRootInterfaceStrategy

      ApiRootInterfaceStrategy getApiRootInterfaceStrategy()
      Specifies the strategy of generating root api interface.
      Returns:
      strategy of generating root api interface.
    • getApiInterfaceStrategy

      ApiInterfaceStrategy getApiInterfaceStrategy()
      Specifies the strategy of generating api interfaces.
      Returns:
      strategy of generating api interfaces.
    • getPackageName

      String getPackageName()
      Java package for generated classes.
      Returns:
      Java package for generated classes.
    • getApiPackageName

      String getApiPackageName()
      Java package for generated api classes (Query, Mutation, Subscription).
      Returns:
      Java package for generated api classes.
    • getModelPackageName

      String getModelPackageName()
      Java package for generated model classes (type, input, interface, enum, union).
      Returns:
      Java package for generated model classes.
    • getModelNamePrefix

      String getModelNamePrefix()
      Sets the prefix for GraphQL model classes (type, input, interface, enum, union).
      Returns:
      The prefix for GraphQL model classes.
    • getModelNameSuffix

      String getModelNameSuffix()
      Sets the suffix for GraphQL model classes (type, input, interface, enum, union).
      Returns:
      The suffix for GraphQL model classes.
    • getApiNamePrefixStrategy

      ApiNamePrefixStrategy getApiNamePrefixStrategy()
      Sets prefix strategy for GraphQL api classes (query, mutation, subscription).
      Returns:
      Prefix strategy for GraphQL api classes.
    • getApiNamePrefix

      String getApiNamePrefix()
      Sets the prefix for GraphQL api classes (query, mutation, subscription).
      Returns:
      The prefix for GraphQL api classes.
    • getApiNameSuffix

      String getApiNameSuffix()
      Sets the suffix for GraphQL api classes (query, mutation, subscription).
      Returns:
      The suffix for GraphQL api classes.
    • getModelValidationAnnotation

      String getModelValidationAnnotation()
      Annotation for mandatory (NonNull) fields. Can be null/empty.
      Returns:
      Annotation for mandatory (NonNull) fields
    • getApiReturnType

      String getApiReturnType()
      Return type for api methods (query / subscription) For example: reactor.core.publisher.Mono
      Returns:
      Return type for api methods (query / subscription)
    • getApiReturnListType

      String getApiReturnListType()
      Return type for api methods (query / subscription) that return list values For example: reactor.core.publisher.Flux
      Returns:
      Return type for api methods (query / subscription) that return list values
    • getSubscriptionReturnType

      String getSubscriptionReturnType()
      Return type for subscription methods. For example: org.reactivestreams.Publisher, io.reactivex.Observable, etc.
      Returns:
      Return type for subscription methods
    • getGenerateBuilder

      Boolean getGenerateBuilder()
      Specifies whether generated model classes should have builder.
      Returns:
      true if generated model classes should have builder.
    • getGenerateEqualsAndHashCode

      Boolean getGenerateEqualsAndHashCode()
      Specifies whether generated model classes should have equals and hashCode methods defined.
      Returns:
      true if generated model classes should have equals and hashCode methods defined.
    • getGenerateImmutableModels

      Boolean getGenerateImmutableModels()
      Specifies whether generated model classes should be immutable.
      Returns:
      true if generated model classes should be immutable.
    • getGenerateToString

      Boolean getGenerateToString()
      Specifies whether generated model classes should have toString method defined.
      Returns:
      true if generated model classes should have toString method defined.
    • getGenerateParameterizedFieldsResolvers

      Boolean getGenerateParameterizedFieldsResolvers()
      If true, then generate separate `Resolver` interface for parametrized fields. If false, then add field to the type definition and ignore field parameters.
      Returns:
      true if separate `Resolver` interface for parametrized fields should be generated. false if field should be added to the type definition and field parameters should be ignored.
    • getTypeResolverPrefix

      String getTypeResolverPrefix()
      Sets the prefix for GraphQL type resolver classes.
      Returns:
      The prefix for GraphQL type resolver classes.
    • getTypeResolverSuffix

      String getTypeResolverSuffix()
      Sets the suffix for GraphQL type resolver classes.
      Returns:
      The suffix for GraphQL type resolver classes.
    • getGenerateExtensionFieldsResolvers

      Boolean getGenerateExtensionFieldsResolvers()
      Whether all fields in extensions (extend type and extend interface) should be present in Resolver interface instead of the type class itself.
      Returns:
      true if all fields in extensions (extend type and extend interface) should be present in Resolver interface instead of the type class itself.
    • getGenerateDataFetchingEnvironmentArgumentInApis

      Boolean getGenerateDataFetchingEnvironmentArgumentInApis()
      If true, then graphql.schema.DataFetchingEnvironment env will be added as a last argument to all methods of root type resolvers and field resolvers.
      Returns:
      true if graphql.schema.DataFetchingEnvironment env should be added as a last argument in all API interfaces methods.
    • getGenerateApisWithThrowsException

      Boolean getGenerateApisWithThrowsException()
      Whether signatures of API interface methods should have throws Exception.
      Returns:
      true if API interfaces methods signature should contain throws Exception.
    • getGenerateApisWithSuspendFunctions

      Boolean getGenerateApisWithSuspendFunctions()
      Whether signatures of API interface methods should have suspend modifier.
      Returns:
      true if API interfaces methods signature should contain suspend modifier.
    • getAddGeneratedAnnotation

      Boolean getAddGeneratedAnnotation()
      Specifies whether generated classes should be annotated with @Generated
      Returns:
      true if classes should be annotated with @Generated
    • getAddGeneratedAnnotationDate

      Boolean getAddGeneratedAnnotationDate()
      Specifies whether the @Generated annotation should include the date attribute.
      Returns:
      true if the date attribute should be included in the @Generated annotation
    • getGenerateJacksonTypeIdResolver

      Boolean getGenerateJacksonTypeIdResolver()
      Specifies whether generated union interfaces should be annotated with a Jackson type id resolver generated in model package.
      Returns:
      true if union interfaces should be annotated with a Jackson type id resolver generated in model package
    • getRelayConfig

      RelayConfig getRelayConfig()
      Relay-related configurations.
      Returns:
      Relay-related configurations.
    • getFieldsWithResolvers

      Set<String> getFieldsWithResolvers()
      Fields that require Resolvers.

      Values should be defined here in format: TypeName, TypeName.fieldName, @directive

      If just type is specified, then all fields of this type will have resolvers.

      E.g.:

      • Person
      • Person.friends
      • @customResolver
      Returns:
      Set of types and fields that should have Resolver interfaces.
    • getFieldsWithoutResolvers

      Set<String> getFieldsWithoutResolvers()
      Fields that DO NOT require Resolvers.

      Values should be defined here in format: TypeName, TypeName.fieldName, @directive

      If just type is specified, then all fields of this type will NOT have resolvers.

      Can be used in conjunction with generateExtensionFieldsResolvers

      E.g.:

      • Person
      • Person.friends
      • @customResolver
      Returns:
      Set of types and fields that should NOT have Resolver interfaces.
    • getFieldsToExcludeFromGeneration

      Set<String> getFieldsToExcludeFromGeneration()
      Fields that WILL NOT be generated.

      Values should be defined here in format: TypeName.fieldName

      E.g.:

      • Person.friends
      Returns:
      Set of types and fields that should NOT be generated.
    • getFieldsWithDataFetcherResult

      Set<String> getFieldsWithDataFetcherResult()
      Fields that require DataFetcherResult.

      Values should be defined here in format: TypeName, TypeName.fieldName, @directive

      E.g.:

      • @dataFetcherResult
      Returns:
      Set of types and fields that should have DataFetcherResult.
    • getUseOptionalForNullableReturnTypes

      Boolean getUseOptionalForNullableReturnTypes()
      Specifies whether return types of generated API interface should be wrapped into java.util.Optional
      Returns:
      true if return types should be wrapped into java.util.Optional
    • getUseWrapperForNullableInputTypes

      Boolean getUseWrapperForNullableInputTypes()
      Specifies whether input types of generated input classes should be wrapped into ArgumentValue.
      Returns:
      true if input types should be wrapped into ArgumentValue
    • getGenerateClient

      Boolean getGenerateClient()
      Specifies whether client-side classes should be generated for each query, mutation and subscription. This includes: `Request` class (contains input data) and `ResponseProjection` class (contains response fields).
      Returns:
      true if client-side classes should be generated (`Request`, `Response` and `ResponseProjection`)
    • getRequestSuffix

      String getRequestSuffix()
      The suffix for `Request` classes.
      Returns:
      The suffix for `Request` classes.
    • getResponseSuffix

      String getResponseSuffix()
      The suffix for `Response` classes.
      Returns:
      The suffix for `Response` classes.
    • getResponseProjectionSuffix

      String getResponseProjectionSuffix()
      The suffix for `ResponseProjection` classes.
      Returns:
      The suffix for `ResponseProjection` classes.
    • getParametrizedInputSuffix

      String getParametrizedInputSuffix()
      The suffix for `ParametrizedInput` classes.
      Returns:
      The suffix for `ParametrizedInput` classes.
    • getQueryResolverParentInterface

      String getQueryResolverParentInterface()
      Interface that will be added as "extend" to all generated api Query interfaces.
      Returns:
      Parent interface of all GraphQL Query types.
    • getMutationResolverParentInterface

      String getMutationResolverParentInterface()
      Interface that will be added as "extend" to all generated api Mutation interfaces.
      Returns:
      Parent interface of all GraphQL Mutation types.
    • getSubscriptionResolverParentInterface

      String getSubscriptionResolverParentInterface()
      Interface that will be added as "extend" to all generated api Subscription interfaces.
      Returns:
      Parent interface of all GraphQL Subscription types.
    • getResolverParentInterface

      String getResolverParentInterface()
      Interface that will be added as "extend" to all generated TypeResolver interfaces.
      Returns:
      Parent interface of all Resolvers of GraphQL types.
    • getGenerateAllMethodInProjection

      Boolean getGenerateAllMethodInProjection()
      Enables the generation of the all$ method in the projection classes of the client.
      Returns:
      whether the generation is enabled.
    • getResponseProjectionMaxDepth

      Integer getResponseProjectionMaxDepth()
      Limit depth when `all$` invoke which has subProjections
      Returns:
      limit depth when the projection is constructed automatically
    • getUseObjectMapperForRequestSerialization

      Set<String> getUseObjectMapperForRequestSerialization()
      Fields that require serialization using ObjectMapper.writeValueAsString(Object)

      Values should be defined here in format: GraphqlObjectName.fieldName or GraphqlTypeName

      If just type is specified, then all fields of this type will be serialized using ObjectMapper.

      E.g.:

      • Person.createdDateTime
      • ZonedDateTime
      Returns:
      Set of types and fields that should be serialized using ObjectMapper.writeValueAsString(Object)
    • getTypesAsInterfaces

      Set<String> getTypesAsInterfaces()
      Types that must generated as interfaces.

      Values should be defined here in format: TypeName, @directive

      E.g.:

      • Person
      • @asInterface
      Returns:
      Set of types that should generated as interfaces.
    • getResolverArgumentAnnotations

      Set<String> getResolverArgumentAnnotations()
      Annotations that will be added to all resolver arguments.

      E.g.:

      • @org.springframework.graphql.data.method.annotation.Argument
      Returns:
      Set of annotations that every resolver argument will have.
    • getParametrizedResolverAnnotations

      Set<String> getParametrizedResolverAnnotations()
      Annotations that will be added to all parametrized resolver methods.

      E.g.:

      • @org.springframework.graphql.data.method.annotation.Argument
      Returns:
      Set of annotations that every parametrized resolver method will have.
    • getGeneratedLanguage

      GeneratedLanguage getGeneratedLanguage()
      Generate code with lang
      Returns:
      GeneratedLanguage.KOTLIN or GeneratedLanguage.JAVA
    • getGenerateModelOpenClasses

      default Boolean getGenerateModelOpenClasses()
      Specifies whether generate public model classes.
      Returns:
      false generate data class in kotlin and case class in scala
    • isGenerateModelOpenClasses

      @Deprecated Boolean isGenerateModelOpenClasses()
      Deprecated.
    • getInitializeNullableTypes

      default Boolean getInitializeNullableTypes()
      Specifies whether classes should be generated with constructors setting the default value for nullable fields to null.
      Returns:
      true if nullable fields should be defaulted to null.
    • isInitializeNullableTypes

      @Deprecated Boolean isInitializeNullableTypes()
      Deprecated.
    • getGenerateSealedInterfaces

      default Boolean getGenerateSealedInterfaces()
      Specifies whether generate sealed interfaces.
      Returns:
      false generate sealed interfaces class in kotlin
    • isGenerateSealedInterfaces

      @Deprecated Boolean isGenerateSealedInterfaces()
      Deprecated.
    • getSupportUnknownFields

      default Boolean getSupportUnknownFields()
    • isSupportUnknownFields

      @Deprecated Boolean isSupportUnknownFields()
      Deprecated.
    • getUnknownFieldsPropertyName

      String getUnknownFieldsPropertyName()
      Specifies the name of the property to be included in api classes to support unknown fields during serialization or deserialization
      Returns:
      The name of the property to store unknown fields
    • getGeneratedAnnotation

      String getGeneratedAnnotation()
      Returns a qualified class name (with package) of the Generated annotation that will be added on top of every generated class.
      Returns:
      The name of the class for @Generated annotation
      See Also:
      • "jakarta.annotation.Generated"
      • "javax.annotation.processing.Generated"
      • "javax.annotation.Generated"
    • getGenerateNoArgsConstructorOnly

      default Boolean getGenerateNoArgsConstructorOnly()
      Specifies whether model classes should only have a no-args constructor. All-args constructor will not be generated in case returned value is true
      Returns:
      true if only no-args constructor should be generated. false if both no-args and all-args constructors should be generated
    • isGenerateNoArgsConstructorOnly

      @Deprecated Boolean isGenerateNoArgsConstructorOnly()
      Deprecated.
    • getGenerateModelsWithPublicFields

      default Boolean getGenerateModelsWithPublicFields()
      Specifies whether model classes should have public or private fields.
      Returns:
      true if model classes should have public fields and no getters/setters. false if model classes should have private fields and getters/setters.
    • isGenerateModelsWithPublicFields

      @Deprecated Boolean isGenerateModelsWithPublicFields()
      Deprecated.