Package com.apollographql.apollo3.compiler

Types

Link copied to clipboard
@JsonClass(generateAdapter = true, generator = "sealed:type")
interface AdapterInitializer

Controls how scalar adapters are used in the generated code.

Link copied to clipboard
object ApolloCompiler
Link copied to clipboard
@JsonClass(generateAdapter = true)
data class ApolloMetadata(    val commonMetadata: CommonMetadata?,     val compilerMetadata: CompilerMetadata,     val moduleName: String)

metadata generated by a previous run of ApolloCompiler. The schema and fragments are stored as GraphQL document strings. This slightly unfortunate because that means we will parse them twice but there isn't many alternatives as validation and IR-building takes GQLDocuments as inputs. A future version could serialize GQLNode as json in order to keep the SourceLocation attributes and display better error messages

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class CommonMetadata(    val schema: Schema,     val schemaPackageName: String,     val pluginVersion: String,     val codegenModels: String,     val scalarMapping: Map<String, ScalarInfo>)

Options that must be common to all modules

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class CompilerMetadata(val fragments: List<GQLFragmentDefinition>, val resolverInfo: ResolverInfo)

Compilation unit specific metadata that is specific to a given invocation of the compiler

Link copied to clipboard
@JsonClass(generateAdapter = true)
class ExpressionAdapterInitializer(val expression: String) : AdapterInitializer

The adapter expression will be used as-is (can be an object, a public val, a class instantiation).

Link copied to clipboard
class IncomingOptions(    val schema: Schema,     val codegenModels: String,     val schemaPackageName: String)

These are the options that should be the same in all modules.

Link copied to clipboard
enum JavaNullable : Enum<JavaNullable>
Link copied to clipboard
interface OperationIdGenerator
Link copied to clipboard
interface OperationOutputGenerator

A class that generates OperationOutput to compute the operationIds. OperationOutputGenerator works with a collection of OperationDescriptor for implementation that need to batch compute the operationIds. For an example to send all the operation at once to a backend for whitelisting.

Link copied to clipboard
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)
Link copied to clipboard
interface PackageNameGenerator

A PackageNameGenerator computes the package name for a given file. Files can be either

Link copied to clipboard
class Roots(rootFolders: Collection<File>)

A helper class to get a package name from a list of root folders

Link copied to clipboard
object RuntimeAdapterInitializer : AdapterInitializer

The adapter instance will be looked up in the com.apollographql.apollo3.api.CustomScalarAdapters provided at runtime.

Link copied to clipboard
@JsonClass(generateAdapter = true)
data class ScalarInfo(val targetName: String, val adapterInitializer: AdapterInitializer = RuntimeAdapterInitializer)
Link copied to clipboard
enum TargetLanguage : Enum<TargetLanguage>

Functions

Link copied to clipboard
fun String.capitalizeFirstLetter(): String

A variation of String.capitalize that:

Link copied to clipboard
fun checkCapitalizedFields(definitions: List<GQLDefinition>, checkFragmentsOnly: Boolean): List<Issue>
Link copied to clipboard
fun String.decapitalizeFirstLetter(): String

A variation of String.decapitalize that:

Link copied to clipboard
fun String.escapeJavaReservedWord(): String
Link copied to clipboard
fun String.escapeKotlinReservedWord(): String
Link copied to clipboard
fun String.escapeKotlinReservedWordInEnum(): String
Link copied to clipboard
fun String.escapeKotlinReservedWordInSealedClass(): String
Link copied to clipboard
inline fun <T> JsonReader.fromJson(): T
inline fun <T> File.fromJson(): T
inline fun <T> InputStream.fromJson(): T
inline fun <T> String.fromJson(): T
Link copied to clipboard
inline fun <T> File.fromJsonList(): List<T>
inline fun <T> InputStream.fromJsonList(): List<T>
inline fun <T> String.fromJsonList(): List<T>
Link copied to clipboard
inline fun <T> getJsonAdapter(): JsonAdapter<T>
Link copied to clipboard
inline fun <T> getJsonListAdapter(): JsonAdapter<List<T>>
Link copied to clipboard
inline fun <T> T.toJson(indent: String = ""): String
inline fun <T> T.toJson(file: File, indent: String = "")
Link copied to clipboard
fun File.toUsedCoordinates(): Set<String>
Link copied to clipboard
fun Set<String>.writeTo(file: File)

Properties

Link copied to clipboard
const val ADD_TYPENAME_ALWAYS: String
Link copied to clipboard
const val ADD_TYPENAME_IF_ABSTRACT: String
Link copied to clipboard
const val ADD_TYPENAME_IF_FRAGMENTS: String
Link copied to clipboard
const val ADD_TYPENAME_IF_POLYMORPHIC: String
Link copied to clipboard
const val MANIFEST_NONE: String
Link copied to clipboard
const val MANIFEST_OPERATION_OUTPUT: String
Link copied to clipboard
const val MANIFEST_PERSISTED_QUERY: String
Link copied to clipboard
const val MODELS_COMPAT: String
Link copied to clipboard
const val MODELS_OPERATION_BASED: String
Link copied to clipboard
const val MODELS_OPERATION_BASED_WITH_INTERFACES: String
Link copied to clipboard
const val MODELS_RESPONSE_BASED: String
Link copied to clipboard
val MOSHI: Moshi