IrOperations

@Serializable
data class IrOperations(val operations: List<IrOperation>, val fragments: List<IrFragmentDefinition>, val usedCoordinates: UsedCoordinates, val flattenModels: Boolean, val decapitalizeFields: Boolean, val codegenModels: String, val fragmentDefinitions: List<@Serializable(with = GQLFragmentDefinitionSerializer::class) GQLFragmentDefinition>)

Intermediate representation (IR)

Compared to the GraphQL AST, the IR:

  • Transforms com.apollographql.apollo.ast.GQLField into IrProperty and IrModel

  • moves @include/@skip directives on inline fragments and object fields to their children selections

  • interprets @deprecated directives

  • coerces argument values and resolves defaultValue

  • infers fragment variables

  • registers used types and fragments

  • more generally removes all references to the GraphQL AST and "embeds" type definitions/field definitions

Additional notes:

  • In order to ensure reproducibility, prefer using List instead of Set so that the order is guaranteed

  • The IR doesn't escape identifiers because different targets might have different escaping rules. The names found in the IR are as found in the GraphQL documents

Constructors

Link copied to clipboard
constructor(operations: List<IrOperation>, fragments: List<IrFragmentDefinition>, usedCoordinates: UsedCoordinates, flattenModels: Boolean, decapitalizeFields: Boolean, codegenModels: String, fragmentDefinitions: List<@Serializable(with = GQLFragmentDefinitionSerializer::class) GQLFragmentDefinition>)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
@JvmName(name = "writeIrOperations")
fun IrOperations.writeTo(file: File)