DefaultService

abstract class DefaultService @Inject() constructor(project: Project, name: String) : Service

Functions

introspection
Link copied to clipboard
open override fun introspection(configure: Action<in Introspection>)
Configures Introspection to download an introspection Json schema
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
registry
Link copied to clipboard
open override fun registry(configure: Action<in Registry>)
Configures Registry to download a SDL schema from a studio registry
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
open override fun useVersion2Compat(rootPackageName: String?)
A shorthand method that configures defaults that match Apollo Android 2.

Properties

alwaysGenerateTypesMatching
Link copied to clipboard
abstract 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
abstract val codegenModels: Property<String>
What codegen to use.
customScalarsMapping
Link copied to clipboard
abstract 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
abstract val customTypeMapping: MapProperty<String, String>
debugDir
Link copied to clipboard
abstract val debugDir: DirectoryProperty
A debug directory where the compiler will output intermediary results
excludes
Link copied to clipboard
abstract val excludes: ListProperty<String>
Operation files to exclude.
failOnWarnings
Link copied to clipboard
abstract val failOnWarnings: Property<Boolean>
Fail the build if there are warnings.
flattenModels
Link copied to clipboard
abstract val flattenModels: Property<Boolean>
Whether to flatten the models.
generateApolloMetadata
Link copied to clipboard
abstract val generateApolloMetadata: Property<Boolean>
Whether to generate Apollo metadata.
generateAsInternal
Link copied to clipboard
abstract val generateAsInternal: Property<Boolean>
Whether to generate Kotlin models with internal visibility modifier.
generateFragmentImplementations
Link copied to clipboard
abstract val generateFragmentImplementations: Property<Boolean>
Whether to generate default implementation classes for GraphQL fragments.
generateKotlinModels
Link copied to clipboard
abstract 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
abstract val generateOperationOutput: Property<Boolean>
Whether to generate the operationOutput.
generateOptionalOperationVariables
Link copied to clipboard
abstract val generateOptionalOperationVariables: Property<Boolean>
Whether to generate operation variables as com.apollographql.apollo3.api.OptionalUsing com.apollographql.apollo3.api.Optional allows to omit the variables if needed but makes the callsite more verbose in most cases.
generateQueryDocument
Link copied to clipboard
abstract val generateQueryDocument: Property<Boolean>
Whether to write the query document in models
generateSchema
Link copied to clipboard
abstract val generateSchema: Property<Boolean>
Whether to generate the __Schema class.
generateTestBuilders
Link copied to clipboard
abstract val generateTestBuilders: Property<Boolean>
Whether to generate the type safe Data builders.
graphqlSourceDirectorySet
Link copied to clipboard
val graphqlSourceDirectorySet: SourceDirectorySet
includes
Link copied to clipboard
abstract val includes: ListProperty<String>
Operation files to include.
introspection
Link copied to clipboard
var introspection: DefaultIntrospection? = null
languageVersion
Link copied to clipboard
abstract val languageVersion: Property<String>
Target language version for the generated code.
name
Link copied to clipboard
open override val name: String
objects
Link copied to clipboard
val objects: ObjectFactory
operationIdGenerator
Link copied to clipboard
abstract val operationIdGenerator: Property<OperationIdGenerator>
By default, Apollo uses Sha256 hashing algorithm to generate an ID for the query.
operationOutputAction
Link copied to clipboard
var operationOutputAction: Action<in Service.OperationOutputConnection>? = null
operationOutputFile
Link copied to clipboard
abstract val operationOutputFile: RegularFileProperty
The file where the operation output will be written.
operationOutputGenerator
Link copied to clipboard
abstract val operationOutputGenerator: Property<OperationOutputGenerator>
A generator to generate the operation output from a list of operations.
outputDir
Link copied to clipboard
abstract val outputDir: DirectoryProperty
The directory where the generated models will be written.
outputDirAction
Link copied to clipboard
var outputDirAction: Action<in Service.DirectoryConnection>? = null
packageName
Link copied to clipboard
abstract val packageName: Property<String>
The package name of the models.
packageNameGenerator
Link copied to clipboard
abstract val packageNameGenerator: Property<PackageNameGenerator>
Use packageNameGenerator to customize how to generate package names from file paths.
project
Link copied to clipboard
val project: Project
registry
Link copied to clipboard
var registry: DefaultRegistry? = null
schemaFile
Link copied to clipboard
abstract val schemaFile: RegularFileProperty
A shorthand property that will be used if schemaFiles is empty
schemaFiles
Link copied to clipboard
abstract val schemaFiles: ConfigurableFileCollection
The schema files as either a ".json" introspection schema or a ".sdl|.graphqls" SDL schema.
sealedClassesForEnumsMatching
Link copied to clipboard
abstract 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
abstract val sourceFolder: Property<String>
Where to look for GraphQL sources.
testDir
Link copied to clipboard
abstract val testDir: DirectoryProperty
The directory where the test builders will be written.
testDirAction
Link copied to clipboard
var testDirAction: Action<in Service.DirectoryConnection>? = null
useSemanticNaming
Link copied to clipboard
abstract val useSemanticNaming: Property<Boolean>
When true, the generated classes names will end with 'Query' or 'Mutation'.
warnOnDeprecatedUsages
Link copied to clipboard
abstract val warnOnDeprecatedUsages: Property<Boolean>
Warn if using a deprecated fieldDefault value: true

Extensions

lazySchemaFiles
Link copied to clipboard
fun DefaultService.lazySchemaFiles(project: Project): Set<File>