Default Service
Properties
Whether to generate kotlin constructors with @JvmOverloads for more graceful Java interop experience when default values are present. Note: when enabled in a multi-platform setup, the generated code can only be used in the common or JVM sourcesets.
When to add __typename. One of "always", "ifAbstract", "ifPolymorphic" or "ifFragments"
A list of Regex patterns matching schema coordinates for types and fields that should be generated whether they are used by queries/fragments in this module or not.
A list of Regex patterns for GraphQL enums that should be generated as Java classes.
What codegen to use. One of "operationBased", "responseBased" or "experimental_operationBasedWithInterfaces"
Hooks to customize the generated Java code.
Hooks to customize the generated Kotlin code.
Whether to decapitalize field names in the generated models (for instance FooBar ->fooBar).
Fail the build if there are warnings. This is not named allWarningAsErrors to avoid nameclashes with the Kotlin options
Whether fields with different shape are disallowed to be merged in disjoint types.
Whether to flatten the models. File paths are limited on MacOSX to 256 chars and flattening can help keeping the path length manageable The drawback is that some classes may nameclash in which case they will be suffixed with a number
Whether to generate Apollo metadata. Apollo metadata is used for multi-module support. Set this to true if you want other modules to be able to re-use fragments and types from this module.
Whether to generate Kotlin models with internal visibility modifier.
Whether to generate the type safe Data builders. These are mainly used for tests but can also be used for other use cases too.
Class name to use when generating the Schema class.
Whether to generate default implementation classes for GraphQL fragments. Default value is false, means only interfaces are generated.
Whether to generate builders in addition to constructors for operations and input types. Constructors are more concise but require passing an instance of Optional always, making them more verbose for the cases where there are a lot of optional input parameters.
Whether to generate Kotlin or Java models Default to true if the Kotlin plugin is found
Specifies which methods will be auto generated on operations, models, fragments and input objects.
Whether to generate response model builders for Java.
Whether to generate the operationOutput.json
Whether to generate operation variables as com.apollographql.apollo3.api.Optional
Whether to generate fields as primitive types (int, double, boolean) instead of their boxed types (Integer, Double, Boolean) when possible.
Whether to write the query document in models
Whether to generate the Schema class. The Schema class lists all composite types in order to access __typename and/or possibleTypes.
Target language version for the generated code.
The style to use for fields that are nullable in the Java generated code.
By default, Apollo uses Sha256 hashing algorithm to generate an ID for the query. To provide a custom ID generation logic, pass an instance that implements the OperationIdGenerator. How the ID is generated is indifferent to the compiler. It can be a hashing algorithm or generated by a backend.
The file where to write the operation manifest. If you want a RegularFileProperty that carries the task dependency, use operationManifestConnection.
The format to output for the operation manifest. Valid values are:
The file where the operation output will be written. It's called operationOutputFile but this an "input" parameter for the compiler If you want a RegularFileProperty that carries the task dependency, use operationManifestConnection
A generator to generate the operation output from a list of operations. OperationOutputGenerator is similar to OperationIdGenerator but can work on lists. This is useful if you need to register/whitelist your operations on your server all at once.
The directory where the generated models will be written. It's called outputDir but this an "input" parameter for the compiler If you want a DirectoryProperty that carries the task dependency, use outputDirConnection
The package name of the models. The compiler will generate classes in
Use packageNameGenerator to customize how to generate package names from file paths.
The annotation to use for @requiresOptIn fields/inputFields/enumValues
A shorthand property that will be used if schemaFiles is empty
The schema files as either a ".json" introspection schema or a ".sdl|.graphqls" SDL schema. You might come across schemas named "schema.graphql", these are SDL schemas most of the time that need to be renamed to "schema.graphqls" to be recognized properly.
A list of Regex patterns for GraphQL enums that should be generated as Kotlin sealed classes instead of the default Kotlin enums.
Where to look for GraphQL sources. The plugin will look in "src/main/graphql/$sourceFolder" for Android/JVM projects and "src/commonMain/graphql/$sourceFolder" for multiplatform projects.
The directory where the test builders will be written. If you want a DirectoryProperty that carries the task dependency, use outputDirConnection
When true, the generated classes names will end with 'Query' or 'Mutation'. If you write query droid { ... }, the generated class will be named 'DroidQuery'.
Warn if using a deprecated field
Functions
Configures Introspection to download an introspection Json schema
May return an empty set
Map a GraphQL scalar type to the Java/Kotlin type. The adapter must be configured at runtime via com.apollographql.apollo3.ApolloClient.Builder.addCustomScalarAdapter.
Map a GraphQL scalar type to the Java/Kotlin type and provided adapter expression. The adapter will be configured at compile time and you must not call com.apollographql.apollo3.ApolloClient.Builder.addCustomScalarAdapter.
Map the given GraphQL scalar to java.lang.Boolean and use the builtin adapter
Map the given GraphQL scalar to java.lang.Double and use the builtin adapter
Map the given GraphQL scalar to java.lang.Float and use the builtin adapter
Map the given GraphQL scalar to java.lang.Integer and use the builtin adapter
Map the given GraphQL scalar to java.lang.Long and use the builtin adapter
Map the given GraphQL scalar to java.lang.Object and use the builtin adapter
Map the given GraphQL scalar to java.lang.String and use the builtin adapter
Map the given GraphQL scalar to kotlin.Any and use the builtin adapter
Map the given GraphQL scalar to kotlin.Boolean and use the builtin adapter
Map the given GraphQL scalar to kotlin.Double and use the builtin adapter
Map the given GraphQL scalar to kotlin.Float and use the builtin adapter
Map the given GraphQL scalar to kotlin.Int and use the builtin adapter
Map the given GraphQL scalar to kotlin.Long and use the builtin adapter
Map the given GraphQL scalar to kotlin.String and use the builtin adapter
Map the given GraphQL scalar to com.apollographql.apollo3.api.Upload and use the builtin adapter
overrides the way the operation manifest is connected. Use this if you want to connect the generated operation manifest. For an example you can use this to send the modified queries to your backend for whitelisting
overrides the way operationOutput is connected. Use this if you want to connect the generated operationOutput. For an example you can use this to send the modified queries to your backend for whitelisting
Overrides the way the generated models are connected. Use this if you want to connect the generated models to another task than the default destination.
A helper method to configure a PackageNameGenerator that will use the file path relative to the source roots to generate the packageNames
Configures operation safelisting (requires an Apollo Studio account)