Package-level declarations

Types

Link copied to clipboard
class AnonymousOperation(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue
Link copied to clipboard
interface ApolloIssue : Issue

A custom issue specific to the Apollo compiler

Link copied to clipboard
data class Catch(val to: CatchTo, val levels: List<Int>?)
Link copied to clipboard
Link copied to clipboard
class ConditionalFragment(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue

A fragment has an @include or @skip directive. While this is valid GraphQL, the responseBased codegen does not support that

Link copied to clipboard
class ConversionException(val error: String, val sourceLocation: SourceLocation? = null) : SourceAwareException

An exception while converting to/from introspection

Link copied to clipboard
class DeprecatedUsage(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue

A deprecated field/enum is used

Link copied to clipboard
class DifferentShape(val message: String, val sourceLocation: SourceLocation?) : GraphQLValidationIssue

Fields have different shapes and cannot be merged

Link copied to clipboard
class DirectiveRedefinition(val name: String, existingSourceLocation: SourceLocation?, val sourceLocation: SourceLocation?) : GraphQLValidationIssue
Link copied to clipboard
class DuplicateDeferLabel(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue
Link copied to clipboard
class DuplicateTypeName(val message: String, val sourceLocation: SourceLocation?) : GraphQLValidationIssue

Two type definitions have the same name

Link copied to clipboard
class ExecutableValidationResult(val fragmentVariableUsages: Map<String, List<VariableUsage>>, val issues: List<Issue>)
Link copied to clipboard
class GQLArgument(val sourceLocation: SourceLocation? = null, val name: String, val value: GQLValue) : GQLNode, GQLNamed
Link copied to clipboard
class GQLArguments(val arguments: List<GQLArgument>, val sourceLocation: SourceLocation? = null) : GQLNode
Link copied to clipboard
class GQLBooleanValue(val sourceLocation: SourceLocation? = null, val value: Boolean) : GQLValue
Link copied to clipboard
Link copied to clipboard
interface GQLDescribed

A GQLNode that has a description

Link copied to clipboard
class GQLDirective(val sourceLocation: SourceLocation? = null, val name: String, val arguments: List<GQLArgument>) : GQLNode, GQLNamed
Link copied to clipboard
class GQLDirectiveDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val arguments: List<GQLInputValueDefinition>, val repeatable: Boolean, val locations: List<GQLDirectiveLocation>) : GQLDefinition, GQLDescribed, GQLNamed
Link copied to clipboard
class GQLDocument(val definitions: List<GQLDefinition>, val sourceLocation: SourceLocation?) : GQLNode

The top level node in a GraphQL document. This can be a schema document or an executable document (or something else if need be)

Link copied to clipboard
class GQLEnumTypeDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val directives: List<GQLDirective>, val enumValues: List<GQLEnumValueDefinition>) : GQLTypeDefinition
Link copied to clipboard
class GQLEnumTypeExtension(val sourceLocation: SourceLocation? = null, val name: String, val directives: List<GQLDirective>, val enumValues: List<GQLEnumValueDefinition>) : GQLDefinition, GQLTypeExtension, GQLHasDirectives
Link copied to clipboard
class GQLEnumValue(val sourceLocation: SourceLocation? = null, val value: String) : GQLValue
Link copied to clipboard
class GQLEnumValueDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val directives: List<GQLDirective>) : GQLNode, GQLDescribed, GQLNamed, GQLHasDirectives
Link copied to clipboard
Link copied to clipboard
class GQLField @ApolloExperimental constructor(val sourceLocation: SourceLocation? = null, val alias: String?, val name: String, val arguments: List<GQLArgument>, val directives: List<GQLDirective>, val selections: List<GQLSelection>) : GQLSelection, GQLNamed, GQLHasDirectives
Link copied to clipboard
class GQLFieldDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val arguments: List<GQLInputValueDefinition>, val type: GQLType, val directives: List<GQLDirective>) : GQLNode, GQLDescribed, GQLNamed, GQLHasDirectives
Link copied to clipboard
class GQLFloatValue(val sourceLocation: SourceLocation? = null, val value: String) : GQLValue
Link copied to clipboard
class GQLFragmentDefinition(val sourceLocation: SourceLocation? = null, val name: String, val directives: List<GQLDirective>, val typeCondition: GQLNamedType, val selections: List<GQLSelection>, val description: String?) : GQLExecutableDefinition, GQLNamed, GQLDescribed, GQLHasDirectives
Link copied to clipboard
class GQLFragmentSpread(val sourceLocation: SourceLocation? = null, val name: String, val directives: List<GQLDirective>) : GQLSelection, GQLNamed, GQLHasDirectives
Link copied to clipboard
Link copied to clipboard
class GQLInlineFragment(val sourceLocation: SourceLocation? = null, val typeCondition: GQLNamedType?, val directives: List<GQLDirective>, val selections: List<GQLSelection>) : GQLSelection, GQLHasDirectives
Link copied to clipboard
class GQLInputObjectTypeDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val directives: List<GQLDirective>, val inputFields: List<GQLInputValueDefinition>) : GQLTypeDefinition
Link copied to clipboard
class GQLInputObjectTypeExtension(val sourceLocation: SourceLocation? = null, val name: String, val directives: List<GQLDirective>, val inputFields: List<GQLInputValueDefinition>) : GQLDefinition, GQLTypeExtension, GQLHasDirectives
Link copied to clipboard
class GQLInputValueDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val directives: List<GQLDirective>, val type: GQLType, val defaultValue: GQLValue?) : GQLNode, GQLDescribed, GQLNamed, GQLHasDirectives
Link copied to clipboard
class GQLInterfaceTypeDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val implementsInterfaces: List<String>, val directives: List<GQLDirective>, val fields: List<GQLFieldDefinition>) : GQLTypeDefinition
Link copied to clipboard
class GQLInterfaceTypeExtension(val sourceLocation: SourceLocation? = null, val name: String, val implementsInterfaces: List<String>, val directives: List<GQLDirective>, val fields: List<GQLFieldDefinition>) : GQLDefinition, GQLTypeExtension, GQLNamed, GQLHasDirectives
Link copied to clipboard
class GQLIntValue(val sourceLocation: SourceLocation? = null, val value: String) : GQLValue
Link copied to clipboard
class GQLListType(val sourceLocation: SourceLocation? = null, val type: GQLType) : GQLType
Link copied to clipboard
class GQLListValue(val sourceLocation: SourceLocation? = null, val values: List<GQLValue>) : GQLValue
Link copied to clipboard
interface GQLNamed

A GQLNode that has a name

Link copied to clipboard
class GQLNamedType(val sourceLocation: SourceLocation? = null, val name: String) : GQLType, GQLNamed
Link copied to clipboard
interface GQLNode

A node in the GraphQL AST.

Link copied to clipboard
class GQLNonNullType(val sourceLocation: SourceLocation? = null, val type: GQLType) : GQLType
Link copied to clipboard
class GQLNullValue(val sourceLocation: SourceLocation? = null) : GQLValue
Link copied to clipboard
class GQLObjectField(val sourceLocation: SourceLocation? = null, val name: String, val value: GQLValue) : GQLNode, GQLNamed
Link copied to clipboard
class GQLObjectTypeDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val implementsInterfaces: List<String>, val directives: List<GQLDirective>, val fields: List<GQLFieldDefinition>) : GQLTypeDefinition
Link copied to clipboard
class GQLObjectTypeExtension(val sourceLocation: SourceLocation? = null, val name: String, val implementsInterfaces: List<String>, val directives: List<GQLDirective>, val fields: List<GQLFieldDefinition>) : GQLDefinition, GQLTypeExtension, GQLHasDirectives
Link copied to clipboard
class GQLObjectValue(val sourceLocation: SourceLocation? = null, val fields: List<GQLObjectField>) : GQLValue
Link copied to clipboard
class GQLOperationDefinition(val sourceLocation: SourceLocation? = null, val operationType: String, val name: String?, val variableDefinitions: List<GQLVariableDefinition>, val directives: List<GQLDirective>, val selections: List<GQLSelection>, val description: String?) : GQLExecutableDefinition, GQLDescribed, GQLHasDirectives
Link copied to clipboard
class GQLOperationTypeDefinition(val sourceLocation: SourceLocation? = null, val operationType: String, val namedType: String) : GQLNode
Link copied to clipboard
class GQLResult<out V : Any>(val value: V?, val issues: List<Issue>)

The result of a parsing or validation operation. It's tri-state:

Link copied to clipboard
class GQLScalarTypeDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val directives: List<GQLDirective>) : GQLTypeDefinition
Link copied to clipboard
class GQLScalarTypeExtension(val sourceLocation: SourceLocation? = null, val name: String, val directives: List<GQLDirective>) : GQLDefinition, GQLTypeExtension, GQLHasDirectives
Link copied to clipboard
class GQLSchemaDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val directives: List<GQLDirective>, val rootOperationTypeDefinitions: List<GQLOperationTypeDefinition>) : GQLDefinition, GQLDescribed, GQLHasDirectives
Link copied to clipboard
class GQLSchemaExtension(val sourceLocation: SourceLocation? = null, val directives: List<GQLDirective>, val operationTypeDefinitions: List<GQLOperationTypeDefinition>) : GQLDefinition, GQLTypeSystemExtension, GQLHasDirectives
Link copied to clipboard
sealed class GQLSelection : GQLNode
Link copied to clipboard
Link copied to clipboard
class GQLStringValue(val sourceLocation: SourceLocation? = null, val value: String) : GQLValue
Link copied to clipboard
sealed class GQLType : GQLNode
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class GQLUnionTypeDefinition(val sourceLocation: SourceLocation? = null, val description: String?, val name: String, val directives: List<GQLDirective>, val memberTypes: List<GQLNamedType>) : GQLTypeDefinition
Link copied to clipboard
class GQLUnionTypeExtension(val sourceLocation: SourceLocation? = null, val name: String, val directives: List<GQLDirective>, val memberTypes: List<GQLNamedType>) : GQLDefinition, GQLTypeExtension, GQLHasDirectives
Link copied to clipboard
sealed class GQLValue : GQLNode
Link copied to clipboard
class GQLVariableDefinition(val sourceLocation: SourceLocation? = null, val name: String, val type: GQLType, val defaultValue: GQLValue?, val directives: List<GQLDirective>) : GQLNode, GQLNamed, GQLHasDirectives

A variable definition is very similar to an InputValue definition except it doesn't have a description

Link copied to clipboard
class GQLVariableValue(val sourceLocation: SourceLocation? = null, val name: String) : GQLValue, GQLNamed
Link copied to clipboard
interface GraphQLIssue : Issue

An issue from the GraphQL spec

Link copied to clipboard

A validation issue from the GraphQL spec

Link copied to clipboard
class IncompatibleDefinition(name: String, expectedDefinition: String, val sourceLocation: SourceLocation?) : GraphQLValidationIssue

The definition is inconsistent with the expected one.

Link copied to clipboard
class InferredVariable(val name: String, val type: GQLType)

A variable that is inferred from its usages in fragments This is used to create executable fragments

Link copied to clipboard
class InlineFragmentWithoutTypeCondition(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue

The GraphQL spec allows inline fragments without a type condition, but we currently forbid this because we need the type condition to name the models in operation based codegen.

Link copied to clipboard
class InvalidDeferDirective(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue
Link copied to clipboard
class InvalidDeferLabel(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue
Link copied to clipboard
interface Issue

All the issues that can be collected while analyzing a graphql document

Link copied to clipboard
class MergeOptions(val allowFieldNullabilityModification: Boolean)
Link copied to clipboard
class NodeContainer(nodes: List<GQLNode>)
Link copied to clipboard
Link copied to clipboard
class NoQueryType(val message: String, val sourceLocation: SourceLocation?) : GraphQLValidationIssue
Link copied to clipboard
class OtherValidationIssue(val message: String, val sourceLocation: SourceLocation?) : GraphQLValidationIssue

Another GraphQL validation error as per the spec

Link copied to clipboard
Link copied to clipboard
class ParsingError(val message: String, val sourceLocation: SourceLocation?) : GraphQLIssue

A grammar error

Link copied to clipboard
Link copied to clipboard
class ReservedEnumValueName(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue

Certain enum value names such as type are reserved for Apollo.

Link copied to clipboard
class Schema

A wrapper around a schema GQLDocument that ensures the GQLDocument is valid and caches some extra information. In particular, Schema:

Link copied to clipboard
class SchemaValidationException(val error: String, val sourceLocation: SourceLocation? = null) : SourceAwareException

The schema is invalid

Link copied to clipboard
open class SDLWriter(sink: BufferedSink, indent: String) : Closeable

A SDLWriter writes utf8 text to the given sink and supports indent/unindent

Link copied to clipboard
open class SourceAwareException(val error: String, val sourceLocation: SourceLocation?) : RuntimeException
Link copied to clipboard
class SourceLocation(val start: Int, val end: Int, val line: Int, val column: Int, val filePath: String?)
Link copied to clipboard
Link copied to clipboard
class UnknownDirective constructor(val message: String, val sourceLocation: SourceLocation?, val requireDefinition: Boolean) : GraphQLValidationIssue

An unknown directive was found.

Link copied to clipboard
class UnusedFragment(val message: String, val sourceLocation: SourceLocation?) : GraphQLValidationIssue
Link copied to clipboard
class UnusedVariable(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue

A variable is unused

Link copied to clipboard
class UpperCaseField(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue

When models are nested, upper case fields are not supported as Kotlin doesn't allow a property name with the same name as a nested class. If this happens, the easiest solution is to add an alias with a lower case first letter. If there are a lot of such fields, the Apollo compiler option flattenModels can also be used to circumvent this error at the price of possible suffixes in model names.

Link copied to clipboard
class VariableDeferLabel(val message: String, val sourceLocation: SourceLocation?) : ApolloIssue
Link copied to clipboard
class VariableUsage(val variable: GQLVariableValue, val locationType: GQLType, val hasLocationDefaultValue: Boolean, val isOneOfInputField: Boolean)

A variable used in a GQLValue

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Definitions from the spec

Link copied to clipboard

Checks that a list of issue is empty, regardless of the issues. This may throw on Apollo specific issues.

Link copied to clipboard

Checks that a list of issues is valid GraphQL per the spec. This ignores any ApolloIssue

Link copied to clipboard

For a GQLValue used in input position, validate that it can be coerced to expectedType and coerce it at the same time.

Link copied to clipboard

For a GQLValue used in input position, validate that it can be coerced to expectedType and coerce it at the same time.

Link copied to clipboard
Link copied to clipboard

https://spec.graphql.org/draft/#EscapedCharacter

Link copied to clipboard
fun GQLField.findCatch(fieldDefinition: GQLFieldDefinition, schema: Schema): Catch?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun GQLTypeDefinition.isFieldNonNull(fieldName: String, schema: Schema? = null): Boolean
Link copied to clipboard

Extra apollo Kotlin specific definitions from https://specs.apollo.dev/kotlin_labs/<[version]>

Link copied to clipboard
Link copied to clipboard

The @link definition for bootstrapping

Link copied to clipboard
Link copied to clipboard

Extra nullability definitions from https://specs.apollo.dev/nullability/<[version]>

Link copied to clipboard
Link copied to clipboard
fun String.parseAsGQLDocument(options: ParserOptions = ParserOptions.Default): GQLResult<GQLDocument>

fun BufferedSource.parseAsGQLDocument(filePath: String? = null, options: ParserOptions = ParserOptions.Default): GQLResult<GQLDocument>

Parses the source to a GQLDocument, validating the syntax but not the contents of the document.

fun Path.parseAsGQLDocument(options: ParserOptions = ParserOptions.Default): GQLResult<GQLDocument>
fun File.parseAsGQLDocument(options: <Error class: unknown class> = ParserOptions.Default): <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
fun String.parseAsGQLSelections(options: ParserOptions = ParserOptions.Default): GQLResult<List<GQLSelection>>

fun BufferedSource.parseAsGQLSelections(filePath: String? = null, options: ParserOptions = ParserOptions.Default): GQLResult<List<GQLSelection>>

Parses the source to a List<GQLSelection>, validating the syntax but not the contents of the selections.

Link copied to clipboard
fun String.parseAsGQLType(options: ParserOptions = ParserOptions.Default): GQLResult<GQLType>

fun BufferedSource.parseAsGQLType(filePath: String? = null, options: ParserOptions = ParserOptions.Default): GQLResult<GQLType>

Parses the source to a GQLType, validating the syntax but not the contents of the value.

Link copied to clipboard
fun String.parseAsGQLValue(options: ParserOptions = ParserOptions.Default): GQLResult<GQLValue>

fun BufferedSource.parseAsGQLValue(filePath: String? = null, options: ParserOptions = ParserOptions.Default): GQLResult<GQLValue>

Parses the source to a GQLValue, validating the syntax but not the contents of the value.

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

Returns the raw type. The raw type is the GQLNamedType without any list/nonnull wrapper types

Link copied to clipboard
Link copied to clipboard
fun BufferedSource.toExecutableDocument(schema: Schema, filePath: String? = null): GQLDocument

Parses the source to a List<GQLDefinition>, throwing on parsing or validation errors.

Link copied to clipboard

Returns a "full schema" document. Full schema documents are for use by clients and other tools that need to know what features are supported by a given server. They include builtin directives and merge all type extensions

Link copied to clipboard
fun String.toGQLDocument(options: ParserOptions = ParserOptions.Default): GQLDocument
fun Path.toGQLDocument(options: ParserOptions = ParserOptions.Default, allowJson: Boolean = false): GQLDocument
fun File.toGQLDocument(options: <Error class: unknown class> = ParserOptions.Default, allowJson: Boolean = false): <Error class: unknown class>
Link copied to clipboard
fun String.toGQLSelections(options: ParserOptions = ParserOptions.Default): List<GQLSelection>
Link copied to clipboard
fun String.toGQLType(options: ParserOptions = ParserOptions.Default): GQLType
Link copied to clipboard
fun String.toGQLValue(options: ParserOptions = ParserOptions.Default): GQLValue
Link copied to clipboard
Link copied to clipboard
fun File.toSchema(allowJson: Boolean = false): <Error class: unknown class>
Link copied to clipboard

Outputs a schema document to SDL. For executable documents, use toUtf8()

Link copied to clipboard
fun GQLNode.toUtf8(indent: String = " "): String
fun GQLNode.toUtf8(sink: BufferedSink, indent: String = " ")
fun <Error class: unknown class>.toUtf8(file: File, indent: String = " "): <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard

Validates the given document as an executable document.

Link copied to clipboard

Validate the given document as a schema:

Link copied to clipboard

Add builtin definitions from the latest spec version to the GQLDocument