Options

class Options(    val executableFiles: Set<File>,     val schema: Schema,     val outputDir: File,     val testDir: File,     val debugDir: File? = null,     val operationManifestFile: File? = null,     val operationManifestFormat: String = MANIFEST_NONE,     val schemaPackageName: String,     val useSchemaPackageNameForFragments: Boolean = defaultUseSchemaPackageNameForFragments,     val packageNameGenerator: PackageNameGenerator,     val alwaysGenerateTypesMatching: Set<String> = defaultAlwaysGenerateTypesMatching,     val operationOutputGenerator: OperationOutputGenerator = defaultOperationOutputGenerator,     val incomingCompilerMetadata: List<CompilerMetadata> = emptyList(),     val targetLanguage: TargetLanguage = defaultTargetLanguage,     val scalarMapping: Map<String, ScalarInfo> = defaultScalarMapping,     val codegenModels: String = defaultCodegenModels,     val flattenModels: Boolean = defaultFlattenModels,     val useSemanticNaming: Boolean = defaultUseSemanticNaming,     val warnOnDeprecatedUsages: Boolean = defaultWarnOnDeprecatedUsages,     val failOnWarnings: Boolean = defaultFailOnWarnings,     val logger: ApolloCompiler.Logger = defaultLogger,     val generateAsInternal: Boolean = defaultGenerateAsInternal,     val generateFilterNotNull: Boolean = defaultGenerateFilterNotNull,     val generateFragmentImplementations: Boolean = defaultGenerateFragmentImplementations,     val generateResponseFields: Boolean = defaultGenerateResponseFields,     val generateQueryDocument: Boolean = defaultGenerateQueryDocument,     val generateSchema: Boolean = defaultGenerateSchema,     val generatedSchemaName: String = defaultGeneratedSchemaName,     val generateTestBuilders: Boolean = defaultGenerateTestBuilders,     val generateDataBuilders: Boolean = defaultGenerateDataBuilders,     val generateModelBuilders: Boolean = defaultGenerateModelBuilders,     val sealedClassesForEnumsMatching: List<String> = defaultSealedClassesForEnumsMatching,     val classesForEnumsMatching: List<String> = defaultClassesForEnumsMatching,     val generateOptionalOperationVariables: Boolean = defaultGenerateOptionalOperationVariables,     val addJvmOverloads: Boolean = false,     val addTypename: String = defaultAddTypename,     val requiresOptInAnnotation: String? = defaultRequiresOptInAnnotation,     val fieldsOnDisjointTypesMustMerge: Boolean = defaultFieldsOnDisjointTypesMustMerge,     val generatePrimitiveTypes: Boolean = defaultGeneratePrimitiveTypes,     val nullableFieldStyle: JavaNullable = defaultNullableFieldStyle,     val decapitalizeFields: Boolean = defaultDecapitalizeFields,     val compilerKotlinHooks: ApolloCompilerKotlinHooks = defaultCompilerKotlinHooks,     val compilerJavaHooks: ApolloCompilerJavaHooks = defaultCompilerJavaHooks)

Constructors

Link copied to clipboard
fun Options(    executableFiles: Set<File>,     schemaFile: File,     outputDir: File,     testDir: File = outputDir,     packageName: String = "")

A shorthand version that takes a File as input for the schema as well as a simple packageName and has default values for quick configuration. XXX: move this to a builder?

Link copied to clipboard
fun Options(    executableFiles: Set<File>,     schema: Schema,     outputDir: File,     testDir: File,     debugDir: File? = null,     operationManifestFile: File? = null,     operationManifestFormat: String = MANIFEST_NONE,     schemaPackageName: String,     useSchemaPackageNameForFragments: Boolean = defaultUseSchemaPackageNameForFragments,     packageNameGenerator: PackageNameGenerator,     alwaysGenerateTypesMatching: Set<String> = defaultAlwaysGenerateTypesMatching,     operationOutputGenerator: OperationOutputGenerator = defaultOperationOutputGenerator,     incomingCompilerMetadata: List<CompilerMetadata> = emptyList(),     targetLanguage: TargetLanguage = defaultTargetLanguage,     scalarMapping: Map<String, ScalarInfo> = defaultScalarMapping,     codegenModels: String = defaultCodegenModels,     flattenModels: Boolean = defaultFlattenModels,     useSemanticNaming: Boolean = defaultUseSemanticNaming,     warnOnDeprecatedUsages: Boolean = defaultWarnOnDeprecatedUsages,     failOnWarnings: Boolean = defaultFailOnWarnings,     logger: ApolloCompiler.Logger = defaultLogger,     generateAsInternal: Boolean = defaultGenerateAsInternal,     generateFilterNotNull: Boolean = defaultGenerateFilterNotNull,     generateFragmentImplementations: Boolean = defaultGenerateFragmentImplementations,     generateResponseFields: Boolean = defaultGenerateResponseFields,     generateQueryDocument: Boolean = defaultGenerateQueryDocument,     generateSchema: Boolean = defaultGenerateSchema,     generatedSchemaName: String = defaultGeneratedSchemaName,     generateTestBuilders: Boolean = defaultGenerateTestBuilders,     generateDataBuilders: Boolean = defaultGenerateDataBuilders,     generateModelBuilders: Boolean = defaultGenerateModelBuilders,     sealedClassesForEnumsMatching: List<String> = defaultSealedClassesForEnumsMatching,     classesForEnumsMatching: List<String> = defaultClassesForEnumsMatching,     generateOptionalOperationVariables: Boolean = defaultGenerateOptionalOperationVariables,     addJvmOverloads: Boolean = false,     addTypename: String = defaultAddTypename,     requiresOptInAnnotation: String? = defaultRequiresOptInAnnotation,     fieldsOnDisjointTypesMustMerge: Boolean = defaultFieldsOnDisjointTypesMustMerge,     generatePrimitiveTypes: Boolean = defaultGeneratePrimitiveTypes,     nullableFieldStyle: JavaNullable = defaultNullableFieldStyle,     decapitalizeFields: Boolean = defaultDecapitalizeFields,     compilerKotlinHooks: ApolloCompilerKotlinHooks = defaultCompilerKotlinHooks,     compilerJavaHooks: ApolloCompilerJavaHooks = defaultCompilerJavaHooks)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun copy(    schema: Schema = this.schema,     outputDir: File = this.outputDir,     testDir: File = this.testDir,     debugDir: File? = this.debugDir,     operationOutputFile: File? = this.operationManifestFile,     operationManifestFormat: String = this.operationManifestFormat,     executableFiles: Set<File> = this.executableFiles,     schemaPackageName: String = this.schemaPackageName,     useSchemaPackageNameForFragments: Boolean = this.useSchemaPackageNameForFragments,     packageNameGenerator: PackageNameGenerator = this.packageNameGenerator,     alwaysGenerateTypesMatching: Set<String> = this.alwaysGenerateTypesMatching,     operationOutputGenerator: OperationOutputGenerator = this.operationOutputGenerator,     incomingCompilerMetadata: List<CompilerMetadata> = this.incomingCompilerMetadata,     scalarMapping: Map<String, ScalarInfo> = this.scalarMapping,     codegenModels: String = this.codegenModels,     flattenModels: Boolean = this.flattenModels,     useSemanticNaming: Boolean = this.useSemanticNaming,     warnOnDeprecatedUsages: Boolean = this.warnOnDeprecatedUsages,     failOnWarnings: Boolean = this.failOnWarnings,     logger: ApolloCompiler.Logger = this.logger,     generateAsInternal: Boolean = this.generateAsInternal,     generateFilterNotNull: Boolean = this.generateFilterNotNull,     generateFragmentImplementations: Boolean = this.generateFragmentImplementations,     generateResponseFields: Boolean = this.generateResponseFields,     generateQueryDocument: Boolean = this.generateQueryDocument,     generateSchema: Boolean = this.generateSchema,     generatedSchemaName: String = this.generatedSchemaName,     targetLanguage: TargetLanguage = this.targetLanguage,     generateTestBuilders: Boolean = this.generateTestBuilders,     generateDataBuilders: Boolean = this.generateDataBuilders,     sealedClassesForEnumsMatching: List<String> = this.sealedClassesForEnumsMatching,     classesForEnumsMatching: List<String> = this.classesForEnumsMatching,     generateOptionalOperationVariables: Boolean = this.generateOptionalOperationVariables,     addJvmOverloads: Boolean = this.addJvmOverloads,     addTypename: String = this.addTypename,     requiresOptInAnnotation: String? = this.requiresOptInAnnotation,     fieldsOnDisjointTypesMustMerge: Boolean = this.fieldsOnDisjointTypesMustMerge,     generatePrimitiveTypes: Boolean = this.generatePrimitiveTypes,     nullableFieldStyle: JavaNullable = this.nullableFieldStyle,     decapitalizeFields: Boolean = this.decapitalizeFields,     compilerKotlinHooks: ApolloCompilerKotlinHooks = this.compilerKotlinHooks,     compilerJavaHooks: ApolloCompilerJavaHooks = this.compilerJavaHooks): Options

Properties

Link copied to clipboard
val addJvmOverloads: Boolean = false

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.

Link copied to clipboard
val addTypename: String
Link copied to clipboard
val alwaysGenerateTypesMatching: Set<String>

Additional enum/input types to generate. For input types, this will recursively add all input fields types/enums.

Link copied to clipboard
val classesForEnumsMatching: List<String>

A list of Regex patterns for GraphQL enums that should be generated as Java classes.

Link copied to clipboard
val codegenModels: String
Link copied to clipboard

Hooks to customize the generated Java code.

Link copied to clipboard

Hooks to customize the generated Kotlin code.

Link copied to clipboard
val debugDir: File? = null

A debug directory to dump some intermediate artifacts.

Link copied to clipboard
val decapitalizeFields: Boolean

Whether to decapitalize field names in the generated models (for instance FooBar ->fooBar).

Link copied to clipboard
val executableFiles: Set<File>

The files containing the operations and fragments

Link copied to clipboard
val failOnWarnings: Boolean
Link copied to clipboard
val fieldsOnDisjointTypesMustMerge: Boolean

Whether fields with different shape are disallowed to be merged in disjoint types.

Link copied to clipboard
val flattenModels: Boolean
Link copied to clipboard
val generateAsInternal: Boolean
Link copied to clipboard
val generateDataBuilders: Boolean
Link copied to clipboard
val generatedSchemaName: String

Class name to use when generating the Schema class.

Link copied to clipboard
val generateFilterNotNull: Boolean

Kotlin native will generate Any? for optional types Setting generateFilterNotNull will generate extra filterNotNull functions that will help keep the type information

Link copied to clipboard
val generateFragmentImplementations: Boolean

Whether to generate the com.apollographql.apollo3.api.Fragment as well as response and variables adapters. If generateFragmentsAsInterfaces is true, this will also generate data classes for the fragments.

Link copied to clipboard
val generateModelBuilders: Boolean

Whether to generate builders for java models

Link copied to clipboard
val generateOptionalOperationVariables: Boolean

Whether to generate operation variables as com.apollographql.apollo3.api.Optional

Link copied to clipboard
val generatePrimitiveTypes: Boolean

Whether to generate fields as primitive types (int, double, boolean) instead of their boxed types (Integer, Double, Boolean) when possible.

Link copied to clipboard
val generateQueryDocument: Boolean

Whether to embed the query document in the com.apollographql.apollo3.api.Operations. By default this is true as it is needed to send the operations to the server. If performance is critical and you have a way to whitelist/read the document from another place, disable this.

Link copied to clipboard
val generateResponseFields: Boolean

Whether to generate the compiled selections used to read/write from the normalized cache. Disable this option if you don't use the normalized cache to save some bytecode

Link copied to clipboard
val generateSchema: Boolean

Whether to generate the Schema class.

Link copied to clipboard
val generateTestBuilders: Boolean

Whether to generate the type safe Data builders. These are mainly used for tests but can also be used for other use cases too.

Link copied to clipboard
val incomingCompilerMetadata: List<CompilerMetadata>

The metadata from upstream

Link copied to clipboard
val logger: ApolloCompiler.Logger
Link copied to clipboard
val nullableFieldStyle: JavaNullable

The style to use for fields that are nullable in the Java generated code.

Link copied to clipboard
val operationManifestFile: File? = null

the file where to write the operationOutput or null if no operationOutput is required OperationOutput represents the modified operations as they are sent to the server. This is useful for whitelisting/ persisted queries

Link copied to clipboard
val operationManifestFormat: String
Link copied to clipboard
val operationOutputGenerator: OperationOutputGenerator

the OperationOutputGenerator used to generate operation Ids

Link copied to clipboard
val outputDir: File

The directory where to write the generated models

Link copied to clipboard
val packageNameGenerator: PackageNameGenerator

The package name used for operations

Link copied to clipboard
val requiresOptInAnnotation: String?
Link copied to clipboard
val scalarMapping: Map<String, ScalarInfo>
Link copied to clipboard
val schema: Schema

The schema as obtained by toGQLDocument.toSchema

Link copied to clipboard
val schemaPackageName: String

The package name used as a base for input objects, fragments, enums and types

Link copied to clipboard
val sealedClassesForEnumsMatching: List<String>

A list of Regex patterns for GraphQL enums that should be generated as Kotlin sealed classes instead of the default Kotlin enums.

Link copied to clipboard
val targetLanguage: TargetLanguage
Link copied to clipboard
val testDir: File

The directory where to write the generated models test code

Link copied to clipboard
val useSchemaPackageNameForFragments: Boolean

Whether to use the schemaPackageName for fragments

Link copied to clipboard
val useSemanticNaming: Boolean
Link copied to clipboard
val warnOnDeprecatedUsages: Boolean