DefaultApolloExtension

abstract class DefaultApolloExtension(project: Project, defaultService: DefaultService) : ApolloExtension, Service

Types

Companion
Link copied to clipboard
object Companion

Functions

createAllAndroidVariantServices
Link copied to clipboard
open override fun createAllAndroidVariantServices(sourceFolder: String, nameSuffix: String, action: Action<Service>)
registers multiple services for an android projectAndroid projects have variants for buildType/flavor combinations as well as test.
createAllKotlinSourceSetServices
Link copied to clipboard
open override fun createAllKotlinSourceSetServices(sourceFolder: String, nameSuffix: String, action: Action<Service>)
registers multiple services for a Kotlin projectThis will create a GraphQL service for each source set and add the sources to the KotlinCompile task.
introspection
Link copied to clipboard
open override fun introspection(configure: Action<in Introspection>)
Configures Introspection to download an introspection Json schema
mapScalar
Link copied to clipboard
open override fun mapScalar(graphQLName: String, targetName: String)
Map a GraphQL scalar type to the Java/Kotlin type.
open override fun mapScalar(graphQLName: String, targetName: String, expression: String)
Map a GraphQL scalar type to the Java/Kotlin type and provided adapter expression.
mapScalarToJavaBoolean
Link copied to clipboard
open override fun mapScalarToJavaBoolean(graphQLName: String)
Map the given GraphQL scalar to java.lang.Boolean and use the builtin adapter
mapScalarToJavaDouble
Link copied to clipboard
open override fun mapScalarToJavaDouble(graphQLName: String)
Map the given GraphQL scalar to java.lang.Double and use the builtin adapter
mapScalarToJavaFloat
Link copied to clipboard
open override fun mapScalarToJavaFloat(graphQLName: String)
Map the given GraphQL scalar to java.lang.Float and use the builtin adapter
mapScalarToJavaInteger
Link copied to clipboard
open override fun mapScalarToJavaInteger(graphQLName: String)
Map the given GraphQL scalar to java.lang.Integer and use the builtin adapter
mapScalarToJavaLong
Link copied to clipboard
open override fun mapScalarToJavaLong(graphQLName: String)
Map the given GraphQL scalar to java.lang.Long and use the builtin adapter
mapScalarToJavaObject
Link copied to clipboard
open override fun mapScalarToJavaObject(graphQLName: String)
Map the given GraphQL scalar to java.lang.Object and use the builtin adapter
mapScalarToJavaString
Link copied to clipboard
open override fun mapScalarToJavaString(graphQLName: String)
Map the given GraphQL scalar to java.lang.String and use the builtin adapter
mapScalarToKotlinAny
Link copied to clipboard
open override fun mapScalarToKotlinAny(graphQLName: String)
Map the given GraphQL scalar to kotlin.Any and use the builtin adapter
mapScalarToKotlinBoolean
Link copied to clipboard
open override fun mapScalarToKotlinBoolean(graphQLName: String)
Map the given GraphQL scalar to kotlin.Boolean and use the builtin adapter
mapScalarToKotlinDouble
Link copied to clipboard
open override fun mapScalarToKotlinDouble(graphQLName: String)
Map the given GraphQL scalar to kotlin.Double and use the builtin adapter
mapScalarToKotlinFloat
Link copied to clipboard
open override fun mapScalarToKotlinFloat(graphQLName: String)
Map the given GraphQL scalar to kotlin.Float and use the builtin adapter
mapScalarToKotlinInt
Link copied to clipboard
open override fun mapScalarToKotlinInt(graphQLName: String)
Map the given GraphQL scalar to kotlin.Int and use the builtin adapter
mapScalarToKotlinLong
Link copied to clipboard
open override fun mapScalarToKotlinLong(graphQLName: String)
Map the given GraphQL scalar to kotlin.Long and use the builtin adapter
mapScalarToKotlinString
Link copied to clipboard
open override fun mapScalarToKotlinString(graphQLName: String)
Map the given GraphQL scalar to kotlin.String and use the builtin adapter
mapScalarToUpload
Link copied to clipboard
open override fun mapScalarToUpload(graphQLName: String)
Map the given GraphQL scalar to com.apollographql.apollo3.api.
operationOutputConnection
Link copied to clipboard
open override fun operationOutputConnection(action: Action<in Service.OperationOutputConnection>)
overrides the way operationOutput is connected.
outputDirConnection
Link copied to clipboard
open override fun outputDirConnection(action: Action<in Service.DirectoryConnection>)
Overrides the way the generated models are connected.
packageNamesFromFilePaths
Link copied to clipboard
open override fun packageNamesFromFilePaths(rootPackageName: String?)
A helper method to configure a PackageNameGenerator that will use the file path relative to the source roots to generate the packageNames
registerOperations
Link copied to clipboard
open override fun registerOperations(configure: Action<in RegisterOperationsConfig>)
Configures operation safelisting (requires an Apollo Studio account)
registry
Link copied to clipboard
open override fun registry(configure: Action<in Registry>)
Configures Registry to download a SDL schema from a studio registry
service
Link copied to clipboard
open override fun service(name: String, action: Action<Service>)
Call from users to explicitly register a service or by the plugin to register the implicit service
srcDir
Link copied to clipboard
open override fun srcDir(directory: Any)
Adds the given directory as a GraphQL source rootUse srcDir if your files are outside "src/main/graphql" or to have them in multiple folders.
testDirConnection
Link copied to clipboard
open override fun testDirConnection(action: Action<in Service.DirectoryConnection>)
Overrides the way the generated test builders are connected.
useVersion2Compat
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v3_0_0)
open override fun useVersion2Compat(rootPackageName: String?)
A shorthand method that configures defaults that match Apollo Android 2.

Properties

alwaysGenerateTypesMatching
Link copied to clipboard
open override val alwaysGenerateTypesMatching: SetProperty<String>
A list of Regex patterns for input/scalar/enum types that should be generated whether they are used by queries/fragments in this module.
codegenModels
Link copied to clipboard
open override val codegenModels: Property<String>
What codegen to use.
customScalarsMapping
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v3_0_1)
open override val customScalarsMapping: MapProperty<String, String>
For custom scalar types like Date, map from the GraphQL type to the Java/Kotlin type.
customTypeMapping
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v3_0_0)
open override val customTypeMapping: MapProperty<String, String>
debugDir
Link copied to clipboard
open override val debugDir: DirectoryProperty
A debug directory where the compiler will output intermediary results
excludes
Link copied to clipboard
open override val excludes: ListProperty<String>
Operation files to exclude.
failOnWarnings
Link copied to clipboard
open override val failOnWarnings: Property<Boolean>
Fail the build if there are warnings.
flattenModels
Link copied to clipboard
open override val flattenModels: Property<Boolean>
Whether to flatten the models.
generateApolloMetadata
Link copied to clipboard
open override val generateApolloMetadata: Property<Boolean>
Whether to generate Apollo metadata.
generateAsInternal
Link copied to clipboard
open override val generateAsInternal: Property<Boolean>
Whether to generate Kotlin models with internal visibility modifier.
generatedSchemaName
Link copied to clipboard
open override val generatedSchemaName: Property<String>
Class name to use when generating the Schema class.
generateFragmentImplementations
Link copied to clipboard
open override val generateFragmentImplementations: Property<Boolean>
Whether to generate default implementation classes for GraphQL fragments.
generateKotlinModels
Link copied to clipboard
open override val generateKotlinModels: Property<Boolean>
Whether to generate Kotlin or Java models Default to true if the Kotlin plugin is found
generateOperationOutput
Link copied to clipboard
open override val generateOperationOutput: Property<Boolean>
Whether to generate the operationOutput.
generateOptionalOperationVariables
Link copied to clipboard
open override val generateOptionalOperationVariables: Property<Boolean>
Whether to generate operation variables as com.apollographql.apollo3.api.
generateQueryDocument
Link copied to clipboard
open override val generateQueryDocument: Property<Boolean>
Whether to write the query document in models
generateSchema
Link copied to clipboard
open override val generateSchema: Property<Boolean>
Whether to generate the Schema class.
generateTestBuilders
Link copied to clipboard
@ApolloExperimental()
open override val generateTestBuilders: Property<Boolean>
Whether to generate the type safe Data builders.
includes
Link copied to clipboard
open override val includes: ListProperty<String>
Operation files to include.
languageVersion
Link copied to clipboard
open override val languageVersion: Property<String>
Target language version for the generated code.
linkSqlite
Link copied to clipboard
abstract override val linkSqlite: Property<Boolean>
For Kotlin native projects, whether to link Sqlite (-lsqlite3).
name
Link copied to clipboard
open override val name: String
operationIdGenerator
Link copied to clipboard
open override val operationIdGenerator: Property<OperationIdGenerator>
By default, Apollo uses Sha256 hashing algorithm to generate an ID for the query.
operationOutputFile
Link copied to clipboard
open override val operationOutputFile: RegularFileProperty
The file where the operation output will be written.
operationOutputGenerator
Link copied to clipboard
open override val operationOutputGenerator: Property<OperationOutputGenerator>
A generator to generate the operation output from a list of operations.
outputDir
Link copied to clipboard
open override val outputDir: DirectoryProperty
The directory where the generated models will be written.
packageName
Link copied to clipboard
open override val packageName: Property<String>
The package name of the models.
packageNameGenerator
Link copied to clipboard
open override val packageNameGenerator: Property<PackageNameGenerator>
Use packageNameGenerator to customize how to generate package names from file paths.
schemaFile
Link copied to clipboard
open override val schemaFile: RegularFileProperty
A shorthand property that will be used if schemaFiles is empty
schemaFiles
Link copied to clipboard
open override val schemaFiles: ConfigurableFileCollection
The schema files as either a ".json" introspection schema or a ".sdl|.graphqls" SDL schema.
sealedClassesForEnumsMatching
Link copied to clipboard
open override val sealedClassesForEnumsMatching: ListProperty<String>
A list of Regex patterns for GraphQL enums that should be generated as Kotlin sealed classes instead of the default Kotlin enums.
sourceFolder
Link copied to clipboard
open override val sourceFolder: Property<String>
Where to look for GraphQL sources.
testDir
Link copied to clipboard
open override val testDir: DirectoryProperty
The directory where the test builders will be written.
useSchemaPackageNameForFragments
Link copied to clipboard
open override val useSchemaPackageNameForFragments: Property<Boolean>
Whether to use the schema package name for fragments.
useSemanticNaming
Link copied to clipboard
open override val useSemanticNaming: Property<Boolean>
When true, the generated classes names will end with 'Query' or 'Mutation'.
warnOnDeprecatedUsages
Link copied to clipboard
open override val warnOnDeprecatedUsages: Property<Boolean>
Warn if using a deprecated fieldDefault value: true