Service

interface Service

A Service represents a GraphQL schema and associated queries.

The queries will be compiled and verified against the schema to generate the models.

Types

OperationOutputWire
Link copied to clipboard
class OperationOutputWire(task: TaskProvider<out Task>, operationOutputFile: Provider<RegularFile>)
OutputDirWire
Link copied to clipboard
class OutputDirWire(task: TaskProvider<out Task>, outputDir: Provider<Directory>)

Functions

filePathAwarePackageNameGenerator
Link copied to clipboard
abstract fun filePathAwarePackageNameGenerator(rootPackageName: String? = null)
A helper method to configure a PackageNameGenerator that will use the file path relative to the source roots to generate the packageNames
introspection
Link copied to clipboard
abstract fun introspection(configure: Action<in Introspection>)
Configures Introspection to download an introspection Json schema
registry
Link copied to clipboard
abstract fun registry(configure: Action<in Registry>)
Configures Registry to download a SDL schema from a studio registry
srcDir
Link copied to clipboard
abstract fun srcDir(directory: Any)
Adds the given directory as a GraphQL source rootUse srcDir if your files are outside of "src/main/graphql" or to have them in multiple folders.
withOperationOutput
Link copied to clipboard
abstract fun withOperationOutput(action: Action<in Service.OperationOutputWire>)
overrides the way operationOutput is wired.
withOutputDir
Link copied to clipboard
abstract fun withOutputDir(action: Action<in Service.OutputDirWire>)
overrides the way the task is wired.

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 or not 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.
debugDir
Link copied to clipboard
abstract val debugDir: DirectoryProperty
A debug directory where the compiler will output intermediary results
exclude
Link copied to clipboard
abstract val exclude: ListProperty<String>
Files to exclude as in org.gradle.api.tasks.util.PatternFilterableThe empty list by default
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>
Unused property for the moment.
generateOperationOutput
Link copied to clipboard
abstract val generateOperationOutput: Property<Boolean>
Whether to generate the operationOutput.
include
Link copied to clipboard
abstract val include: ListProperty<String>
Files to include as in org.gradle.api.tasks.util.PatternFilterableDefault: "**&#47;*.graphql", "**&#47;*.
name
Link copied to clipboard
abstract val name: String
operationIdGenerator
Link copied to clipboard
abstract val operationIdGenerator: Property<OperationIdGenerator>
By default, Apollo uses Sha256 hashing algorithm to generate an ID for the query.
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.
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.
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.
sourceFolder
Link copied to clipboard
abstract val sourceFolder: Property<String>
Where to look for GraphQL sources.
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

Inheritors

ApolloExtension
Link copied to clipboard
DefaultApolloExtension
Link copied to clipboard
DefaultService
Link copied to clipboard