From 6007ad17425687de270942e30ceaf5f174f201e6 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Sat, 25 Nov 2023 22:42:56 +0100 Subject: [PATCH 01/42] add nullability foreign schema --- .../apollographql/apollo3/ast/gqldocument.kt | 17 +++++- .../ast/internal/SchemaValidationScope.kt | 15 +++-- .../apollo3/ast/internal/definitions.kt | 60 ++++++++++++++++++- 3 files changed, 84 insertions(+), 8 deletions(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldocument.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldocument.kt index 28ca129e506..6d5e274471a 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldocument.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldocument.kt @@ -3,10 +3,11 @@ package com.apollographql.apollo3.ast import com.apollographql.apollo3.annotations.ApolloDeprecatedSince import com.apollographql.apollo3.annotations.ApolloExperimental import com.apollographql.apollo3.ast.internal.ExtensionsMerger -import com.apollographql.apollo3.ast.internal.apolloDefinitionsStr import com.apollographql.apollo3.ast.internal.builtinsDefinitionsStr import com.apollographql.apollo3.ast.internal.ensureSchemaDefinition +import com.apollographql.apollo3.ast.internal.kotlinLabsDefinitions import com.apollographql.apollo3.ast.internal.linkDefinitionsStr +import com.apollographql.apollo3.ast.internal.nullabilityDefinitionsStr import okio.Buffer /** @@ -79,15 +80,25 @@ fun builtinDefinitions() = definitionsFromString(builtinsDefinitionsStr) fun linkDefinitions() = definitionsFromString(linkDefinitionsStr) /** - * Extra apollo specific definitions from https://specs.apollo.dev/kotlin_labs/<[version]> + * Extra apollo Kotlin specific definitions from https://specs.apollo.dev/kotlin_labs/<[version]> */ fun kotlinLabsDefinitions(version: String): List { return definitionsFromString(when (version) { - "v0.2" -> apolloDefinitionsStr + "v0.2" -> kotlinLabsDefinitions else -> error("kotlin_labs/$version definitions are not supported, please use v0.2") }) } +/** + * Extra nullability definitions from https://specs.apollo.dev/nullability/<[version]> + */ +fun nullabilityDefinitions(version: String): List { + return definitionsFromString(when (version) { + "v0.1" -> nullabilityDefinitionsStr + else -> error("nullability/$version definitions are not supported, please use v0.1") + }) +} + private fun definitionsFromString(string: String): List { return string .parseAsGQLDocument() diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt index 56a80186ac2..2c4c21023f2 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt @@ -28,20 +28,21 @@ import com.apollographql.apollo3.ast.GQLTypeDefinition import com.apollographql.apollo3.ast.GQLTypeDefinition.Companion.builtInTypes import com.apollographql.apollo3.ast.GQLTypeSystemExtension import com.apollographql.apollo3.ast.GQLUnionTypeDefinition +import com.apollographql.apollo3.ast.IncompatibleDirectiveDefinition import com.apollographql.apollo3.ast.Issue import com.apollographql.apollo3.ast.MergeOptions import com.apollographql.apollo3.ast.NoQueryType import com.apollographql.apollo3.ast.OtherValidationIssue import com.apollographql.apollo3.ast.Schema import com.apollographql.apollo3.ast.Schema.Companion.TYPE_POLICY -import com.apollographql.apollo3.ast.IncompatibleDirectiveDefinition -import com.apollographql.apollo3.ast.kotlinLabsDefinitions import com.apollographql.apollo3.ast.builtinDefinitions import com.apollographql.apollo3.ast.canHaveKeyFields import com.apollographql.apollo3.ast.combineDefinitions import com.apollographql.apollo3.ast.findOneOf import com.apollographql.apollo3.ast.introspection.defaultSchemaDefinition +import com.apollographql.apollo3.ast.kotlinLabsDefinitions import com.apollographql.apollo3.ast.linkDefinitions +import com.apollographql.apollo3.ast.nullabilityDefinitions import com.apollographql.apollo3.ast.parseAsGQLSelections import com.apollographql.apollo3.ast.pretty import com.apollographql.apollo3.ast.rawType @@ -329,8 +330,14 @@ private fun List.getForeignSchemas( }.toMap() - if (foreignName == "kotlin_labs") { - val (definitions, renames) = kotlinLabsDefinitions(version).rename(mappings, prefix) + val foreignDefinitions = when (foreignName) { + "kotlin_labs" -> kotlinLabsDefinitions(version) + "nullability" -> nullabilityDefinitions(version) + else -> null + } + + if (foreignDefinitions != null) { + val (definitions, renames) = foreignDefinitions.rename(mappings, prefix) foreignSchemas.add( ForeignSchema( name = foreignName, diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index edc25719a2a..52165037e69 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -7,7 +7,7 @@ package com.apollographql.apollo3.ast.internal * - link.graphqls: the [core schemas](https://specs.apollo.dev/link/v1.0/) definitions. * - apollo-${version}.graphqls: the client directives supported by Apollo Kotlin. Changes are versioned at https://github.com/apollographql/specs. Changing them requires a new version and a PR. */ -internal val apolloDefinitionsStr = """ +internal val kotlinLabsDefinitions = """ ""${'"'} Marks a field or variable definition as optional or required By default Apollo Kotlin generates all variables of nullable types as optional, in compliance with the GraphQL specification, @@ -254,4 +254,62 @@ internal val linkDefinitionsStr = """ import: [Import], for: Purpose ) repeatable on SCHEMA +""".trimIndent() + +val nullabilityDefinitionsStr = """ + ""${'"'} + Indicates that a field is only null if there is a matching error in the `errors` array. + In all other cases, the field is non-null. + + Tools doing code generation may use this information to generate the field as non-null. + + This directive can be applied on field definitions: + + ```graphql + type User { + email @nullOnlyOnError + } + ``` + + It can also be applied on object type extensions for use in client applications that do + not own the base schema: + + ```graphql + extend type User @nullOnlyOnError(field: "email") + ``` + + Control over list items is done using the `level` argument: + + ```graphql + type User { + # friends is nullable but friends[1] is null only on errors + friends @nullOnlyOnError(level: 1) + } + ``` + + @param field the name of the field if applied to an object definition or null if applied + to a field definition + + @param level in case of a list type, level is the dimension where to apply the modifier, + starting at 0 if there is no list. + If level is null, the modifier is applied to all levels + ""${'"'} + directive @nullOnlyOnError(field: String = null, level: Int = null) on FIELD_DEFINITION | OBJECT + + ""${'"'} + Indicates that a field acts as an error boundary in case of a GraphQL error. + + By default, the first GraphQL error throw and fail the whole response. + + @param level in case of a list type, level is the dimension where to apply the modifier, + starting at 0 if there is no list. + If level is null, the modifier is applied to all levels + ""${'"'} + directive @catch(level: Int = null) on FIELD + + enum CatchTo { + NULL, + THROW, + RESULT + } """.trimIndent() \ No newline at end of file From 7aaeed7d5100e2456722ed27116eb863c4f34c27 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Sat, 25 Nov 2023 23:03:32 +0100 Subject: [PATCH 02/42] add FieldResult and various catchTo adapters --- .../com/apollographql/apollo3/api/Adapters.kt | 116 +++++++++++++++--- .../apollo3/api/CustomScalarAdapters.kt | 32 ++++- .../apollographql/apollo3/api/FieldResult.kt | 20 +++ .../apollo3/exception/Exceptions.kt | 7 +- 4 files changed, 157 insertions(+), 18 deletions(-) create mode 100644 libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index d1e7f168481..12e47c19c6b 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.json.MapJsonWriter import com.apollographql.apollo3.api.json.buildJsonString import com.apollographql.apollo3.api.json.readAny import com.apollographql.apollo3.api.json.writeAny +import com.apollographql.apollo3.exception.ApolloGraphQLException import kotlin.jvm.JvmField import kotlin.jvm.JvmName import kotlin.jvm.JvmOverloads @@ -80,7 +81,7 @@ class OptionalAdapter(private val wrappedAdapter: Adapter) : Adapter(private val wrappedAdapter: Adapter) : Adapter } } -@JvmName("-obj") -fun Adapter.obj(buffered: Boolean = false) = ObjectAdapter(this, buffered) - @JvmField val StringAdapter = object : Adapter { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): String { @@ -283,12 +281,6 @@ val ApolloOptionalBooleanAdapter = ApolloOptionalAdapter(BooleanAdapter) @JvmField val ApolloOptionalAnyAdapter = ApolloOptionalAdapter(AnyAdapter) -@JvmName("-nullable") -fun Adapter.nullable() = NullableAdapter(this) - -@JvmName("-list") -fun Adapter.list() = ListAdapter(this) - /** * Note that Arrays require their type to be known at compile time, so we construct an anonymous object with reference to * function with reified type parameters as a workaround. @@ -297,7 +289,11 @@ fun Adapter.list() = ListAdapter(this) @JvmName("-array") inline fun Adapter.array() = object : Adapter> { - private inline fun arrayFromJson(wrappedAdapter: Adapter, reader: JsonReader, customScalarAdapters: CustomScalarAdapters): Array { + private inline fun arrayFromJson( + wrappedAdapter: Adapter, + reader: JsonReader, + customScalarAdapters: CustomScalarAdapters, + ): Array { reader.beginArray() val list = mutableListOf() while (reader.hasNext()) { @@ -311,7 +307,7 @@ inline fun Adapter.array() = object : Adapter> { wrappedAdapter: Adapter, writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, - value: Array + value: Array, ) { writer.beginArray() value.forEach { @@ -363,14 +359,14 @@ class ObjectAdapter( } } - override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: T, ) { + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: T) { if (buffered && writer !is MapJsonWriter) { /** * Convert to a Map first */ val mapWriter = MapJsonWriter() mapWriter.beginObject() - wrappedAdapter.toJson(mapWriter, customScalarAdapters, value, ) + wrappedAdapter.toJson(mapWriter, customScalarAdapters, value) mapWriter.endObject() /** @@ -379,8 +375,96 @@ class ObjectAdapter( writer.writeAny(mapWriter.root()!!) } else { writer.beginObject() - wrappedAdapter.toJson(writer, customScalarAdapters, value,) + wrappedAdapter.toJson(writer, customScalarAdapters, value) writer.endObject() } } -} \ No newline at end of file +} + +class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter> { + override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): FieldResult { + if (reader.peek() == JsonReader.Token.NULL) { + val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) + if (error != null) { + reader.skipValue() + return FieldResult.Error(error) + } + } + + return try { + FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) + } catch (e: ApolloGraphQLException) { + FieldResult.Error(e.error) + } + } + + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: FieldResult) { + when (value) { + is FieldResult.Success -> wrappedAdapter.toJson(writer, customScalarAdapters, value.valueOrThrow()) + else -> Unit // ignore errors + } + } +} + +class CatchToThrowAdapter(private val wrappedAdapter: Adapter) : Adapter { + override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { + if (reader.peek() == JsonReader.Token.NULL) { + val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) + if (error != null) { + reader.skipValue() + throw ApolloGraphQLException(error) + } + } + + return try { + wrappedAdapter.fromJson(reader, customScalarAdapters) + } catch (e: ApolloGraphQLException) { + throw e + } + } + + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: T) { + wrappedAdapter.toJson(writer, customScalarAdapters, value) + } +} + +class CatchToNullAdapter(private val wrappedAdapter: Adapter) : Adapter<@JvmSuppressWildcards T?> { + override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T? { + val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) + if (error != null) { + return null + } + + return try { + wrappedAdapter.fromJson(reader, customScalarAdapters) + } catch (e: ApolloGraphQLException) { + null + } + } + + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: T?) { + if (value == null) { + writer.nullValue() + } else { + wrappedAdapter.toJson(writer, customScalarAdapters, value) + } + } +} + +@JvmName("-nullable") +fun Adapter.nullable() = NullableAdapter(this) + +@JvmName("-list") +fun Adapter.list() = ListAdapter(this) + +@JvmName("-obj") +fun Adapter.obj(buffered: Boolean = false) = ObjectAdapter(this, buffered) + +@JvmName("-result") +fun Adapter.result() = CatchToResultAdapter(this,) + +@JvmName("-orThrow") +fun Adapter.orThrow() = CatchToThrowAdapter(this,) + +@JvmName("-orNull") +fun Adapter.orNull() = CatchToNullAdapter(this,) \ No newline at end of file diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt index bc7c69467c1..d4422bbbc05 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt @@ -22,6 +22,11 @@ class CustomScalarAdapters private constructor( */ @JvmField val deferredFragmentIdentifiers: Set?, + /** + * Errors to use with @catch + */ + @JvmField + val errors: List?, private val unsafe: Boolean, ) : ExecutionContext.Element { @@ -97,6 +102,25 @@ class CustomScalarAdapters private constructor( val PassThrough = Builder().unsafe(true).build() } + @ApolloExperimental + fun firstErrorStartingWith(path: List): Error? { + return errors?.firstOrNull { + it.path?.startsWith(path) == true + } + } + + private fun List.startsWith(responsePath: List): Boolean { + for (i in 1.until(responsePath.size)) { + if (i - 1 >= this.size) { + return false + } + if (responsePath[i] != this[i - 1]) { + return false + } + } + return true + } + fun newBuilder(): Builder { return Builder().addAll(this) .falseVariables(falseVariables) @@ -108,6 +132,7 @@ class CustomScalarAdapters private constructor( private var unsafe = false private var falseVariables: Set? = null private var deferredFragmentIdentifiers: Set? = null + private var errors: List? = null fun falseVariables(falseVariables: Set?) = apply { this.falseVariables = falseVariables @@ -117,6 +142,10 @@ class CustomScalarAdapters private constructor( this.deferredFragmentIdentifiers = deferredFragmentIdentifiers } + fun errors(errors: List?) = apply { + this.errors = errors + } + fun add( name: String, adapter: Adapter, @@ -148,8 +177,9 @@ class CustomScalarAdapters private constructor( fun build(): CustomScalarAdapters { return CustomScalarAdapters( adaptersMap, - falseVariables , + falseVariables, deferredFragmentIdentifiers, + errors, unsafe, ) } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt new file mode 100644 index 00000000000..c4349e719ad --- /dev/null +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt @@ -0,0 +1,20 @@ +package com.apollographql.apollo3.api + +import com.apollographql.apollo3.exception.ApolloGraphQLException + +sealed interface FieldResult { + class Success(val value: V) : FieldResult + class Error(val error: com.apollographql.apollo3.api.Error) : FieldResult +} + +fun FieldResult.getOrElse(fallback: V): V = if (this is FieldResult.Success) value else fallback +val FieldResult.isSuccess: Boolean get() = this is FieldResult.Success +val FieldResult.valueOrNull: V? get() = if (this is FieldResult.Success) value else null +val FieldResult.errorsOrNull: Error? get() = if (this is FieldResult.Error) error else null + +fun FieldResult.valueOrThrow(): V { + return when (this) { + is FieldResult.Success -> value + is FieldResult.Error -> throw ApolloGraphQLException(error) + } +} diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt index fb4db23b908..a051ec09aea 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt @@ -101,7 +101,12 @@ class JsonDataException(message: String) : ApolloException(message) */ class ApolloParseException(message: String? = null, cause: Throwable? = null) : ApolloException(message = message, cause = cause) -class ApolloGraphQLException(val errors: List): ApolloException("GraphQL error(s)") +class ApolloGraphQLException(val error: Error): ApolloException("GraphQL error(s)") { + constructor(errors: List): this(errors.first()) + + @Deprecated("Use error instead", level = DeprecationLevel.ERROR) + val errors: List = listOf(error) +} /** * An object/field was missing in the cache From 231242de36d4c6901c31fe29714b74869d061b27 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Sat, 25 Nov 2023 23:05:46 +0100 Subject: [PATCH 03/42] Add IrType.result --- .../apollo3/compiler/ir/IrType.kt | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt index 77e2ba5e67a..028fd16eaf5 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt @@ -45,13 +45,15 @@ import kotlinx.serialization.Serializable sealed interface IrType { val nullable: Boolean val optional: Boolean + val result: Boolean - fun copyWith(nullable: Boolean = this.nullable, optional: Boolean = this.optional): IrType + fun copyWith(nullable: Boolean = this.nullable, optional: Boolean = this.optional, result: Boolean = this.result): IrType fun rawType(): IrNamedType } fun IrType.nullable(nullable: Boolean): IrType = copyWith(nullable = nullable) fun IrType.optional(optional: Boolean): IrType = copyWith(optional = optional) +fun IrType.result(result: Boolean): IrType = copyWith(result = result) @Serializable @SerialName("list") @@ -59,8 +61,9 @@ data class IrListType( val ofType: IrType, override val nullable: Boolean = false, override val optional: Boolean = false, + override val result: Boolean = false, ) : IrType { - override fun copyWith(nullable: Boolean, optional: Boolean): IrType = copy(nullable = nullable, optional = optional) + override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) override fun rawType() = ofType.rawType() } @@ -77,8 +80,9 @@ data class IrScalarType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, + override val result: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean): IrType = copy(nullable = nullable, optional = optional) + override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) override fun rawType() = this } @@ -88,8 +92,9 @@ data class IrInputObjectType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, + override val result: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean): IrType = copy(nullable = nullable, optional = optional) + override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) override fun rawType() = this } @@ -99,8 +104,9 @@ data class IrEnumType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, + override val result: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean): IrType = copy(nullable = nullable, optional = optional) + override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) override fun rawType() = this } @@ -110,8 +116,9 @@ data class IrObjectType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, + override val result: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean): IrType = copy(nullable = nullable, optional = optional) + override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) override fun rawType() = this } @@ -140,11 +147,12 @@ internal data class IrModelType( val path: String, override val nullable: Boolean = false, override val optional: Boolean = false, + override val result: Boolean = false, ) : IrNamedType { override val name: String get() = path - override fun copyWith(nullable: Boolean, optional: Boolean): IrType = copy(nullable = nullable, optional = optional) + override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) override fun rawType() = this } From 5eac8da5c8645d6fb694983b4c5408732f16ba43 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Sun, 26 Nov 2023 20:43:09 +0100 Subject: [PATCH 04/42] add catch test --- tests/catch/build.gradle.kts | 21 ++++ .../catch/src/main/graphql/operations.graphql | 19 +++ tests/catch/src/main/graphql/schema.graphqls | 16 +++ tests/catch/src/test/kotlin/test/CatchTest.kt | 114 ++++++++++++++++++ 4 files changed, 170 insertions(+) create mode 100644 tests/catch/build.gradle.kts create mode 100644 tests/catch/src/main/graphql/operations.graphql create mode 100644 tests/catch/src/main/graphql/schema.graphqls create mode 100644 tests/catch/src/test/kotlin/test/CatchTest.kt diff --git a/tests/catch/build.gradle.kts b/tests/catch/build.gradle.kts new file mode 100644 index 00000000000..ed01e4e654d --- /dev/null +++ b/tests/catch/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("org.jetbrains.kotlin.jvm") + id("com.apollographql.apollo3") +} + +apolloTest() + +dependencies { + implementation(libs.apollo.api) + implementation(libs.apollo.testingsupport) + testImplementation(libs.kotlin.test) + testImplementation(libs.junit) + testImplementation(libs.okhttp) +} + +apollo { + service("service") { + packageName.set("com.example") + enableCatchAndNullOnlyOnError.set(true) + } +} diff --git a/tests/catch/src/main/graphql/operations.graphql b/tests/catch/src/main/graphql/operations.graphql new file mode 100644 index 00000000000..9c9f617f9c0 --- /dev/null +++ b/tests/catch/src/main/graphql/operations.graphql @@ -0,0 +1,19 @@ +query GetUserOrThrow { + user { + name + } +} + +query GetUserPartial { + user @catch { + name + } +} + +query GetNooePartial { + nullOnlyOnError @catch +} + +query GetNooeOrThrow { + nullOnlyOnError +} \ No newline at end of file diff --git a/tests/catch/src/main/graphql/schema.graphqls b/tests/catch/src/main/graphql/schema.graphqls new file mode 100644 index 00000000000..c2e734d45ee --- /dev/null +++ b/tests/catch/src/main/graphql/schema.graphqls @@ -0,0 +1,16 @@ +directive @nullOnlyOnError(level: Int = null) on FIELD_DEFINITION +directive @catch(level: Int = null) on FIELD + +type Query { + nullable: Int + nullOnlyOnError: Int @nullOnlyOnError + deep: [[[Int]]] @nullOnlyOnError + user: User @nullOnlyOnError +} + +type User { + name: String @nullOnlyOnError + friends: [User] @nullOnlyOnError +} + + diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt new file mode 100644 index 00000000000..f31199cd2c2 --- /dev/null +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -0,0 +1,114 @@ +package test + +import com.apollographql.apollo3.api.CustomScalarAdapters +import com.apollographql.apollo3.api.errors +import com.apollographql.apollo3.api.json.JsonReader +import com.apollographql.apollo3.api.json.jsonReader +import com.apollographql.apollo3.api.parseResponse +import com.apollographql.apollo3.api.value +import com.apollographql.apollo3.exception.ApolloException +import com.example.GetNooeOrThrowQuery +import com.example.GetNooePartialQuery +import com.example.GetUserOrThrowQuery +import com.example.GetUserPartialQuery +import okio.Buffer +import org.intellij.lang.annotations.Language +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs +import kotlin.test.assertNull + +class CatchTest { + @Language("json") + val userError = """ + { + "errors": [ + { + "path": ["user", "name"], + "message": "cannot resolve name" + } + ], + "data": { + "user": { + "name": null + } + } + } + """.trimIndent() + + @Language("json") + val userSuccess = """ + { + "data": { + "user": { + "name": "Pancakes" + } + } + } + """.trimIndent() + + @Language("json") + val nooeError = """ + { + "errors": [ + { + "path": ["nullOnlyOnError"], + "message": "cannot resolve nullOnlyOnError" + } + ], + "data": { + "nullOnlyOnError": null + } + } + """.trimIndent() + + private fun String.jsonReader(): JsonReader = Buffer().writeUtf8(this).jsonReader() + + @Test + fun simplePartial() { + val response = GetNooePartialQuery().parseResponse(nooeError.jsonReader(), null, CustomScalarAdapters.Empty, null) + + assertEquals("cannot resolve nullOnlyOnError", response.data?.nullOnlyOnError?.errors?.single()?.message) + assertNull(response.exception) + } + + @Test + fun simpleThrow() { + val response = GetNooeOrThrowQuery().parseResponse(nooeError.jsonReader(), null, CustomScalarAdapters.Empty, null) + + assertNull(response.data) + assertIs(response.exception) + } + + @Test + fun userPartial() { + val response = GetUserPartialQuery().parseResponse(userError.jsonReader(), null, CustomScalarAdapters.Empty, null) + + assertEquals("cannot resolve name", response.data?.user?.errors?.single()?.message) + assertNull(response.exception) + } + + @Test + fun userThrow() { + val response = GetUserOrThrowQuery().parseResponse(userError.jsonReader(), null, CustomScalarAdapters.Empty, null) + + assertNull(response.data) + assertIs(response.exception) + } + + @Test + fun userSuccess() { + val response = GetUserOrThrowQuery().parseResponse(userSuccess.jsonReader(), null, CustomScalarAdapters.Empty, null) + + assertEquals("Pancakes", response.data?.user?.name) + assertNull(response.exception) + } + + @Test + fun userSuccessWithCatch() { + val response = GetUserPartialQuery().parseResponse(userSuccess.jsonReader(), null, CustomScalarAdapters.Empty, null) + + assertEquals("Pancakes", response.data?.user?.value?.name) + assertNull(response.exception) + } +} From 9f6e026bcf50cdcba7b1a5fcfacbc8288f1dd05a Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Sun, 26 Nov 2023 22:55:07 +0100 Subject: [PATCH 05/42] support for @nullOnlyOnError and @catch --- .idea/runConfigurations/CodegenTest.xml | 2 +- libraries/apollo-api/api/apollo-api.api | 53 +++++- .../com/apollographql/apollo3/api/Adapters.kt | 25 +-- .../apollographql/apollo3/api/Executables.kt | 2 + .../apollographql/apollo3/api/FieldResult.kt | 2 +- .../apollo3/api/internal/ResponseParser.kt | 2 +- .../apollo3/exception/Exceptions.kt | 2 +- libraries/apollo-ast/api/apollo-ast.api | 17 ++ .../com/apollographql/apollo3/ast/Schema.kt | 8 + .../apollographql/apollo3/ast/gqldirective.kt | 96 ++++++++++ .../apollo3/ast/internal/definitions.kt | 84 ++++----- .../apollo-compiler/api/apollo-compiler.api | 81 ++++++--- .../apollo3/compiler/codegen/ClassNames.kt | 1 + .../compiler/codegen/java/JavaResolver.kt | 7 +- .../compiler/codegen/kotlin/KotlinResolver.kt | 168 +++++++++++------- .../compiler/codegen/kotlin/KotlinSymbols.kt | 4 + .../compiler/ir/IrOperationsBuilder.kt | 129 +++++++++++--- .../apollo3/compiler/ir/IrType.kt | 38 ++-- tests/catch/build.gradle.kts | 1 - .../catch/src/main/graphql/operations.graphql | 24 ++- tests/catch/src/main/graphql/schema.graphqls | 14 +- tests/catch/src/test/kotlin/test/CatchTest.kt | 82 +++++---- 22 files changed, 605 insertions(+), 237 deletions(-) diff --git a/.idea/runConfigurations/CodegenTest.xml b/.idea/runConfigurations/CodegenTest.xml index d3af27a85f2..fbe6d34c4a4 100644 --- a/.idea/runConfigurations/CodegenTest.xml +++ b/.idea/runConfigurations/CodegenTest.xml @@ -3,7 +3,7 @@ diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index a25122b681d..6ea07431a5d 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -27,7 +27,10 @@ public final class com/apollographql/apollo3/api/Adapters { public static final fun -obj (Lcom/apollographql/apollo3/api/Adapter;Z)Lcom/apollographql/apollo3/api/ObjectAdapter; public static synthetic fun -obj$default (Lcom/apollographql/apollo3/api/Adapter;ZILjava/lang/Object;)Lcom/apollographql/apollo3/api/ObjectAdapter; public static final fun -optional (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; + public static final fun -orNull (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToNullAdapter; + public static final fun -orThrow (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToThrowAdapter; public static final fun -present (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; + public static final fun -result (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToResultAdapter; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;)Ljava/lang/String; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/String; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/String;)Ljava/lang/String; @@ -258,6 +261,26 @@ public abstract interface class com/apollographql/apollo3/api/BuilderScope { public abstract fun getCustomScalarAdapters ()Lcom/apollographql/apollo3/api/CustomScalarAdapters; } +public final class com/apollographql/apollo3/api/CatchToNullAdapter : com/apollographql/apollo3/api/Adapter { + public fun (Lcom/apollographql/apollo3/api/Adapter;)V + public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; + public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V +} + +public final class com/apollographql/apollo3/api/CatchToResultAdapter : com/apollographql/apollo3/api/Adapter { + public fun (Lcom/apollographql/apollo3/api/Adapter;)V + public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lcom/apollographql/apollo3/api/FieldResult; + public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; + public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lcom/apollographql/apollo3/api/FieldResult;)V + public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V +} + +public final class com/apollographql/apollo3/api/CatchToThrowAdapter : com/apollographql/apollo3/api/Adapter { + public fun (Lcom/apollographql/apollo3/api/Adapter;)V + public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; + public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V +} + public final class com/apollographql/apollo3/api/CompiledArgument { public synthetic fun (Ljava/lang/String;Lcom/apollographql/apollo3/api/Optional;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getName ()Ljava/lang/String; @@ -382,8 +405,9 @@ public final class com/apollographql/apollo3/api/CustomScalarAdapters : com/apol public static final field Key Lcom/apollographql/apollo3/api/CustomScalarAdapters$Key; public static final field PassThrough Lcom/apollographql/apollo3/api/CustomScalarAdapters; public final field deferredFragmentIdentifiers Ljava/util/Set; + public final field errors Ljava/util/List; public final field falseVariables Ljava/util/Set; - public synthetic fun (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun adapterFor (Ljava/lang/String;)Lcom/apollographql/apollo3/api/Adapter; public fun getKey ()Lcom/apollographql/apollo3/api/ExecutionContext$Key; public final fun newBuilder ()Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; @@ -398,6 +422,7 @@ public final class com/apollographql/apollo3/api/CustomScalarAdapters$Builder { public final fun build ()Lcom/apollographql/apollo3/api/CustomScalarAdapters; public final fun clear ()V public final fun deferredFragmentIdentifiers (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; + public final fun errors (Ljava/util/List;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; public final fun falseVariables (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; } @@ -512,7 +537,8 @@ public final class com/apollographql/apollo3/api/Executables { public static final fun parseData (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lcom/apollographql/apollo3/api/Executable$Data; public static final fun parseData (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;)Lcom/apollographql/apollo3/api/Executable$Data; public static final fun parseData (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;Ljava/util/Set;)Lcom/apollographql/apollo3/api/Executable$Data; - public static synthetic fun parseData$default (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;Ljava/util/Set;ILjava/lang/Object;)Lcom/apollographql/apollo3/api/Executable$Data; + public static final fun parseData (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;)Lcom/apollographql/apollo3/api/Executable$Data; + public static synthetic fun parseData$default (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;ILjava/lang/Object;)Lcom/apollographql/apollo3/api/Executable$Data; public static final fun variables (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lcom/apollographql/apollo3/api/Executable$Variables; public static final fun variablesJson (Lcom/apollographql/apollo3/api/Executable;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/String; } @@ -574,6 +600,27 @@ public final class com/apollographql/apollo3/api/FakeResolverKt { public static final fun buildData (Lcom/apollographql/apollo3/api/BuilderFactory;Lkotlin/jvm/functions/Function1;Lcom/apollographql/apollo3/api/Adapter;Ljava/util/List;Ljava/lang/String;Lcom/apollographql/apollo3/api/FakeResolver;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; } +public abstract interface class com/apollographql/apollo3/api/FieldResult { +} + +public final class com/apollographql/apollo3/api/FieldResult$Error : com/apollographql/apollo3/api/FieldResult { + public fun (Lcom/apollographql/apollo3/api/Error;)V + public final fun getError ()Lcom/apollographql/apollo3/api/Error; +} + +public final class com/apollographql/apollo3/api/FieldResult$Success : com/apollographql/apollo3/api/FieldResult { + public fun (Ljava/lang/Object;)V + public final fun getValue ()Ljava/lang/Object; +} + +public final class com/apollographql/apollo3/api/FieldResultKt { + public static final fun getErrorOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Lcom/apollographql/apollo3/api/Error; + public static final fun getOrElse (Lcom/apollographql/apollo3/api/FieldResult;Ljava/lang/Object;)Ljava/lang/Object; + public static final fun getValueOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; + public static final fun isSuccess (Lcom/apollographql/apollo3/api/FieldResult;)Z + public static final fun valueOrThrow (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; +} + public final class com/apollographql/apollo3/api/FileUpload { public static final fun toUpload (Ljava/io/File;Ljava/lang/String;)Lcom/apollographql/apollo3/api/DefaultUpload; } @@ -1174,7 +1221,9 @@ public final class com/apollographql/apollo3/exception/ApolloExceptionHandlerKt } public final class com/apollographql/apollo3/exception/ApolloGraphQLException : com/apollographql/apollo3/exception/ApolloException { + public fun (Lcom/apollographql/apollo3/api/Error;)V public fun (Ljava/util/List;)V + public final fun getError ()Lcom/apollographql/apollo3/api/Error; public final fun getErrors ()Ljava/util/List; } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index 12e47c19c6b..fe939da9252 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -416,11 +416,8 @@ class CatchToThrowAdapter(private val wrappedAdapter: Adapter) : Adapter(private val wrappedAdapter: Adapter) : Adapter(private val wrappedAdapter: Adapter) : Adapter<@JvmSuppressWildcards T?> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T? { - val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) - if (error != null) { + if (reader.peek() == JsonReader.Token.NULL) { + /** + * Code commented for reference purposes. + * We could check the error, but it wouldn't change the (null) result. + */ +// val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) +// if (error != null) { +// return null +// } + reader.skipValue() return null } @@ -461,10 +466,10 @@ fun Adapter.list() = ListAdapter(this) fun Adapter.obj(buffered: Boolean = false) = ObjectAdapter(this, buffered) @JvmName("-result") -fun Adapter.result() = CatchToResultAdapter(this,) +fun Adapter.catchToResult() = CatchToResultAdapter(this,) @JvmName("-orThrow") -fun Adapter.orThrow() = CatchToThrowAdapter(this,) +fun Adapter.catchToThrow() = CatchToThrowAdapter(this,) @JvmName("-orNull") -fun Adapter.orNull() = CatchToNullAdapter(this,) \ No newline at end of file +fun Adapter.catchToNull() = CatchToNullAdapter(this,) \ No newline at end of file diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt index 022183f62db..96a30624cde 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt @@ -72,10 +72,12 @@ fun Executable.parseData( customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, falseVariables: Set? = null, deferredFragmentIds: Set? = null, + errors: List? = null ): D? { val customScalarAdapters1 = customScalarAdapters.newBuilder() .falseVariables(falseVariables) .deferredFragmentIdentifiers(deferredFragmentIds) + .errors(errors) .build() return adapter().nullable().fromJson(jsonReader, customScalarAdapters1) } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt index c4349e719ad..4176d9a0146 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt @@ -10,7 +10,7 @@ sealed interface FieldResult { fun FieldResult.getOrElse(fallback: V): V = if (this is FieldResult.Success) value else fallback val FieldResult.isSuccess: Boolean get() = this is FieldResult.Success val FieldResult.valueOrNull: V? get() = if (this is FieldResult.Success) value else null -val FieldResult.errorsOrNull: Error? get() = if (this is FieldResult.Error) error else null +val FieldResult.errorOrNull: Error? get() = if (this is FieldResult.Error) error else null fun FieldResult.valueOrThrow(): V { return when (this) { diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/internal/ResponseParser.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/internal/ResponseParser.kt index 83bd31c2848..1b6a7c16880 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/internal/ResponseParser.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/internal/ResponseParser.kt @@ -34,7 +34,7 @@ internal object ResponseParser { when (jsonReader.nextName()) { "data" -> { val falseVariables = operation.falseVariables(customScalarAdapters) - data = operation.parseData(jsonReader, customScalarAdapters, falseVariables, deferredFragmentIds) + data = operation.parseData(jsonReader, customScalarAdapters, falseVariables, deferredFragmentIds, errors) } "errors" -> errors = jsonReader.readErrors() "extensions" -> extensions = jsonReader.readAny() as? Map diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt index a051ec09aea..e982d28704c 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/exception/Exceptions.kt @@ -101,7 +101,7 @@ class JsonDataException(message: String) : ApolloException(message) */ class ApolloParseException(message: String? = null, cause: Throwable? = null) : ApolloException(message = message, cause = cause) -class ApolloGraphQLException(val error: Error): ApolloException("GraphQL error(s)") { +class ApolloGraphQLException(val error: Error): ApolloException("GraphQL error") { constructor(errors: List): this(errors.first()) @Deprecated("Use error instead", level = DeprecationLevel.ERROR) diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index d7ab7e636f5..11e25e21478 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -34,6 +34,16 @@ public final class com/apollographql/apollo3/ast/ApolloParser { public static synthetic fun toGQLValue$default (Ljava/lang/String;Lcom/apollographql/apollo3/ast/ParserOptions;ILjava/lang/Object;)Lcom/apollographql/apollo3/ast/GQLValue; } +public final class com/apollographql/apollo3/ast/CatchTo : java/lang/Enum { + public static final field NO_CATCH Lcom/apollographql/apollo3/ast/CatchTo; + public static final field NULL Lcom/apollographql/apollo3/ast/CatchTo; + public static final field RESULT Lcom/apollographql/apollo3/ast/CatchTo; + public static final field THROW Lcom/apollographql/apollo3/ast/CatchTo; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/ast/CatchTo; + public static fun values ()[Lcom/apollographql/apollo3/ast/CatchTo; +} + public final class com/apollographql/apollo3/ast/ConditionalFragment : com/apollographql/apollo3/ast/ApolloIssue { public fun (Ljava/lang/String;Lcom/apollographql/apollo3/ast/SourceLocation;)V public fun getMessage ()Ljava/lang/String; @@ -771,6 +781,7 @@ public final class com/apollographql/apollo3/ast/GqldocumentKt { public static final fun builtinDefinitions ()Ljava/util/List; public static final fun kotlinLabsDefinitions (Ljava/lang/String;)Ljava/util/List; public static final fun linkDefinitions ()Ljava/util/List; + public static final fun nullabilityDefinitions (Ljava/lang/String;)Ljava/util/List; public static final fun toSchema (Lcom/apollographql/apollo3/ast/GQLDocument;)Lcom/apollographql/apollo3/ast/Schema; public static final fun withBuiltinDefinitions (Lcom/apollographql/apollo3/ast/GQLDocument;)Lcom/apollographql/apollo3/ast/GQLDocument; public static final fun withoutBuiltinDefinitions (Lcom/apollographql/apollo3/ast/GQLDocument;)Lcom/apollographql/apollo3/ast/GQLDocument; @@ -929,12 +940,14 @@ public final class com/apollographql/apollo3/ast/ReservedEnumValueName : com/apo } public final class com/apollographql/apollo3/ast/Schema { + public static final field CATCH Ljava/lang/String; public static final field Companion Lcom/apollographql/apollo3/ast/Schema$Companion; public static final field FIELD_POLICY Ljava/lang/String; public static final field FIELD_POLICY_FOR_FIELD Ljava/lang/String; public static final field FIELD_POLICY_KEY_ARGS Ljava/lang/String; public static final field FIELD_POLICY_PAGINATION_ARGS Ljava/lang/String; public static final field NONNULL Ljava/lang/String; + public static final field NULL_ONLY_ON_ERROR Ljava/lang/String; public static final field OPTIONAL Ljava/lang/String; public static final field REQUIRES_OPT_IN Ljava/lang/String; public static final field TYPE_POLICY Ljava/lang/String; @@ -1049,6 +1062,10 @@ public final class com/apollographql/apollo3/ast/VariableUsage { public final fun isOneOfInputField ()Z } +public final class com/apollographql/apollo3/ast/internal/DefinitionsKt { + public static final fun getNullabilityDefinitionsStr ()Ljava/lang/String; +} + public final class com/apollographql/apollo3/ast/internal/SchemaValidationScopeKt { } diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt index 7ffd4ced8eb..6ec219324ba 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt @@ -30,6 +30,9 @@ class Schema internal constructor( @ApolloInternal val connectionTypes: Set, ) { + @ApolloInternal + val schemaDefinition: GQLSchemaDefinition? = definitions.filterIsInstance().singleOrNull() + val typeDefinitions: Map = definitions .filterIsInstance() .associateBy { it.name } @@ -95,6 +98,7 @@ class Schema internal constructor( // This could certainly be improved possibleTypes(it).toList() }.toSet() + is GQLObjectTypeDefinition -> setOf(typeDefinition.name) is GQLScalarTypeDefinition -> setOf(typeDefinition.name) is GQLEnumTypeDefinition -> typeDefinition.enumValues.map { it.name }.toSet() @@ -143,11 +147,13 @@ class Schema internal constructor( }.map { it.name } typeDefinition.implementsInterfaces.flatMap { implementedTypes(it) }.toSet() + name + unions } + is GQLInterfaceTypeDefinition -> typeDefinition.implementsInterfaces.flatMap { implementedTypes(it) }.toSet() + name is GQLUnionTypeDefinition, is GQLScalarTypeDefinition, is GQLEnumTypeDefinition, -> setOf(name) + else -> error("Cannot determine implementedTypes of $name") } } @@ -194,6 +200,8 @@ class Schema internal constructor( const val NONNULL = "nonnull" const val OPTIONAL = "optional" const val REQUIRES_OPT_IN = "requiresOptIn" + const val CATCH = "catch" + const val NULL_ONLY_ON_ERROR = "nullOnlyOnError" const val FIELD_POLICY_FOR_FIELD = "forField" const val FIELD_POLICY_KEY_ARGS = "keyArgs" diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index f5f244f2c1e..1b58233e568 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -74,3 +74,99 @@ fun List.optionalValue(schema: Schema?): Boolean? { @ApolloInternal fun List.findNonnull(schema: Schema) = any { schema.originalDirectiveName(it.name) == Schema.NONNULL } + +enum class CatchTo { + NO_CATCH, + THROW, + RESULT, + NULL +} + +@ApolloInternal +class Catch(val to: CatchTo, val level: Int?) + +private fun GQLDirectiveDefinition.getArgumentDefaultValue(argName: String): GQLValue? { + return arguments.firstOrNull { it.name == argName }?.defaultValue +} + +private fun GQLDirective.getArgument(argName: String, schema: Schema): GQLValue? { + val directiveDefinition: GQLDirectiveDefinition = schema.directiveDefinitions.get(name)!! + val argument = arguments.firstOrNull { it.name == argName } + if (argument == null) { + return directiveDefinition.getArgumentDefaultValue(argName) + } + return argument.value +} + +private fun GQLValue.toIntOrNull(): Int? { + return when (this) { + is GQLNullValue -> null + is GQLIntValue -> this.value.toIntOrNull() + else -> error("${sourceLocation}: expected Int value") + } +} + +private fun GQLValue.toStringOrNull(): String? { + return when (this) { + is GQLNullValue -> null + is GQLStringValue -> this.value + else -> error("${sourceLocation}: expected String value") + } +} + +private fun GQLValue?.toBoolean(): Boolean { + return when (this) { + is GQLBooleanValue -> this.value + else -> error("${this?.sourceLocation}: expected Boolean! value") + } +} + +private fun GQLValue?.toCatchTo(): CatchTo { + return when (this) { + is GQLEnumValue -> when (this.value) { + "NULL" -> CatchTo.NULL + "RESULT" -> CatchTo.RESULT + "THROW" -> CatchTo.THROW + else -> error("Unknown CatchTo value: ${this.value}") + } + + else -> error("${this?.sourceLocation}: expected CatchTo! value") + } +} + +@ApolloInternal +fun List.findCatchs(schema: Schema): List { + return filter { + schema.originalDirectiveName(it.name) == Schema.CATCH + }.map { + val to = if (!it.getArgument("if", schema).toBoolean()) { + CatchTo.NO_CATCH + } else { + it.getArgument("to", schema).toCatchTo() + } + + Catch( + to = to, + level = it.getArgument("level", schema)?.toIntOrNull(), + ) + } +} + +@ApolloInternal +fun GQLFieldDefinition.findNooeLevels(schema: Schema): List { + return directives.filter { + schema.originalDirectiveName(it.name) == Schema.NULL_ONLY_ON_ERROR + }.map { + it.getArgument("level", schema)?.toIntOrNull() + } +} + +@ApolloInternal +fun GQLTypeDefinition.findNooeLevels(fieldName: String, schema: Schema): List { + return directives.filter { + schema.originalDirectiveName(it.name) == Schema.NULL_ONLY_ON_ERROR + && it.getArgument("field", schema)?.toStringOrNull() == fieldName + }.map { + it.getArgument("level", schema)?.toIntOrNull() + } +} \ No newline at end of file diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 52165037e69..8add7dda216 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -257,59 +257,59 @@ internal val linkDefinitionsStr = """ """.trimIndent() val nullabilityDefinitionsStr = """ - ""${'"'} - Indicates that a field is only null if there is a matching error in the `errors` array. - In all other cases, the field is non-null. +""${'"'} +Indicates that a field is only null if there is a matching error in the `errors` array. +In all other cases, the field is non-null. - Tools doing code generation may use this information to generate the field as non-null. +Tools doing code generation may use this information to generate the field as non-null. - This directive can be applied on field definitions: +This directive can be applied on field definitions: - ```graphql - type User { - email @nullOnlyOnError - } - ``` +```graphql +type User { + email @nullOnlyOnError +} +``` - It can also be applied on object type extensions for use in client applications that do - not own the base schema: +It can also be applied on object type extensions for use in client applications that do +not own the base schema: - ```graphql - extend type User @nullOnlyOnError(field: "email") - ``` +```graphql +extend type User @nullOnlyOnError(field: "email") +``` - Control over list items is done using the `level` argument: +Control over list items is done using the `level` argument: - ```graphql - type User { - # friends is nullable but friends[1] is null only on errors - friends @nullOnlyOnError(level: 1) - } - ``` +```graphql +type User { + # friends is nullable but friends[0] is null only on errors + friends @nullOnlyOnError(level: 1) +} +``` - @param field the name of the field if applied to an object definition or null if applied - to a field definition +@param field the name of the field if applied to an object definition or null if applied +to a field definition - @param level in case of a list type, level is the dimension where to apply the modifier, - starting at 0 if there is no list. - If level is null, the modifier is applied to all levels - ""${'"'} - directive @nullOnlyOnError(field: String = null, level: Int = null) on FIELD_DEFINITION | OBJECT +@param level in case of a list type, level is the dimension where to apply the modifier, +starting at 0 if there is no list. +If level is null, the modifier is applied to all levels +""${'"'} +directive @nullOnlyOnError(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT - ""${'"'} - Indicates that a field acts as an error boundary in case of a GraphQL error. +""${'"'} +Indicates that a field acts as an error boundary in case of a GraphQL error. - By default, the first GraphQL error throw and fail the whole response. +By default, the first GraphQL error throws and fails the whole response. - @param level in case of a list type, level is the dimension where to apply the modifier, - starting at 0 if there is no list. - If level is null, the modifier is applied to all levels - ""${'"'} - directive @catch(level: Int = null) on FIELD +@param level in case of a list type, level is the dimension where to apply the modifier, +starting at 0 if there is no list. +If level is null, the modifier is applied to all levels +""${'"'} +directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD - enum CatchTo { - NULL, - THROW, - RESULT - } +enum CatchTo { + NULL, + THROW, + RESULT, +} """.trimIndent() \ No newline at end of file diff --git a/libraries/apollo-compiler/api/apollo-compiler.api b/libraries/apollo-compiler/api/apollo-compiler.api index a7884537882..bf4bcc79ea5 100644 --- a/libraries/apollo-compiler/api/apollo-compiler.api +++ b/libraries/apollo-compiler/api/apollo-compiler.api @@ -397,6 +397,21 @@ public final class com/apollographql/apollo3/compiler/codegen/java/adapter/Adapt public static synthetic fun singletonAdapterInitializer$default (Lcom/squareup/javapoet/TypeName;Lcom/squareup/javapoet/TypeName;ZILjava/lang/Object;)Lcom/squareup/javapoet/CodeBlock; } +public final class com/apollographql/apollo3/compiler/ir/IrCatchTo : java/lang/Enum { + public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrCatchTo$Companion; + public static final field NoCatch Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public static final field Null Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public static final field Result Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public static final field Throw Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public static fun values ()[Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; +} + +public final class com/apollographql/apollo3/compiler/ir/IrCatchTo$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class com/apollographql/apollo3/compiler/ir/IrClassName { public fun (Ljava/lang/String;Ljava/util/List;)V public final fun asString ()Ljava/lang/String; @@ -413,15 +428,17 @@ public final class com/apollographql/apollo3/compiler/ir/IrClassName { public final class com/apollographql/apollo3/compiler/ir/IrEnumType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrEnumType$Companion; - public fun (Ljava/lang/String;ZZ)V - public synthetic fun (Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z - public final fun copy (Ljava/lang/String;ZZ)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrEnumType;Ljava/lang/String;ZZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; - public fun copyWith (ZZ)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrEnumType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; + public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z + public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -459,15 +476,17 @@ public final class com/apollographql/apollo3/compiler/ir/IrGraphqlTargetArgument public final class com/apollographql/apollo3/compiler/ir/IrInputObjectType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType$Companion; - public fun (Ljava/lang/String;ZZ)V - public synthetic fun (Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z - public final fun copy (Ljava/lang/String;ZZ)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType;Ljava/lang/String;ZZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; - public fun copyWith (ZZ)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; + public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z + public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -494,15 +513,17 @@ public final class com/apollographql/apollo3/compiler/ir/IrInputObjectType$Compa public final class com/apollographql/apollo3/compiler/ir/IrListType : com/apollographql/apollo3/compiler/ir/IrType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrListType$Companion; - public fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZ)V - public synthetic fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V + public synthetic fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Lcom/apollographql/apollo3/compiler/ir/IrType; public final fun component2 ()Z public final fun component3 ()Z - public final fun copy (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZ)Lcom/apollographql/apollo3/compiler/ir/IrListType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrListType;Lcom/apollographql/apollo3/compiler/ir/IrType;ZZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrListType; - public fun copyWith (ZZ)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public final fun copy (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrListType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrListType;Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrListType; + public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z + public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public fun getNullable ()Z public final fun getOfType ()Lcom/apollographql/apollo3/compiler/ir/IrType; public fun getOptional ()Z @@ -538,15 +559,17 @@ public final class com/apollographql/apollo3/compiler/ir/IrNamedType$Companion { public final class com/apollographql/apollo3/compiler/ir/IrObjectType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrObjectType$Companion; - public fun (Ljava/lang/String;ZZ)V - public synthetic fun (Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z - public final fun copy (Ljava/lang/String;ZZ)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrObjectType;Ljava/lang/String;ZZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; - public fun copyWith (ZZ)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrObjectType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; + public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z + public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -583,15 +606,17 @@ public final class com/apollographql/apollo3/compiler/ir/IrOperationsKt { public final class com/apollographql/apollo3/compiler/ir/IrScalarType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrScalarType$Companion; - public fun (Ljava/lang/String;ZZ)V - public synthetic fun (Ljava/lang/String;ZZILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z - public final fun copy (Ljava/lang/String;ZZ)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrScalarType;Ljava/lang/String;ZZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; - public fun copyWith (ZZ)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrScalarType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; + public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z + public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -652,8 +677,9 @@ public final class com/apollographql/apollo3/compiler/ir/IrTargetObject { public abstract interface class com/apollographql/apollo3/compiler/ir/IrType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrType$Companion; - public abstract fun copyWith (ZZ)Lcom/apollographql/apollo3/compiler/ir/IrType; - public static synthetic fun copyWith$default (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public abstract fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public static synthetic fun copyWith$default (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public abstract fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public abstract fun getNullable ()Z public abstract fun getOptional ()Z public abstract fun rawType ()Lcom/apollographql/apollo3/compiler/ir/IrNamedType; @@ -664,6 +690,7 @@ public final class com/apollographql/apollo3/compiler/ir/IrType$Companion { } public final class com/apollographql/apollo3/compiler/ir/IrTypeKt { + public static final fun catchTo (Lcom/apollographql/apollo3/compiler/ir/IrType;Lcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public static final fun nullable (Lcom/apollographql/apollo3/compiler/ir/IrType;Z)Lcom/apollographql/apollo3/compiler/ir/IrType; public static final fun optional (Lcom/apollographql/apollo3/compiler/ir/IrType;Z)Lcom/apollographql/apollo3/compiler/ir/IrType; } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/ClassNames.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/ClassNames.kt index dcf4c4be39b..85ccf9d5004 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/ClassNames.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/ClassNames.kt @@ -61,4 +61,5 @@ internal object ClassNames { val MandatoryTypenameProperty = ResolverClassName(apolloApiTestPackageName, "MandatoryTypenameProperty") val JetBrainsNullable = ResolverClassName(jetbrainsAnnotationsPackageName, "Nullable") val JetBrainsNonNull = ResolverClassName(jetbrainsAnnotationsPackageName, "NotNull") + val FieldResult = ResolverClassName(apolloApiPackageName, "FieldResult") } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/JavaResolver.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/JavaResolver.kt index 5516d0e461e..d20bde9323c 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/JavaResolver.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/JavaResolver.kt @@ -12,6 +12,7 @@ import com.apollographql.apollo3.compiler.codegen.ResolverKey import com.apollographql.apollo3.compiler.codegen.ResolverKeyKind import com.apollographql.apollo3.compiler.codegen.java.adapter.singletonAdapterInitializer import com.apollographql.apollo3.compiler.hooks.ApolloCompilerJavaHooks +import com.apollographql.apollo3.compiler.ir.IrCatchTo import com.apollographql.apollo3.compiler.ir.IrCompositeType2 import com.apollographql.apollo3.compiler.ir.IrEnumType import com.apollographql.apollo3.compiler.ir.IrEnumType2 @@ -108,6 +109,8 @@ internal class JavaResolver( fun resolveIrType(type: IrType): TypeName { return if (type.optional) { resolveIrType(type.optional(false)).wrapInOptional().addNonNullableAnnotation() + } else if (type.catchTo != IrCatchTo.NoCatch) { + error("Java codegen does not support @catch") } else if (type.nullable) { resolveRawIrType(type).boxIfPrimitiveType().let { if (wrapNullableFieldsInOptional) it.wrapInOptional() else it.addNullableAnnotation() @@ -185,10 +188,12 @@ internal class JavaResolver( return if (type.optional) { val adapterClassName = if (!type.rawType().isComposite()) optionalAdapterClassName else optionalAdapterClassName return CodeBlock.of("new $T<>($L)", adapterClassName, adapterInitializer(type.optional(false), requiresBuffering)) + } else if (type.catchTo != IrCatchTo.NoCatch) { + error("Java codegen does not support @catch") } else if (type.nullable) { // Don't hardcode the adapter when the scalar is mapped to a user-defined type val scalarWithoutCustomMapping = type is IrScalarType && !scalarMapping.containsKey(type.name) - when { + when { type is IrScalarType && type.name == "String" && scalarWithoutCustomMapping -> scalarAdapterCodeBlock("String") type is IrScalarType && type.name == "ID" && scalarWithoutCustomMapping -> scalarAdapterCodeBlock("String") type is IrScalarType && type.name == "Boolean" && scalarWithoutCustomMapping -> scalarAdapterCodeBlock("Boolean") diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt index 433d5808272..81a9aeb9afc 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt @@ -11,6 +11,7 @@ import com.apollographql.apollo3.compiler.codegen.ResolverKey import com.apollographql.apollo3.compiler.codegen.ResolverKeyKind import com.apollographql.apollo3.compiler.codegen.kotlin.adapter.obj import com.apollographql.apollo3.compiler.hooks.ApolloCompilerKotlinHooks +import com.apollographql.apollo3.compiler.ir.IrCatchTo import com.apollographql.apollo3.compiler.ir.IrCompositeType2 import com.apollographql.apollo3.compiler.ir.IrEnumType import com.apollographql.apollo3.compiler.ir.IrEnumType2 @@ -25,6 +26,7 @@ import com.apollographql.apollo3.compiler.ir.IrScalarType import com.apollographql.apollo3.compiler.ir.IrScalarType2 import com.apollographql.apollo3.compiler.ir.IrType import com.apollographql.apollo3.compiler.ir.IrType2 +import com.apollographql.apollo3.compiler.ir.catchTo import com.apollographql.apollo3.compiler.ir.nullable import com.apollographql.apollo3.compiler.ir.optional import com.squareup.kotlinpoet.ClassName @@ -76,33 +78,61 @@ internal class KotlinResolver( classNames.put(ResolverKey(kind, id), ClassName(memberName.packageName, memberName.simpleName)) } + /** + * Because CatchToNull implies nullable, [removeCatchTo] will make the unwrapped type non-nullable + */ + private fun IrType.removeCatchTo(): IrType { + return catchTo(IrCatchTo.NoCatch).let { + if (catchTo == IrCatchTo.Null) { + it.nullable(false) + } else { + it + } + } + } + internal fun resolveIrType(type: IrType, jsExport: Boolean, isInterface: Boolean = false): TypeName { - if (type.optional) { - return KotlinSymbols.Optional.parameterizedBy(resolveIrType(type.optional(false), jsExport, isInterface)) - } else if (type.nullable) { - return resolveIrType(type.nullable(false), jsExport, isInterface).copy(nullable = true) - } else { - return when (type) { - is IrListType -> resolveIrType(type.ofType, jsExport, isInterface).wrapInList(jsExport, isInterface) - is IrScalarType -> { - // Try mapping first, then built-ins, then fallback to Any - resolveScalarTarget(type.name) ?: when (type.name) { - "String" -> KotlinSymbols.String - "Float" -> KotlinSymbols.Double - "Int" -> KotlinSymbols.Int - "Boolean" -> KotlinSymbols.Boolean - "ID" -> KotlinSymbols.String - else -> KotlinSymbols.Any + return when { + type.optional -> { + KotlinSymbols.Optional.parameterizedBy(resolveIrType(type.optional(false), jsExport, isInterface)) + } + type.catchTo != IrCatchTo.NoCatch -> { + resolveIrType(type.removeCatchTo(), jsExport, isInterface).let { + when (type.catchTo) { + IrCatchTo.Throw -> it + IrCatchTo.Null -> it.copy(nullable = true) + IrCatchTo.Result -> KotlinSymbols.FieldResult.parameterizedBy(it) + IrCatchTo.NoCatch -> error("") // keep the compiler happy } } - is IrModelType -> resolveAndAssert(ResolverKeyKind.Model, type.path) - is IrEnumType -> if (jsExport) { - KotlinSymbols.String - } else { - resolveAndAssert(ResolverKeyKind.SchemaType, type.name) - } + } + type.nullable -> { + resolveIrType(type.nullable(false), jsExport, isInterface).copy(nullable = true) + } + else -> { + when (type) { + is IrListType -> resolveIrType(type.ofType, jsExport, isInterface).wrapInList(jsExport, isInterface) + is IrScalarType -> { + // Try mapping first, then built-ins, then fallback to Any + resolveScalarTarget(type.name) ?: when (type.name) { + "String" -> KotlinSymbols.String + "Float" -> KotlinSymbols.Double + "Int" -> KotlinSymbols.Int + "Boolean" -> KotlinSymbols.Boolean + "ID" -> KotlinSymbols.String + else -> KotlinSymbols.Any + } + } + + is IrModelType -> resolveAndAssert(ResolverKeyKind.Model, type.path) + is IrEnumType -> if (jsExport) { + KotlinSymbols.String + } else { + resolveAndAssert(ResolverKeyKind.SchemaType, type.name) + } - is IrNamedType -> resolveAndAssert(ResolverKeyKind.SchemaType, type.name) + is IrNamedType -> resolveAndAssert(ResolverKeyKind.SchemaType, type.name) + } } } } @@ -180,54 +210,70 @@ internal class KotlinResolver( } internal fun adapterInitializer(type: IrType, requiresBuffering: Boolean, jsExport: Boolean, runtimeAdapterPrefix: String): CodeBlock { - return if (type.optional) { - val presentFun = MemberName("com.apollographql.apollo3.api", "present") - CodeBlock.of("%L.%M()", adapterInitializer(type.optional(false), requiresBuffering, jsExport, runtimeAdapterPrefix), presentFun) - } else if (type.nullable) { - // Don't hardcode the adapter when the scalar is mapped to a user-defined type - val scalarWithoutCustomMapping = type is IrScalarType && !scalarMapping.containsKey(type.name) - when { - type is IrScalarType && type.name == "ID" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableStringAdapter) - type is IrScalarType && type.name == "Boolean" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableBooleanAdapter) - type is IrScalarType && type.name == "String" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableStringAdapter) - type is IrScalarType && type.name == "Int" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableIntAdapter) - type is IrScalarType && type.name == "Float" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableDoubleAdapter) - type is IrScalarType && resolveScalarTarget(type.name) == null -> { - CodeBlock.of("%M", KotlinSymbols.NullableAnyAdapter) + return when { + type.optional -> { + val presentFun = MemberName("com.apollographql.apollo3.api", "present") + CodeBlock.of("%L.%M()", adapterInitializer(type.optional(false), requiresBuffering, jsExport, runtimeAdapterPrefix), presentFun) + } + type.catchTo != IrCatchTo.NoCatch -> { + adapterInitializer(type.removeCatchTo(), requiresBuffering, jsExport, runtimeAdapterPrefix).let { + val member = when (type.catchTo) { + IrCatchTo.Throw -> KotlinSymbols.catchToThrow + IrCatchTo.Null -> KotlinSymbols.catchToNull + IrCatchTo.Result -> KotlinSymbols.catchToResult + IrCatchTo.NoCatch -> error("") // happy compiler + } + CodeBlock.of("%L.%M()", it, member) } - else -> { - val nullableFun = MemberName("com.apollographql.apollo3.api", "nullable") - CodeBlock.of("%L.%M()", adapterInitializer(type.nullable(false), requiresBuffering, jsExport, runtimeAdapterPrefix), nullableFun) - } } - } else { - when (type) { - is IrListType -> { - adapterInitializer(type.ofType, requiresBuffering, jsExport, runtimeAdapterPrefix).list(jsExport) - } + type.nullable -> { + // Don't hardcode the adapter when the scalar is mapped to a user-defined type + val scalarWithoutCustomMapping = type is IrScalarType && !scalarMapping.containsKey(type.name) + when { + type is IrScalarType && type.name == "ID" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableStringAdapter) + type is IrScalarType && type.name == "Boolean" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableBooleanAdapter) + type is IrScalarType && type.name == "String" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableStringAdapter) + type is IrScalarType && type.name == "Int" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableIntAdapter) + type is IrScalarType && type.name == "Float" && scalarWithoutCustomMapping -> CodeBlock.of("%M", KotlinSymbols.NullableDoubleAdapter) + type is IrScalarType && resolveScalarTarget(type.name) == null -> { + CodeBlock.of("%M", KotlinSymbols.NullableAnyAdapter) + } - is IrScalarType -> { - scalarAdapterInitializer(type.name, runtimeAdapterPrefix) + else -> { + val nullableFun = MemberName("com.apollographql.apollo3.api", "nullable") + CodeBlock.of("%L.%M()", adapterInitializer(type.nullable(false), requiresBuffering, jsExport, runtimeAdapterPrefix), nullableFun) + } } + } + else -> { + when (type) { + is IrListType -> { + adapterInitializer(type.ofType, requiresBuffering, jsExport, runtimeAdapterPrefix).list(jsExport) + } - is IrEnumType -> { - if (jsExport) { - scalarAdapterInitializer("String", runtimeAdapterPrefix) - } else { - CodeBlock.of("%T", resolveAndAssert(ResolverKeyKind.SchemaTypeAdapter, type.name)) + is IrScalarType -> { + scalarAdapterInitializer(type.name, runtimeAdapterPrefix) } - } - is IrInputObjectType -> { - CodeBlock.of("%T", resolveAndAssert(ResolverKeyKind.SchemaTypeAdapter, type.name)).obj(requiresBuffering) - } + is IrEnumType -> { + if (jsExport) { + scalarAdapterInitializer("String", runtimeAdapterPrefix) + } else { + CodeBlock.of("%T", resolveAndAssert(ResolverKeyKind.SchemaTypeAdapter, type.name)) + } + } - is IrModelType -> { - CodeBlock.of("%T", resolveAndAssert(ResolverKeyKind.ModelAdapter, type.path)).obj(requiresBuffering) - } + is IrInputObjectType -> { + CodeBlock.of("%T", resolveAndAssert(ResolverKeyKind.SchemaTypeAdapter, type.name)).obj(requiresBuffering) + } - is IrObjectType -> error("IrObjectType cannot be adapted") + is IrModelType -> { + CodeBlock.of("%T", resolveAndAssert(ResolverKeyKind.ModelAdapter, type.path)).obj(requiresBuffering) + } + + is IrObjectType -> error("IrObjectType cannot be adapted") + } } } } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt index a699f60c749..976b862a836 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt @@ -113,11 +113,15 @@ internal object KotlinSymbols { val JsExport = ClassName("kotlin.js", "JsExport") val obj = MemberName(apolloApiPackageName, "obj") + val catchToResult = MemberName(apolloApiPackageName, "catchToResult") + val catchToNull = MemberName(apolloApiPackageName, "catchToNull") + val catchToThrow = MemberName(apolloApiPackageName, "catchToThrow") val readTypename = MemberName(apolloApiJsonPackageName, "readTypename") val buildData = MemberName(apolloApiPackageName, "buildData") val GlobalBuilder = MemberName(apolloApiPackageName, "GlobalBuilder") val assertOneOf = MemberName(apolloApiPackageName, "assertOneOf") val missingField = MemberName(apolloApiPackageName, "missingField") + val FieldResult = ClassNames.FieldResult.toKotlinPoetClassName() } internal fun ResolverClassName.toKotlinPoetClassName(): ClassName = ClassName(packageName, simpleNames) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 36f267be3e7..a4434474ec2 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -1,5 +1,7 @@ package com.apollographql.apollo3.compiler.ir +import com.apollographql.apollo3.ast.Catch +import com.apollographql.apollo3.ast.CatchTo import com.apollographql.apollo3.ast.GQLBooleanValue import com.apollographql.apollo3.ast.GQLDirective import com.apollographql.apollo3.ast.GQLEnumTypeDefinition @@ -32,8 +34,10 @@ import com.apollographql.apollo3.ast.TransformResult import com.apollographql.apollo3.ast.VariableUsage import com.apollographql.apollo3.ast.definitionFromScope import com.apollographql.apollo3.ast.fieldDefinitions +import com.apollographql.apollo3.ast.findCatchs import com.apollographql.apollo3.ast.findDeprecationReason import com.apollographql.apollo3.ast.findNonnull +import com.apollographql.apollo3.ast.findNooeLevels import com.apollographql.apollo3.ast.findOptInFeature import com.apollographql.apollo3.ast.isFieldNonNull import com.apollographql.apollo3.ast.optionalValue @@ -98,7 +102,7 @@ internal class IrOperationsBuilder( */ val visitedTypes = mutableSetOf() val typesToVisit = usedFields.keys.toMutableList() - while(typesToVisit.isNotEmpty()) { + while (typesToVisit.isNotEmpty()) { val name = typesToVisit.removeFirst() if (visitedTypes.contains(name)) { continue @@ -186,21 +190,24 @@ internal class IrOperationsBuilder( /** * Unions reference their members, generate them: * + * ``` * public class SearchResult { * public companion object { * public val type: UnionType = UnionType("SearchResult", Human.type, Droid.type, Starship.type) * } * } + * ``` */ - typeDefinition.memberTypes.forEach { - if (generateDataBuilders) { - usedFields.putAllFields(it.name, usedFields[name].orEmpty()) - } else { - usedFields.putType(it.name) - } - typesToVisit.add(it.name) + typeDefinition.memberTypes.forEach { + if (generateDataBuilders) { + usedFields.putAllFields(it.name, usedFields[name].orEmpty()) + } else { + usedFields.putType(it.name) } + typesToVisit.add(it.name) + } } + is GQLInputObjectTypeDefinition -> { /** * Loop on the input types. @@ -214,6 +221,7 @@ internal class IrOperationsBuilder( typesToVisit.add(fieldType.name) usedFields.putType(fieldType.name) } + is GQLEnumTypeDefinition -> { typesToVisit.add(fieldType.name) usedFields.putType(fieldType.name) @@ -383,7 +391,7 @@ internal class IrOperationsBuilder( * @throws IllegalStateException if some incompatibles types are found. This should never happen * because this should be caught during previous operation-wide validation. */ - fun inferFragmentVariables(fragment: GQLFragmentDefinition): List { + private fun inferFragmentVariables(fragment: GQLFragmentDefinition): List { return fragmentVariableUsages.get(fragment.name).orEmpty().groupBy { it.variable.name }.entries.map { @@ -470,7 +478,8 @@ internal class IrOperationsBuilder( val type: GQLType, val deprecationReason: String?, val optInFeature: String?, - val forceNonNull: Boolean, + val nooes: List, + val catchs: List, val forceOptional: Boolean, /** @@ -484,6 +493,8 @@ internal class IrOperationsBuilder( } override fun merge(fields: List): List { + val defaultCatch = schema.schemaDefinition?.directives?.findCatchs(schema)?.singleOrNull() + return fields.map { fieldWithParent -> val gqlField = fieldWithParent.gqlField val parentTypeDefinition = schema.typeDefinition(fieldWithParent.parentType) @@ -492,7 +503,31 @@ internal class IrOperationsBuilder( check(fieldDefinition != null) { "cannot find field definition for field '${gqlField.responseName()}' of type '${parentTypeDefinition.name}'" } - val forceNonNull = gqlField.directives.findNonnull(schema) || parentTypeDefinition.isFieldNonNull(gqlField.name, schema) + + var nooeLevels = fieldDefinition.findNooeLevels(schema) + + parentTypeDefinition.findNooeLevels(gqlField.name, schema).let { + if (it.isNotEmpty()) { + check(nooeLevels.isEmpty()) { + "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @nullOnlyOnError) in the schema." + } + nooeLevels = it + } + } + + if (parentTypeDefinition.isFieldNonNull(gqlField.name, schema)) { + check(nooeLevels.isEmpty()) { + "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @nullOnlyOnError) in the schema." + } + nooeLevels = listOf(0) + } + + if (gqlField.directives.findNonnull(schema)) { + check(nooeLevels.isEmpty()) { + "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @nullOnlyOnError) in the schema." + } + nooeLevels = listOf(0) + } CollectedField( name = gqlField.name, @@ -503,9 +538,10 @@ internal class IrOperationsBuilder( description = fieldDefinition.description, deprecationReason = fieldDefinition.directives.findDeprecationReason(), optInFeature = fieldDefinition.directives.findOptInFeature(schema), - forceNonNull = forceNonNull, + nooes = nooeLevels, forceOptional = gqlField.directives.optionalValue(schema) == true, parentType = fieldWithParent.parentType, + catchs = gqlField.directives.findCatchs(schema) ) }.groupBy { it.responseName @@ -522,9 +558,6 @@ internal class IrOperationsBuilder( val first = fieldsWithSameResponseName.first() val childSelections = fieldsWithSameResponseName.flatMap { it.selections } - val forceNonNull = fieldsWithSameResponseName.any { - it.forceNonNull - } val forceOptional = fieldsWithSameResponseName.any { it.forceOptional } @@ -574,12 +607,23 @@ internal class IrOperationsBuilder( */ usedFields.putType(first.type.rawType().name) - var irType = first.type.toIr() - if (forceNonNull) { - irType = irType.nullable(false) - } else if (forceOptional) { - irType = irType.nullable(true) - } + val irType = first + .type + .toIr() + // Apply the schema transformations + .nooe(first.nooes, 0) + .let { + /** + * We map @optional fields to nullable fields. This probably needs to be revisited in light of @catch + */ + if (forceOptional) { + it.nullable(true) + } else { + it + } + } + // Finally, transform into Result or Nullable depending on catch + .catch(first.catchs, defaultCatch ?: Catch(CatchTo.NO_CATCH, null), 0) /** * Depending on the parent object/interface in which the field is queried, the field definition might have different descriptions/deprecationReasons @@ -629,6 +673,49 @@ internal class IrOperationsBuilder( } companion object { + private fun IrType.nooe(nullOnlyOnErrorLevels: List, level: Int): IrType { + val isNonNull = nullOnlyOnErrorLevels.any { it == null || it == level } + + return when (this) { + is IrNamedType -> this + is IrListType -> copy(ofType = ofType.nooe(nullOnlyOnErrorLevels, level + 1)) + }.let { + if (isNonNull) { + it.nullable(false) + } else { + it + } + } + } + + private fun IrType.catch(catchLevels: List, defaultCatch: Catch, level: Int): IrType { + val catchLevel = catchLevels.firstOrNull { it.level == null || it.level == level } ?: defaultCatch + return when (this) { + is IrNamedType -> this + is IrListType -> copy(ofType = ofType.catch(catchLevels, defaultCatch, level + 1)) + }.catchTo(catchLevel.to.toIr()).let { + if (catchLevel.to == CatchTo.NULL) { + /** + * Mark the field as nullable which duplicates some information with CatchTo but is needed for + * other codepaths to generate correct code and not consider this a required field + * See also `IrType.removeCatchTo` + */ + it.nullable(true) + } else { + it + } + } + } + + private fun CatchTo.toIr(): IrCatchTo { + return when (this) { + CatchTo.NO_CATCH -> IrCatchTo.NoCatch + CatchTo.THROW -> IrCatchTo.Throw + CatchTo.RESULT -> IrCatchTo.Result + CatchTo.NULL -> IrCatchTo.Null + } + } + private fun MutableMap>.putField(typeName: String, fieldName: String) { compute(typeName) { _, v -> if (v == null) { diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt index 028fd16eaf5..3c5d04dda22 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt @@ -45,15 +45,23 @@ import kotlinx.serialization.Serializable sealed interface IrType { val nullable: Boolean val optional: Boolean - val result: Boolean + val catchTo: IrCatchTo - fun copyWith(nullable: Boolean = this.nullable, optional: Boolean = this.optional, result: Boolean = this.result): IrType + fun copyWith(nullable: Boolean = this.nullable, optional: Boolean = this.optional, catchTo: IrCatchTo = this.catchTo): IrType fun rawType(): IrNamedType } +@Serializable +enum class IrCatchTo { + Throw, + Null, + Result, + NoCatch +} + fun IrType.nullable(nullable: Boolean): IrType = copyWith(nullable = nullable) fun IrType.optional(optional: Boolean): IrType = copyWith(optional = optional) -fun IrType.result(result: Boolean): IrType = copyWith(result = result) +fun IrType.catchTo(catchTo: IrCatchTo): IrType = copyWith(catchTo = catchTo) @Serializable @SerialName("list") @@ -61,9 +69,9 @@ data class IrListType( val ofType: IrType, override val nullable: Boolean = false, override val optional: Boolean = false, - override val result: Boolean = false, + override val catchTo: IrCatchTo = IrCatchTo.NoCatch, ) : IrType { - override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) + override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) override fun rawType() = ofType.rawType() } @@ -80,9 +88,9 @@ data class IrScalarType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, - override val result: Boolean = false, + override val catchTo: IrCatchTo = IrCatchTo.NoCatch, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) + override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) override fun rawType() = this } @@ -92,9 +100,9 @@ data class IrInputObjectType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, - override val result: Boolean = false, + override val catchTo: IrCatchTo = IrCatchTo.NoCatch, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) + override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) override fun rawType() = this } @@ -104,9 +112,9 @@ data class IrEnumType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, - override val result: Boolean = false, + override val catchTo: IrCatchTo = IrCatchTo.NoCatch, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) + override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) override fun rawType() = this } @@ -116,9 +124,9 @@ data class IrObjectType( override val name: String, override val nullable: Boolean = false, override val optional: Boolean = false, - override val result: Boolean = false, + override val catchTo: IrCatchTo = IrCatchTo.NoCatch, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) + override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) override fun rawType() = this } @@ -147,12 +155,12 @@ internal data class IrModelType( val path: String, override val nullable: Boolean = false, override val optional: Boolean = false, - override val result: Boolean = false, + override val catchTo: IrCatchTo = IrCatchTo.NoCatch, ) : IrNamedType { override val name: String get() = path - override fun copyWith(nullable: Boolean, optional: Boolean, result: Boolean): IrType = copy(nullable = nullable, optional = optional, result = result) + override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) override fun rawType() = this } diff --git a/tests/catch/build.gradle.kts b/tests/catch/build.gradle.kts index ed01e4e654d..f466e1911ce 100644 --- a/tests/catch/build.gradle.kts +++ b/tests/catch/build.gradle.kts @@ -16,6 +16,5 @@ dependencies { apollo { service("service") { packageName.set("com.example") - enableCatchAndNullOnlyOnError.set(true) } } diff --git a/tests/catch/src/main/graphql/operations.graphql b/tests/catch/src/main/graphql/operations.graphql index 9c9f617f9c0..31c745204d9 100644 --- a/tests/catch/src/main/graphql/operations.graphql +++ b/tests/catch/src/main/graphql/operations.graphql @@ -1,19 +1,25 @@ -query GetUserOrThrow { - user { +query UserThrow { + # + user @catch(to: THROW){ name } } -query GetUserPartial { - user @catch { +query UserResult { + user @catch(to: RESULT) { name } } -query GetNooePartial { - nullOnlyOnError @catch +query UserNull { + user @catch(to: NULL) { + name + } +} + +query UserIgnore { + user @catch(if: false) { + name + } } -query GetNooeOrThrow { - nullOnlyOnError -} \ No newline at end of file diff --git a/tests/catch/src/main/graphql/schema.graphqls b/tests/catch/src/main/graphql/schema.graphqls index c2e734d45ee..9924dda153f 100644 --- a/tests/catch/src/main/graphql/schema.graphqls +++ b/tests/catch/src/main/graphql/schema.graphqls @@ -1,5 +1,15 @@ -directive @nullOnlyOnError(level: Int = null) on FIELD_DEFINITION -directive @catch(level: Int = null) on FIELD +#extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1") + +extend schema @catch(to: THROW) + +directive @nullOnlyOnError(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT +directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) on FIELD | SCHEMA | QUERY | MUTATION | SUBSCRIPTION + +enum CatchTo { + NULL, + THROW, + RESULT, +} type Query { nullable: Int diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index f31199cd2c2..a3d1d757b81 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -1,16 +1,18 @@ package test +import com.apollographql.apollo3.api.ApolloResponse import com.apollographql.apollo3.api.CustomScalarAdapters -import com.apollographql.apollo3.api.errors +import com.apollographql.apollo3.api.Operation +import com.apollographql.apollo3.api.Query +import com.apollographql.apollo3.api.errorOrNull import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse -import com.apollographql.apollo3.api.value -import com.apollographql.apollo3.exception.ApolloException -import com.example.GetNooeOrThrowQuery -import com.example.GetNooePartialQuery -import com.example.GetUserOrThrowQuery -import com.example.GetUserPartialQuery +import com.apollographql.apollo3.api.valueOrThrow +import com.apollographql.apollo3.exception.ApolloGraphQLException +import com.example.UserNullQuery +import com.example.UserResultQuery +import com.example.UserThrowQuery import okio.Buffer import org.intellij.lang.annotations.Language import kotlin.test.Test @@ -18,9 +20,8 @@ import kotlin.test.assertEquals import kotlin.test.assertIs import kotlin.test.assertNull -class CatchTest { - @Language("json") - val userError = """ +@Language("json") +val userNameError = """ { "errors": [ { @@ -36,8 +37,8 @@ class CatchTest { } """.trimIndent() - @Language("json") - val userSuccess = """ +@Language("json") +val userSuccess = """ { "data": { "user": { @@ -47,8 +48,8 @@ class CatchTest { } """.trimIndent() - @Language("json") - val nooeError = """ +@Language("json") +val nooeError = """ { "errors": [ { @@ -62,53 +63,50 @@ class CatchTest { } """.trimIndent() - private fun String.jsonReader(): JsonReader = Buffer().writeUtf8(this).jsonReader() - +class CatchTest { @Test - fun simplePartial() { - val response = GetNooePartialQuery().parseResponse(nooeError.jsonReader(), null, CustomScalarAdapters.Empty, null) - - assertEquals("cannot resolve nullOnlyOnError", response.data?.nullOnlyOnError?.errors?.single()?.message) - assertNull(response.exception) + fun userThrowOnUserNameError() { + val response = UserThrowQuery().parseResponse(userNameError) + val exception = response.exception + assertIs(exception) + assertEquals("cannot resolve name", exception.error.message) } @Test - fun simpleThrow() { - val response = GetNooeOrThrowQuery().parseResponse(nooeError.jsonReader(), null, CustomScalarAdapters.Empty, null) + fun userResultOnUserNameError() { + val response = UserResultQuery().parseResponse(userNameError) - assertNull(response.data) - assertIs(response.exception) + assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) } - @Test - fun userPartial() { - val response = GetUserPartialQuery().parseResponse(userError.jsonReader(), null, CustomScalarAdapters.Empty, null) + fun userNullOnUserNameError() { + val response = UserNullQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data?.user?.errors?.single()?.message) - assertNull(response.exception) + assertNull(response.data!!.user) } @Test - fun userThrow() { - val response = GetUserOrThrowQuery().parseResponse(userError.jsonReader(), null, CustomScalarAdapters.Empty, null) + fun userThrowOnUserSuccess() { + val response = UserThrowQuery().parseResponse(userSuccess) - assertNull(response.data) - assertIs(response.exception) + assertEquals("Pancakes", response.data!!.user.name) } @Test - fun userSuccess() { - val response = GetUserOrThrowQuery().parseResponse(userSuccess.jsonReader(), null, CustomScalarAdapters.Empty, null) + fun userResultOnUserSuccess() { + val response = UserResultQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data?.user?.name) - assertNull(response.exception) + assertEquals("Pancakes", response.data!!.user.valueOrThrow().name) } @Test - fun userSuccessWithCatch() { - val response = GetUserPartialQuery().parseResponse(userSuccess.jsonReader(), null, CustomScalarAdapters.Empty, null) + fun userNullOnUserSuccess() { + val response = UserNullQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data?.user?.value?.name) - assertNull(response.exception) + assertEquals("Pancakes", response.data!!.user!!.name) } } + +private fun String.jsonReader(): JsonReader = Buffer().writeUtf8(this).jsonReader() + +fun Query.parseResponse(json: String): ApolloResponse = parseResponse(json.jsonReader(), null, CustomScalarAdapters.Empty, null) From 6f3370a2891a8bff65baf888f3f7d286591812cf Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 17:23:45 +0100 Subject: [PATCH 06/42] Update libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt Co-authored-by: Benoit Lubek --- .../com/apollographql/apollo3/ast/internal/definitions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 8add7dda216..1da1416c77c 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -267,7 +267,7 @@ This directive can be applied on field definitions: ```graphql type User { - email @nullOnlyOnError + email: String @nullOnlyOnError } ``` From c6970a400c0f1e2be0884d735a862926778a2339 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 17:24:18 +0100 Subject: [PATCH 07/42] Update libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt Co-authored-by: Benoit Lubek --- .../com/apollographql/apollo3/ast/internal/definitions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 1da1416c77c..8cb36f2bc76 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -283,7 +283,7 @@ Control over list items is done using the `level` argument: ```graphql type User { # friends is nullable but friends[0] is null only on errors - friends @nullOnlyOnError(level: 1) + friends: [ID]! @nullOnlyOnError(level: 1) } ``` From acdb97069d2df2f97da79b52bbcdbd848d606f1d Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 17:25:30 +0100 Subject: [PATCH 08/42] Update libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt Co-authored-by: Benoit Lubek --- .../com/apollographql/apollo3/ast/internal/definitions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 8cb36f2bc76..15e664ce47e 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -305,7 +305,7 @@ By default, the first GraphQL error throws and fails the whole response. starting at 0 if there is no list. If level is null, the modifier is applied to all levels ""${'"'} -directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD +directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD | SCHEMA enum CatchTo { NULL, From e7eb8c7debff0e3da3d6e99263d8e3d12fd34968 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 17:31:15 +0100 Subject: [PATCH 09/42] findCatch -> findCatches --- .../kotlin/com/apollographql/apollo3/ast/gqldirective.kt | 2 +- .../apollo3/compiler/ir/IrOperationsBuilder.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index 1b58233e568..5d5a7a3d8c8 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -135,7 +135,7 @@ private fun GQLValue?.toCatchTo(): CatchTo { } @ApolloInternal -fun List.findCatchs(schema: Schema): List { +fun List.findCatches(schema: Schema): List { return filter { schema.originalDirectiveName(it.name) == Schema.CATCH }.map { diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index a4434474ec2..10e4ade272c 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -34,7 +34,7 @@ import com.apollographql.apollo3.ast.TransformResult import com.apollographql.apollo3.ast.VariableUsage import com.apollographql.apollo3.ast.definitionFromScope import com.apollographql.apollo3.ast.fieldDefinitions -import com.apollographql.apollo3.ast.findCatchs +import com.apollographql.apollo3.ast.findCatches import com.apollographql.apollo3.ast.findDeprecationReason import com.apollographql.apollo3.ast.findNonnull import com.apollographql.apollo3.ast.findNooeLevels @@ -493,7 +493,7 @@ internal class IrOperationsBuilder( } override fun merge(fields: List): List { - val defaultCatch = schema.schemaDefinition?.directives?.findCatchs(schema)?.singleOrNull() + val defaultCatch = schema.schemaDefinition?.directives?.findCatches(schema)?.singleOrNull() return fields.map { fieldWithParent -> val gqlField = fieldWithParent.gqlField @@ -541,7 +541,7 @@ internal class IrOperationsBuilder( nooes = nooeLevels, forceOptional = gqlField.directives.optionalValue(schema) == true, parentType = fieldWithParent.parentType, - catchs = gqlField.directives.findCatchs(schema) + catchs = gqlField.directives.findCatches(schema) ) }.groupBy { it.responseName From e21ccd3adf527423fc1aa6ee6f3499a9536c3e96 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 19:21:47 +0100 Subject: [PATCH 10/42] use the presence of the `@catch` directive definition to enable codegen --- .../ast/internal/SchemaValidationScope.kt | 6 +- .../compiler/ir/IrOperationsBuilder.kt | 10 ++- tests/catch/src/main/graphql/schema.graphqls | 8 +-- tests/catch/src/test/kotlin/test/CatchTest.kt | 72 ++++++++----------- 4 files changed, 42 insertions(+), 54 deletions(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt index 2c4c21023f2..36ee1e68fe7 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt @@ -62,19 +62,19 @@ internal fun validateSchema(definitions: List, requiresApolloDefi var directivesToStrip = foreignSchemas.flatMap { it.directivesToStrip } - val apolloDefinitions = kotlinLabsDefinitions("v0.2") + val kotlinLabsDefinitions = kotlinLabsDefinitions("v0.2") if (requiresApolloDefinitions && foreignSchemas.none { it.name == "kotlin_labs" }) { /** * Strip all the apollo directives from outgoing operation documents. * This will also strip schema directives like @typePolicy that should never appear in executable documents */ - directivesToStrip = directivesToStrip + apolloDefinitions.filterIsInstance().map { it.name } + directivesToStrip = directivesToStrip + kotlinLabsDefinitions.filterIsInstance().map { it.name } /** * Put apolloDefinitions first so that they override the user one in the case of a conflict */ - foreignDefinitions = apolloDefinitions + foreignDefinitions + foreignDefinitions = kotlinLabsDefinitions + foreignDefinitions } allDefinitions = foreignDefinitions + allDefinitions diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 10e4ade272c..4d3338c6cf2 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -493,7 +493,13 @@ internal class IrOperationsBuilder( } override fun merge(fields: List): List { - val defaultCatch = schema.schemaDefinition?.directives?.findCatches(schema)?.singleOrNull() + val defaultCatch = if (schema.directiveDefinitions.any { + schema.originalDirectiveName(it.key) == Schema.CATCH + }) { + Catch(to = CatchTo.THROW, null) + } else { + Catch(to = CatchTo.NO_CATCH, null) + } return fields.map { fieldWithParent -> val gqlField = fieldWithParent.gqlField @@ -623,7 +629,7 @@ internal class IrOperationsBuilder( } } // Finally, transform into Result or Nullable depending on catch - .catch(first.catchs, defaultCatch ?: Catch(CatchTo.NO_CATCH, null), 0) + .catch(first.catchs, defaultCatch, 0) /** * Depending on the parent object/interface in which the field is queried, the field definition might have different descriptions/deprecationReasons diff --git a/tests/catch/src/main/graphql/schema.graphqls b/tests/catch/src/main/graphql/schema.graphqls index 9924dda153f..64322972caf 100644 --- a/tests/catch/src/main/graphql/schema.graphqls +++ b/tests/catch/src/main/graphql/schema.graphqls @@ -1,9 +1,7 @@ -#extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1") +extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@nullOnlyOnError", "@catch"]) -extend schema @catch(to: THROW) - -directive @nullOnlyOnError(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT -directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) on FIELD | SCHEMA | QUERY | MUTATION | SUBSCRIPTION +#directive @nullOnlyOnError(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT +#directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) on FIELD enum CatchTo { NULL, diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index a3d1d757b81..fdf17d337d2 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -2,7 +2,6 @@ package test import com.apollographql.apollo3.api.ApolloResponse import com.apollographql.apollo3.api.CustomScalarAdapters -import com.apollographql.apollo3.api.Operation import com.apollographql.apollo3.api.Query import com.apollographql.apollo3.api.errorOrNull import com.apollographql.apollo3.api.json.JsonReader @@ -20,49 +19,6 @@ import kotlin.test.assertEquals import kotlin.test.assertIs import kotlin.test.assertNull -@Language("json") -val userNameError = """ - { - "errors": [ - { - "path": ["user", "name"], - "message": "cannot resolve name" - } - ], - "data": { - "user": { - "name": null - } - } - } - """.trimIndent() - -@Language("json") -val userSuccess = """ - { - "data": { - "user": { - "name": "Pancakes" - } - } - } - """.trimIndent() - -@Language("json") -val nooeError = """ - { - "errors": [ - { - "path": ["nullOnlyOnError"], - "message": "cannot resolve nullOnlyOnError" - } - ], - "data": { - "nullOnlyOnError": null - } - } - """.trimIndent() - class CatchTest { @Test fun userThrowOnUserNameError() { @@ -110,3 +66,31 @@ class CatchTest { private fun String.jsonReader(): JsonReader = Buffer().writeUtf8(this).jsonReader() fun Query.parseResponse(json: String): ApolloResponse = parseResponse(json.jsonReader(), null, CustomScalarAdapters.Empty, null) + +@Language("json") +val userNameError = """ + { + "errors": [ + { + "path": ["user", "name"], + "message": "cannot resolve name" + } + ], + "data": { + "user": { + "name": null + } + } + } + """.trimIndent() + +@Language("json") +val userSuccess = """ + { + "data": { + "user": { + "name": "Pancakes" + } + } + } + """.trimIndent() From c141ad31ac7507254e63aec41c69aa1b283f934d Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 22:33:51 +0100 Subject: [PATCH 11/42] Add @ignoreErrors and ErrorAwareAdapter. Remove CatchToThrowAdapter --- .../com/apollographql/apollo3/api/Adapters.kt | 35 +++----------- .../apollo3/api/CustomScalarAdapters.kt | 11 +++++ .../apollographql/apollo3/api/Executable.kt | 6 +++ .../apollographql/apollo3/api/Executables.kt | 1 + .../com/apollographql/apollo3/ast/Schema.kt | 5 ++ .../apollographql/apollo3/ast/gqldirective.kt | 11 +---- .../apollo3/ast/internal/definitions.kt | 12 +++-- .../apollo3/compiler/codegen/Identifiers.kt | 1 + .../compiler/codegen/kotlin/KotlinCodeGen.kt | 38 +++++++++++++-- .../compiler/codegen/kotlin/KotlinResolver.kt | 19 +++++--- .../compiler/codegen/kotlin/KotlinSymbols.kt | 2 +- .../codegen/kotlin/file/ExecutableCommon.kt | 8 ++++ .../codegen/kotlin/file/FragmentBuilder.kt | 1 + .../codegen/kotlin/file/OperationBuilder.kt | 1 + .../apollo3/compiler/ir/IrOperations.kt | 1 + .../compiler/ir/IrOperationsBuilder.kt | 38 +++++++-------- .../apollo3/compiler/ir/IrType.kt | 1 - .../catch/src/main/graphql/operations.graphql | 18 +++++--- tests/catch/src/main/graphql/schema.graphqls | 4 ++ tests/catch/src/test/kotlin/test/CatchTest.kt | 46 +++++++++++++++++-- 20 files changed, 172 insertions(+), 87 deletions(-) diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index fe939da9252..fd7ced96428 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -383,14 +383,6 @@ class ObjectAdapter( class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): FieldResult { - if (reader.peek() == JsonReader.Token.NULL) { - val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) - if (error != null) { - reader.skipValue() - return FieldResult.Error(error) - } - } - return try { FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) } catch (e: ApolloGraphQLException) { @@ -406,9 +398,9 @@ class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter< } } -class CatchToThrowAdapter(private val wrappedAdapter: Adapter) : Adapter { +class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Adapter { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { - if (reader.peek() == JsonReader.Token.NULL) { + if (!customScalarAdapters.ignoreErrors && reader.peek() == JsonReader.Token.NULL) { val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) if (error != null) { reader.skipValue() @@ -416,7 +408,6 @@ class CatchToThrowAdapter(private val wrappedAdapter: Adapter) : Adapter(private val wrappedAdapter: Adapter) : Adapter(private val wrappedAdapter: Adapter) : Adapter<@JvmSuppressWildcards T?> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T? { - if (reader.peek() == JsonReader.Token.NULL) { - /** - * Code commented for reference purposes. - * We could check the error, but it wouldn't change the (null) result. - */ -// val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) -// if (error != null) { -// return null -// } - reader.skipValue() - return null - } - return try { wrappedAdapter.fromJson(reader, customScalarAdapters) } catch (e: ApolloGraphQLException) { @@ -449,6 +427,7 @@ class CatchToNullAdapter(private val wrappedAdapter: Adapter) : Adapter<@J override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: T?) { if (value == null) { + // XXX: this potentially writes null instead of an error writer.nullValue() } else { wrappedAdapter.toJson(writer, customScalarAdapters, value) @@ -466,10 +445,10 @@ fun Adapter.list() = ListAdapter(this) fun Adapter.obj(buffered: Boolean = false) = ObjectAdapter(this, buffered) @JvmName("-result") -fun Adapter.catchToResult() = CatchToResultAdapter(this,) +fun Adapter.catchToResult() = CatchToResultAdapter(this) -@JvmName("-orThrow") -fun Adapter.catchToThrow() = CatchToThrowAdapter(this,) +@JvmName("-errorAware") +fun Adapter.errorAware() = ErrorAwareAdapter(this) @JvmName("-orNull") -fun Adapter.catchToNull() = CatchToNullAdapter(this,) \ No newline at end of file +fun Adapter.catchToNull() = CatchToNullAdapter(this) \ No newline at end of file diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt index d4422bbbc05..cf555bbbf61 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt @@ -27,6 +27,11 @@ class CustomScalarAdapters private constructor( */ @JvmField val errors: List?, + /** + * Whether to ignore errors for backward compatibility purposes + */ + @JvmField + val ignoreErrors: Boolean, private val unsafe: Boolean, ) : ExecutionContext.Element { @@ -133,6 +138,7 @@ class CustomScalarAdapters private constructor( private var falseVariables: Set? = null private var deferredFragmentIdentifiers: Set? = null private var errors: List? = null + private var ignoreErrors: Boolean = false fun falseVariables(falseVariables: Set?) = apply { this.falseVariables = falseVariables @@ -146,6 +152,10 @@ class CustomScalarAdapters private constructor( this.errors = errors } + fun ignoreErrors(ignoreErrors: Boolean) = apply { + this.ignoreErrors = ignoreErrors + } + fun add( name: String, adapter: Adapter, @@ -180,6 +190,7 @@ class CustomScalarAdapters private constructor( falseVariables, deferredFragmentIdentifiers, errors, + ignoreErrors, unsafe, ) } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executable.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executable.kt index 93e67803d12..104094c1766 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executable.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executable.kt @@ -30,6 +30,12 @@ interface Executable { */ fun rootField(): CompiledField + /** + * A flag to disable error checking for the whole operation. + * Used for backward compatibility. + */ + val ignoreErrors: Boolean + /** * Marker interface for generated models */ diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt index 96a30624cde..8e981aaddc3 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt @@ -78,6 +78,7 @@ fun Executable.parseData( .falseVariables(falseVariables) .deferredFragmentIdentifiers(deferredFragmentIds) .errors(errors) + .ignoreErrors(ignoreErrors) .build() return adapter().nullable().fromJson(jsonReader, customScalarAdapters1) } diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt index 6ec219324ba..bef48a92ef3 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt @@ -41,6 +41,10 @@ class Schema internal constructor( .filterIsInstance() .associateBy { it.name } + val errorAware: Boolean = directiveDefinitions.any { + originalDirectiveName(it.key) == CATCH + } + val queryTypeDefinition: GQLTypeDefinition = rootOperationTypeDefinition("query", definitions) ?: throw SchemaValidationException("No query root type found") @@ -202,6 +206,7 @@ class Schema internal constructor( const val REQUIRES_OPT_IN = "requiresOptIn" const val CATCH = "catch" const val NULL_ONLY_ON_ERROR = "nullOnlyOnError" + const val IGNORE_ERRORS = "ignoreErrors" const val FIELD_POLICY_FOR_FIELD = "forField" const val FIELD_POLICY_KEY_ARGS = "keyArgs" diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index 5d5a7a3d8c8..e183623dfe8 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -76,8 +76,6 @@ fun List.optionalValue(schema: Schema?): Boolean? { fun List.findNonnull(schema: Schema) = any { schema.originalDirectiveName(it.name) == Schema.NONNULL } enum class CatchTo { - NO_CATCH, - THROW, RESULT, NULL } @@ -126,7 +124,6 @@ private fun GQLValue?.toCatchTo(): CatchTo { is GQLEnumValue -> when (this.value) { "NULL" -> CatchTo.NULL "RESULT" -> CatchTo.RESULT - "THROW" -> CatchTo.THROW else -> error("Unknown CatchTo value: ${this.value}") } @@ -139,14 +136,8 @@ fun List.findCatches(schema: Schema): List { return filter { schema.originalDirectiveName(it.name) == Schema.CATCH }.map { - val to = if (!it.getArgument("if", schema).toBoolean()) { - CatchTo.NO_CATCH - } else { - it.getArgument("to", schema).toCatchTo() - } - Catch( - to = to, + to = it.getArgument("to", schema).toCatchTo(), level = it.getArgument("level", schema)?.toIntOrNull(), ) } diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 15e664ce47e..46dea3555bc 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -283,7 +283,7 @@ Control over list items is done using the `level` argument: ```graphql type User { # friends is nullable but friends[0] is null only on errors - friends: [ID]! @nullOnlyOnError(level: 1) + friends: [User] @nullOnlyOnError(level: 1) } ``` @@ -305,11 +305,17 @@ By default, the first GraphQL error throws and fails the whole response. starting at 0 if there is no list. If level is null, the modifier is applied to all levels ""${'"'} -directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD | SCHEMA +directive @catch(to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD enum CatchTo { NULL, - THROW, RESULT, } + +""${'"'} +Never throw on errors. + +This is used for backward compatibility for clients where this was the default behaviour. +""${'"'} +directive @ignoreErrors on QUERY | MUTATION | SUBSCRIPTION """.trimIndent() \ No newline at end of file diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/Identifiers.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/Identifiers.kt index 3864ae3bb30..9d5f5162599 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/Identifiers.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/Identifiers.kt @@ -1,6 +1,7 @@ package com.apollographql.apollo3.compiler.codegen internal object Identifier { + const val ignoreErrors = "ignoreErrors" const val __h: String = "__h" const val adapter = "adapter" const val evaluate = "evaluate" diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt index 05902ae6784..59215cdfaa5 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt @@ -183,7 +183,7 @@ internal object KotlinCodeGen { val generateInputBuilders = kotlinCodegenOptions.generateInputBuilders val upstreamResolver = resolverInfos.fold(null as KotlinResolver?) { acc, resolverInfo -> - KotlinResolver(resolverInfo.entries, acc, scalarMapping, requiresOptInAnnotation, hooks) + KotlinResolver(resolverInfo.entries, acc, scalarMapping, requiresOptInAnnotation, hooks, commonCodegenOptions.codegenSchema.schema.errorAware) } val irSchema = commonCodegenOptions.irSchema @@ -200,7 +200,14 @@ internal object KotlinCodeGen { generateMethods = generateMethods, jsExport = jsExport, layout = layout, - resolver = KotlinResolver(emptyList(), upstreamResolver, scalarMapping, requiresOptInAnnotation, hooks), + resolver = KotlinResolver( + entries = emptyList(), + next = upstreamResolver, + scalarMapping = scalarMapping, + requiresOptInAnnotation = requiresOptInAnnotation, + hooks = hooks, + errorAware = commonCodegenOptions.codegenSchema.schema.errorAware + ), targetLanguageVersion = targetLanguageVersion, ) val builders = mutableListOf() @@ -329,7 +336,14 @@ internal object KotlinCodeGen { generateMethods = emptyList(), jsExport = false, layout = layout, - resolver = KotlinResolver(emptyList(), null, codegenSchema.scalarMapping, null, ApolloCompilerKotlinHooks.Identity), + resolver = KotlinResolver( + entries = emptyList(), + next = null, + scalarMapping = codegenSchema.scalarMapping, + requiresOptInAnnotation = null, + hooks = ApolloCompilerKotlinHooks.Identity, + errorAware = codegenSchema.schema.errorAware + ), targetLanguageVersion = TargetLanguage.KOTLIN_1_9, ) val builders = mutableListOf() @@ -378,12 +392,26 @@ internal object KotlinCodeGen { decapitalizeFields = false, ) - val upstreamResolver = KotlinResolver(codegenMetadata.resolverInfo.entries, null, codegenSchema.scalarMapping, null, ApolloCompilerKotlinHooks.Identity) + val upstreamResolver = KotlinResolver( + entries = codegenMetadata.resolverInfo.entries, + next = null, + scalarMapping = codegenSchema.scalarMapping, + requiresOptInAnnotation = null, + hooks = ApolloCompilerKotlinHooks.Identity, + errorAware = codegenSchema.schema.errorAware + ) val context = KotlinContext( generateMethods = emptyList(), jsExport = false, layout = layout, - resolver = KotlinResolver(emptyList(), upstreamResolver, codegenSchema.scalarMapping, null, ApolloCompilerKotlinHooks.Identity), + resolver = KotlinResolver( + entries = emptyList(), + next = upstreamResolver, + scalarMapping = codegenSchema.scalarMapping, + requiresOptInAnnotation = null, + hooks = ApolloCompilerKotlinHooks.Identity, + errorAware = codegenSchema.schema.errorAware + ), targetLanguageVersion = TargetLanguage.KOTLIN_1_9, ) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt index 81a9aeb9afc..78f28a02200 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt @@ -43,6 +43,7 @@ internal class KotlinResolver( private val scalarMapping: Map, private val requiresOptInAnnotation: String?, private val hooks: ApolloCompilerKotlinHooks, + private val errorAware: Boolean, ) { fun resolve(key: ResolverKey): ClassName? = hooks.overrideResolvedType(key, classNames[key] ?: next?.resolve(key)) @@ -99,7 +100,6 @@ internal class KotlinResolver( type.catchTo != IrCatchTo.NoCatch -> { resolveIrType(type.removeCatchTo(), jsExport, isInterface).let { when (type.catchTo) { - IrCatchTo.Throw -> it IrCatchTo.Null -> it.copy(nullable = true) IrCatchTo.Result -> KotlinSymbols.FieldResult.parameterizedBy(it) IrCatchTo.NoCatch -> error("") // keep the compiler happy @@ -208,24 +208,29 @@ internal class KotlinResolver( is IrCompositeType2 -> null } } - internal fun adapterInitializer(type: IrType, requiresBuffering: Boolean, jsExport: Boolean, runtimeAdapterPrefix: String): CodeBlock { + return adapterInitializerInternal(type, requiresBuffering, jsExport, runtimeAdapterPrefix, errorAware) + } + internal fun adapterInitializerInternal(type: IrType, requiresBuffering: Boolean, jsExport: Boolean, runtimeAdapterPrefix: String, errorAware: Boolean): CodeBlock { return when { type.optional -> { val presentFun = MemberName("com.apollographql.apollo3.api", "present") - CodeBlock.of("%L.%M()", adapterInitializer(type.optional(false), requiresBuffering, jsExport, runtimeAdapterPrefix), presentFun) + CodeBlock.of("%L.%M()", adapterInitializerInternal(type.optional(false), requiresBuffering, jsExport, runtimeAdapterPrefix, errorAware), presentFun) } type.catchTo != IrCatchTo.NoCatch -> { - adapterInitializer(type.removeCatchTo(), requiresBuffering, jsExport, runtimeAdapterPrefix).let { + adapterInitializerInternal(type.removeCatchTo(), requiresBuffering, jsExport, runtimeAdapterPrefix, errorAware).let { val member = when (type.catchTo) { - IrCatchTo.Throw -> KotlinSymbols.catchToThrow IrCatchTo.Null -> KotlinSymbols.catchToNull IrCatchTo.Result -> KotlinSymbols.catchToResult IrCatchTo.NoCatch -> error("") // happy compiler } CodeBlock.of("%L.%M()", it, member) } - + } + errorAware -> { + adapterInitializerInternal(type.removeCatchTo(), requiresBuffering, jsExport, runtimeAdapterPrefix, false).let { + CodeBlock.of("%L.%M()", it, KotlinSymbols.errorAware) + } } type.nullable -> { // Don't hardcode the adapter when the scalar is mapped to a user-defined type @@ -242,7 +247,7 @@ internal class KotlinResolver( else -> { val nullableFun = MemberName("com.apollographql.apollo3.api", "nullable") - CodeBlock.of("%L.%M()", adapterInitializer(type.nullable(false), requiresBuffering, jsExport, runtimeAdapterPrefix), nullableFun) + CodeBlock.of("%L.%M()", adapterInitializerInternal(type.nullable(false), requiresBuffering, jsExport, runtimeAdapterPrefix, false), nullableFun) } } } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt index 976b862a836..9d5409676f9 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinSymbols.kt @@ -115,7 +115,7 @@ internal object KotlinSymbols { val obj = MemberName(apolloApiPackageName, "obj") val catchToResult = MemberName(apolloApiPackageName, "catchToResult") val catchToNull = MemberName(apolloApiPackageName, "catchToNull") - val catchToThrow = MemberName(apolloApiPackageName, "catchToThrow") + val errorAware = MemberName(apolloApiPackageName, "errorAware") val readTypename = MemberName(apolloApiJsonPackageName, "readTypename") val buildData = MemberName(apolloApiPackageName, "buildData") val GlobalBuilder = MemberName(apolloApiPackageName, "GlobalBuilder") diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/ExecutableCommon.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/ExecutableCommon.kt index 63bc428ae4c..d7fc5447ffb 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/ExecutableCommon.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/ExecutableCommon.kt @@ -17,6 +17,7 @@ import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.FunSpec import com.squareup.kotlinpoet.KModifier import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy +import com.squareup.kotlinpoet.PropertySpec import com.squareup.kotlinpoet.TypeName import com.squareup.kotlinpoet.TypeSpec @@ -44,6 +45,13 @@ internal fun serializeVariablesFunSpec( .build() } +internal fun ignoreErrorsPropertySpec(value: Boolean): PropertySpec { + return PropertySpec.builder(Identifier.ignoreErrors, KotlinSymbols.Boolean) + .addModifiers(KModifier.OVERRIDE) + .initializer(value.toString()) + .build() +} + internal fun adapterFunSpec( context: KotlinContext, property: IrProperty, diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/FragmentBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/FragmentBuilder.kt index b1b176e68c5..f314c87c5ea 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/FragmentBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/FragmentBuilder.kt @@ -105,6 +105,7 @@ internal class FragmentBuilder( .build() ) } + .addProperty(ignoreErrorsPropertySpec(false)) .build() .maybeAddFilterNotNull(generateFilterNotNull) } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/OperationBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/OperationBuilder.kt index 75f6eee269f..91f7b4cee8b 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/OperationBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/file/OperationBuilder.kt @@ -115,6 +115,7 @@ internal class OperationBuilder( .addFunction(rootFieldFunSpec()) .addTypes(dataTypeSpecs()) .addType(companionTypeSpec()) + .addProperty(ignoreErrorsPropertySpec(operation.ignoreErrors)) .build() .maybeAddFilterNotNull(generateFilterNotNull) } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperations.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperations.kt index 58716e7151b..5d1286f38ed 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperations.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperations.kt @@ -68,6 +68,7 @@ internal data class IrOperation( val responseBasedDataModelGroup: IrModelGroup?, val dataProperty: IrProperty, val dataModelGroup: IrModelGroup, + val ignoreErrors: Boolean, ) @Serializable diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 4d3338c6cf2..dea57838f88 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -309,7 +309,10 @@ internal class IrOperationsBuilder( filePath = sourceLocation!!.filePath!!, dataProperty = dataProperty, dataModelGroup = dataModelGroup, - responseBasedDataModelGroup = responseBasedModelGroup + responseBasedDataModelGroup = responseBasedModelGroup, + ignoreErrors = directives.any { + schema.originalDirectiveName(it.name) == Schema.IGNORE_ERRORS + } ) } @@ -493,14 +496,6 @@ internal class IrOperationsBuilder( } override fun merge(fields: List): List { - val defaultCatch = if (schema.directiveDefinitions.any { - schema.originalDirectiveName(it.key) == Schema.CATCH - }) { - Catch(to = CatchTo.THROW, null) - } else { - Catch(to = CatchTo.NO_CATCH, null) - } - return fields.map { fieldWithParent -> val gqlField = fieldWithParent.gqlField val parentTypeDefinition = schema.typeDefinition(fieldWithParent.parentType) @@ -629,7 +624,7 @@ internal class IrOperationsBuilder( } } // Finally, transform into Result or Nullable depending on catch - .catch(first.catchs, defaultCatch, 0) + .catch(first.catchs, 0) /** * Depending on the parent object/interface in which the field is queried, the field definition might have different descriptions/deprecationReasons @@ -694,29 +689,30 @@ internal class IrOperationsBuilder( } } - private fun IrType.catch(catchLevels: List, defaultCatch: Catch, level: Int): IrType { - val catchLevel = catchLevels.firstOrNull { it.level == null || it.level == level } ?: defaultCatch - return when (this) { + private fun IrType.catch(catchLevels: List, level: Int): IrType { + val catchLevel = catchLevels.firstOrNull { it.level == null || it.level == level } + var type = when (this) { is IrNamedType -> this - is IrListType -> copy(ofType = ofType.catch(catchLevels, defaultCatch, level + 1)) - }.catchTo(catchLevel.to.toIr()).let { + is IrListType -> copy(ofType = ofType.catch(catchLevels, level + 1)) + } + + if (catchLevel != null) { + type = type.catchTo(catchLevel.to.toIr()) if (catchLevel.to == CatchTo.NULL) { /** * Mark the field as nullable which duplicates some information with CatchTo but is needed for - * other codepaths to generate correct code and not consider this a required field + * other code paths to generate correct code and not consider this a required field * See also `IrType.removeCatchTo` */ - it.nullable(true) - } else { - it + type = type.nullable(true) } } + + return type } private fun CatchTo.toIr(): IrCatchTo { return when (this) { - CatchTo.NO_CATCH -> IrCatchTo.NoCatch - CatchTo.THROW -> IrCatchTo.Throw CatchTo.RESULT -> IrCatchTo.Result CatchTo.NULL -> IrCatchTo.Null } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt index 3c5d04dda22..ca08b57bfb2 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt @@ -53,7 +53,6 @@ sealed interface IrType { @Serializable enum class IrCatchTo { - Throw, Null, Result, NoCatch diff --git a/tests/catch/src/main/graphql/operations.graphql b/tests/catch/src/main/graphql/operations.graphql index 31c745204d9..eddf0c9efb9 100644 --- a/tests/catch/src/main/graphql/operations.graphql +++ b/tests/catch/src/main/graphql/operations.graphql @@ -1,6 +1,5 @@ -query UserThrow { - # - user @catch(to: THROW){ +query User { + user { name } } @@ -9,7 +8,7 @@ query UserResult { user @catch(to: RESULT) { name } -} +}# query UserNull { user @catch(to: NULL) { @@ -17,9 +16,14 @@ query UserNull { } } -query UserIgnore { - user @catch(if: false) { - name +query Product { + product { + price + } +} +query ProductIgnoreErrors @ignoreErrors { + product { + price } } diff --git a/tests/catch/src/main/graphql/schema.graphqls b/tests/catch/src/main/graphql/schema.graphqls index 64322972caf..231e553cb1b 100644 --- a/tests/catch/src/main/graphql/schema.graphqls +++ b/tests/catch/src/main/graphql/schema.graphqls @@ -14,6 +14,7 @@ type Query { nullOnlyOnError: Int @nullOnlyOnError deep: [[[Int]]] @nullOnlyOnError user: User @nullOnlyOnError + product: Product } type User { @@ -22,3 +23,6 @@ type User { } +type Product { + price: String +} \ No newline at end of file diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index fdf17d337d2..dee62e68926 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -9,20 +9,23 @@ import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse import com.apollographql.apollo3.api.valueOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException +import com.example.ProductIgnoreErrorsQuery +import com.example.ProductQuery import com.example.UserNullQuery +import com.example.UserQuery import com.example.UserResultQuery -import com.example.UserThrowQuery import okio.Buffer import org.intellij.lang.annotations.Language import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertIs +import kotlin.test.assertNotNull import kotlin.test.assertNull class CatchTest { @Test - fun userThrowOnUserNameError() { - val response = UserThrowQuery().parseResponse(userNameError) + fun userOnUserNameError() { + val response = UserQuery().parseResponse(userNameError) val exception = response.exception assertIs(exception) assertEquals("cannot resolve name", exception.error.message) @@ -43,7 +46,7 @@ class CatchTest { @Test fun userThrowOnUserSuccess() { - val response = UserThrowQuery().parseResponse(userSuccess) + val response = UserQuery().parseResponse(userSuccess) assertEquals("Pancakes", response.data!!.user.name) } @@ -61,6 +64,24 @@ class CatchTest { assertEquals("Pancakes", response.data!!.user!!.name) } + + @Test + fun productOnProductPriceError() { + val response = ProductQuery().parseResponse(productPriceError) + + val exception = response.exception + assertIs(exception) + assertEquals("cannot resolve price", exception.error.message) + } + + @Test + fun productIgnoreErrorsOnProductPriceError() { + val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.price) + assertEquals("cannot resolve price", response.errors?.single()?.message) + } } private fun String.jsonReader(): JsonReader = Buffer().writeUtf8(this).jsonReader() @@ -94,3 +115,20 @@ val userSuccess = """ } } """.trimIndent() + +@Language("json") +val productPriceError = """ + { + "errors": [ + { + "path": ["product", "price"], + "message": "cannot resolve price" + } + ], + "data": { + "product": { + "price": null + } + } + } + """.trimIndent() \ No newline at end of file From 884c95eee13ad79cad30dc794f6def3c4ec24bab Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 22:47:00 +0100 Subject: [PATCH 12/42] update test fixtures --- libraries/apollo-api/api/apollo-api.api | 19 +- libraries/apollo-ast/api/apollo-ast.api | 4 +- .../apollo-compiler/api/apollo-compiler.api | 1 - .../codegen/java/file/ExecutableCommon.kt | 11 + .../codegen/java/file/FragmentBuilder.kt | 1 + .../codegen/java/file/OperationBuilder.kt | 1 + .../antlr_tokens/TestQuery.java.expected | 5 + .../antlr_tokens/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../arguments_hardcoded/TestQuery.kt.expected | 2 + .../big_query/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../capitalized_fields/TestQuery.kt.expected | 2 + .../capitalized_fields/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../case_sensitive_enum/TestQuery.kt.expected | 2 + .../companion/TestQuery.java.expected | 5 + .../companion/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../custom_scalar_type/TestQuery.kt.expected | 2 + .../data_builders/AnimalQuery.java.expected | 5 + .../CharacterQuery.java.expected | 5 + .../data_builders/NodeQuery.java.expected | 5 + .../fragment/CatFragmentImpl.java.expected | 5 + .../fragment/DogFragmentImpl.java.expected | 5 + .../fragment/DroidFragmentImpl.java.expected | 5 + .../fragment/HumanFragmentImpl.java.expected | 5 + .../data_builders/AnimalQuery.kt.expected | 2 + .../data_builders/CharacterQuery.kt.expected | 2 + .../data_builders/NodeQuery.kt.expected | 2 + .../fragment/CatFragmentImpl.kt.expected | 2 + .../fragment/DogFragmentImpl.kt.expected | 2 + .../fragment/DroidFragmentImpl.kt.expected | 2 + .../fragment/HumanFragmentImpl.kt.expected | 2 + .../data_builders/AnimalQuery.kt.expected | 2 + .../data_builders/CharacterQuery.kt.expected | 2 + .../data_builders/NodeQuery.kt.expected | 2 + .../fragment/CatFragmentImpl.kt.expected | 2 + .../fragment/DogFragmentImpl.kt.expected | 2 + .../fragment/DroidFragmentImpl.kt.expected | 2 + .../fragment/HumanFragmentImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/HorseFragmentImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/HorseFragmentImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/HorseFragmentImpl.kt.expected | 2 + .../CatQuery.java.expected | 5 + .../fragment/AnimalFragmentImpl.java.expected | 5 + .../CatQuery.kt.expected | 2 + .../fragment/AnimalFragmentImpl.kt.expected | 2 + .../CatQuery.kt.expected | 2 + .../fragment/AnimalFragmentImpl.kt.expected | 2 + .../deprecation/TestQuery.java.expected | 5 + .../deprecation/TestQuery.kt.expected | 2 + .../enum_field/TestQuery.java.expected | 5 + .../enum_field/TestQuery.kt.expected | 2 + .../enums_as_sealed/TestQuery.java.expected | 5 + .../enums_as_sealed/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/DroidDetailsImpl.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../fragment/HumanDetailsImpl.java.expected | 5 + .../OtherDroidDetailsImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../OtherDroidDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../CharacterDetailsImpl.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../fragment/HumanDetailsImpl.java.expected | 5 + .../fragment_used_twice/TestQuery.kt.expected | 2 + .../fragment/CharacterDetailsImpl.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../fragment_used_twice/TestQuery.kt.expected | 2 + .../fragment/CharacterDetailsImpl.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/DroidDetailsImpl.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../fragment/HumanDetailsImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/IFragmentImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/IFragmentImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/IFragmentImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/DroidDetails1Impl.java.expected | 5 + .../fragment/DroidDetails2Impl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetails1Impl.kt.expected | 2 + .../fragment/DroidDetails2Impl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetails1Impl.kt.expected | 2 + .../fragment/DroidDetails2Impl.kt.expected | 2 + .../InlineMultipleWithDefer.java.expected | 5 + ...eMultipleWithDeferAndInclude.java.expected | 5 + ...nlineMultipleWithDeferWithIf.java.expected | 5 + .../InlineSingleWithDefer.java.expected | 5 + .../SpreadMultipleWithDefer.java.expected | 5 + ...dMultipleWithDeferAndInclude.java.expected | 5 + ...preadMultipleWithDeferWithIf.java.expected | 5 + .../SpreadSingleWithDefer.java.expected | 5 + .../CharacterDetails2Impl.java.expected | 5 + .../CharacterDetails3Impl.java.expected | 5 + .../CharacterDetailsImpl.java.expected | 5 + .../fragment/DroidDetailsImpl.java.expected | 5 + .../InlineMultipleWithDefer.kt.expected | 2 + ...ineMultipleWithDeferAndInclude.kt.expected | 2 + .../InlineMultipleWithDeferWithIf.kt.expected | 2 + .../InlineSingleWithDefer.kt.expected | 2 + .../SpreadMultipleWithDefer.kt.expected | 2 + ...eadMultipleWithDeferAndInclude.kt.expected | 2 + .../SpreadMultipleWithDeferWithIf.kt.expected | 2 + .../SpreadSingleWithDefer.kt.expected | 2 + .../CharacterDetails2Impl.kt.expected | 2 + .../CharacterDetails3Impl.kt.expected | 2 + .../fragment/CharacterDetailsImpl.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/DroidDetailsImpl.java.expected | 5 + .../fragment/HumanDetailsImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../hero_details/HeroDetails.java.expected | 5 + .../hero_details/HeroDetails.kt.expected | 2 + .../HeroDetailsQuery.java.expected | 5 + .../HeroDetailsQuery.kt.expected | 2 + .../hero_name/TestQuery.java.expected | 5 + .../hero_name/TestQuery.kt.expected | 2 + .../hero_name/TestQuery.kt.expected | 2 + ...AVeryAVeryAVeryAVeryLongName.java.expected | 5 + ...ryAVeryAVeryAVeryAVeryLongName.kt.expected | 2 + .../hero_with_review/TestQuery.java.expected | 5 + .../hero_with_review/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestOperation.java.expected | 5 + .../TestOperation.kt.expected | 2 + .../TestOperation.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../FindUserQuery.java.expected | 5 + .../FindUserQuery.kt.expected | 2 + .../input_object_type/TestQuery.java.expected | 5 + .../input_object_type/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../GetHuman.java.expected | 5 + .../GetHuman.kt.expected | 2 + .../GetHuman.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../introspection_query/TestQuery.kt.expected | 2 + .../java8annotation/LoginBarber.java.expected | 5 + .../java8annotation/LoginBarber.kt.expected | 2 + .../MyQuery.java.expected | 5 + .../MyQuery.kt.expected | 2 + .../MyQuery.java.expected | 5 + .../java_apollo_optionals/MyQuery.kt.expected | 2 + .../MyQuery.java.expected | 5 + .../java_guava_optionals/MyQuery.kt.expected | 2 + .../java_hashcode/TestQuery.java.expected | 5 + .../java_hashcode/TestQuery.kt.expected | 2 + .../java_java_optionals/MyQuery.java.expected | 5 + .../java_java_optionals/MyQuery.kt.expected | 2 + .../MyQuery.java.expected | 5 + .../MyQuery.kt.expected | 2 + .../MyQuery.java.expected | 5 + .../MyQuery.kt.expected | 2 + .../JavaPrimitiveQuery.java.expected | 5 + .../JavaPrimitiveQuery.kt.expected | 2 + .../list_field_clash/TestQuery.java.expected | 5 + .../list_field_clash/TestQuery.kt.expected | 2 + .../src/test/graphql/com/example/measurements | 478 +++++++++--------- .../merged_include/TestQuery.java.expected | 5 + .../merged_include/TestQuery.kt.expected | 2 + .../monomorphic/TestQuery.java.expected | 5 + .../monomorphic/TestQuery.kt.expected | 2 + .../monomorphic/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/AFragmentImpl.java.expected | 5 + .../fragment/Fragment1Impl.java.expected | 5 + .../fragment/Fragment2Impl.java.expected | 5 + .../multiple_fragments/TestQuery.kt.expected | 2 + .../fragment/AFragmentImpl.kt.expected | 2 + .../fragment/Fragment1Impl.kt.expected | 2 + .../fragment/Fragment2Impl.kt.expected | 2 + .../multiple_fragments/TestQuery.kt.expected | 2 + .../fragment/AFragmentImpl.kt.expected | 2 + .../fragment/Fragment1Impl.kt.expected | 2 + .../fragment/Fragment2Impl.kt.expected | 2 + .../CreateReviewForEpisode.java.expected | 5 + .../CreateReviewForEpisode.kt.expected | 2 + ...eateReviewForEpisodeMutation.java.expected | 5 + ...CreateReviewForEpisodeMutation.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/DroidDetailsImpl.java.expected | 5 + .../fragment/HumanDetailsImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/DroidDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../GetHero.java.expected | 5 + .../CharacterAppearsInImpl.java.expected | 5 + .../fragment/CharacterNameImpl.java.expected | 5 + .../GetHero.kt.expected | 2 + .../CharacterAppearsInImpl.kt.expected | 2 + .../fragment/CharacterNameImpl.kt.expected | 2 + .../GetHero.kt.expected | 2 + .../CharacterAppearsInImpl.kt.expected | 2 + .../fragment/CharacterNameImpl.kt.expected | 2 + .../GetUser.java.expected | 5 + .../fragment/QueryFragmentImpl.java.expected | 5 + .../fragment/UserFragmentImpl.java.expected | 5 + .../GetUser.kt.expected | 2 + .../fragment/QueryFragmentImpl.kt.expected | 2 + .../fragment/UserFragmentImpl.kt.expected | 2 + .../GetUser.kt.expected | 2 + .../fragment/QueryFragmentImpl.kt.expected | 2 + .../fragment/UserFragmentImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../AllStarships.java.expected | 5 + .../fragment/PilotFragmentImpl.java.expected | 5 + .../fragment/PlanetFragmentImpl.java.expected | 5 + .../StarshipFragmentImpl.java.expected | 5 + .../AllStarships.kt.expected | 2 + .../fragment/PilotFragmentImpl.kt.expected | 2 + .../fragment/PlanetFragmentImpl.kt.expected | 2 + .../fragment/StarshipFragmentImpl.kt.expected | 2 + .../AllStarships.kt.expected | 2 + .../fragment/PilotFragmentImpl.kt.expected | 2 + .../fragment/PlanetFragmentImpl.kt.expected | 2 + .../fragment/StarshipFragmentImpl.kt.expected | 2 + .../nonnull/TestQuery.java.expected | 5 + .../nonnull/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/BFragmentImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/BFragmentImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/BFragmentImpl.kt.expected | 2 + .../object/TestQuery.java.expected | 5 + .../object/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestOperation.java.expected | 5 + .../TestOperation.kt.expected | 2 + .../TestOperation.kt.expected | 2 + .../TestOperation.java.expected | 5 + .../fragment/AnimalFragmentImpl.java.expected | 5 + .../TestOperation.kt.expected | 2 + .../fragment/AnimalFragmentImpl.kt.expected | 2 + .../TestOperation.kt.expected | 2 + .../fragment/AnimalFragmentImpl.kt.expected | 2 + .../optional/TestQuery.java.expected | 5 + .../optional/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../recursive_selection/TestQuery.kt.expected | 2 + .../reserved_keywords/TestQuery.java.expected | 5 + .../reserved_keywords/TestQuery.kt.expected | 2 + .../reserved_keywords/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/QueryFragmentImpl.java.expected | 5 + .../root_query_fragment/TestQuery.kt.expected | 2 + .../fragment/QueryFragmentImpl.kt.expected | 2 + .../root_query_fragment/TestQuery.kt.expected | 2 + .../fragment/QueryFragmentImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/DroidFragmentImpl.java.expected | 5 + .../fragment/HeroFragmentImpl.java.expected | 5 + .../fragment/QueryFragmentImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/DroidFragmentImpl.kt.expected | 2 + .../fragment/HeroFragmentImpl.kt.expected | 2 + .../fragment/QueryFragmentImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/DroidFragmentImpl.kt.expected | 2 + .../fragment/HeroFragmentImpl.kt.expected | 2 + .../fragment/QueryFragmentImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../simple_fragment/TestQuery.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../fragment/HumanDetailsImpl.java.expected | 5 + .../simple_fragment/TestQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../simple_fragment/TestQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../fragment/HumanDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../simple_union/AnimalQuery.java.expected | 5 + .../fragment/CatFragmentImpl.java.expected | 5 + .../fragment/DogFragmentImpl.java.expected | 5 + .../simple_union/AnimalQuery.kt.expected | 2 + .../fragment/CatFragmentImpl.kt.expected | 2 + .../fragment/DogFragmentImpl.kt.expected | 2 + .../simple_union/AnimalQuery.kt.expected | 2 + .../fragment/CatFragmentImpl.kt.expected | 2 + .../fragment/DogFragmentImpl.kt.expected | 2 + .../starships/TestQuery.java.expected | 5 + .../starships/TestQuery.kt.expected | 2 + .../TestSubscription.java.expected | 5 + .../TestSubscription.kt.expected | 2 + .../CatQuery.java.expected | 5 + .../suppressed_warnings/CatQuery.kt.expected | 2 + .../target_name/TestQuery.java.expected | 5 + .../target_name/TestQuery.kt.expected | 2 + .../target_name/TestQuery.kt.expected | 2 + .../test_inline/GetPage.java.expected | 5 + .../test_inline/GetPage.kt.expected | 2 + .../test_inline/GetPage.kt.expected | 2 + .../two_heroes_unique/TestQuery.java.expected | 5 + .../two_heroes_unique/TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../union_fragment/TestQuery.java.expected | 5 + .../fragment/StarshipImpl.java.expected | 5 + .../union_fragment/TestQuery.kt.expected | 2 + .../fragment/StarshipImpl.kt.expected | 2 + .../union_fragment/TestQuery.kt.expected | 2 + .../fragment/StarshipImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + .../TestQuery.kt.expected | 2 + .../HeroDetailQuery.java.expected | 5 + .../fragment/HeroDetailsImpl.java.expected | 5 + .../HeroDetailQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../HeroDetailQuery.kt.expected | 2 + .../fragment/HeroDetailsImpl.kt.expected | 2 + .../TestQuery.java.expected | 5 + .../TestQuery.kt.expected | 2 + 407 files changed, 1524 insertions(+), 250 deletions(-) diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index 6ea07431a5d..a4e7dd7bf4b 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -22,13 +22,13 @@ public final class com/apollographql/apollo3/api/Adapters { public static final field NullableStringAdapter Lcom/apollographql/apollo3/api/NullableAdapter; public static final field StringAdapter Lcom/apollographql/apollo3/api/Adapter; public static final field UploadAdapter Lcom/apollographql/apollo3/api/Adapter; + public static final fun -errorAware (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ErrorAwareAdapter; public static final fun -list (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ListAdapter; public static final fun -nullable (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/NullableAdapter; public static final fun -obj (Lcom/apollographql/apollo3/api/Adapter;Z)Lcom/apollographql/apollo3/api/ObjectAdapter; public static synthetic fun -obj$default (Lcom/apollographql/apollo3/api/Adapter;ZILjava/lang/Object;)Lcom/apollographql/apollo3/api/ObjectAdapter; public static final fun -optional (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; public static final fun -orNull (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToNullAdapter; - public static final fun -orThrow (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToThrowAdapter; public static final fun -present (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; public static final fun -result (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToResultAdapter; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;)Ljava/lang/String; @@ -275,12 +275,6 @@ public final class com/apollographql/apollo3/api/CatchToResultAdapter : com/apol public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V } -public final class com/apollographql/apollo3/api/CatchToThrowAdapter : com/apollographql/apollo3/api/Adapter { - public fun (Lcom/apollographql/apollo3/api/Adapter;)V - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - public final class com/apollographql/apollo3/api/CompiledArgument { public synthetic fun (Ljava/lang/String;Lcom/apollographql/apollo3/api/Optional;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getName ()Ljava/lang/String; @@ -407,7 +401,8 @@ public final class com/apollographql/apollo3/api/CustomScalarAdapters : com/apol public final field deferredFragmentIdentifiers Ljava/util/Set; public final field errors Ljava/util/List; public final field falseVariables Ljava/util/Set; - public synthetic fun (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public final field ignoreErrors Z + public synthetic fun (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun adapterFor (Ljava/lang/String;)Lcom/apollographql/apollo3/api/Adapter; public fun getKey ()Lcom/apollographql/apollo3/api/ExecutionContext$Key; public final fun newBuilder ()Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; @@ -424,6 +419,7 @@ public final class com/apollographql/apollo3/api/CustomScalarAdapters$Builder { public final fun deferredFragmentIdentifiers (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; public final fun errors (Ljava/util/List;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; public final fun falseVariables (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; + public final fun ignoreErrors (Z)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; } public final class com/apollographql/apollo3/api/CustomScalarAdapters$Key : com/apollographql/apollo3/api/ExecutionContext$Key { @@ -517,8 +513,15 @@ public final class com/apollographql/apollo3/api/Error$Location { public fun toString ()Ljava/lang/String; } +public final class com/apollographql/apollo3/api/ErrorAwareAdapter : com/apollographql/apollo3/api/Adapter { + public fun (Lcom/apollographql/apollo3/api/Adapter;)V + public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; + public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V +} + public abstract interface class com/apollographql/apollo3/api/Executable { public abstract fun adapter ()Lcom/apollographql/apollo3/api/Adapter; + public abstract fun getIgnoreErrors ()Z public abstract fun rootField ()Lcom/apollographql/apollo3/api/CompiledField; public abstract fun serializeVariables (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Z)V } diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index 11e25e21478..0ff25e8269b 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -35,10 +35,8 @@ public final class com/apollographql/apollo3/ast/ApolloParser { } public final class com/apollographql/apollo3/ast/CatchTo : java/lang/Enum { - public static final field NO_CATCH Lcom/apollographql/apollo3/ast/CatchTo; public static final field NULL Lcom/apollographql/apollo3/ast/CatchTo; public static final field RESULT Lcom/apollographql/apollo3/ast/CatchTo; - public static final field THROW Lcom/apollographql/apollo3/ast/CatchTo; public static fun getEntries ()Lkotlin/enums/EnumEntries; public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/ast/CatchTo; public static fun values ()[Lcom/apollographql/apollo3/ast/CatchTo; @@ -946,12 +944,14 @@ public final class com/apollographql/apollo3/ast/Schema { public static final field FIELD_POLICY_FOR_FIELD Ljava/lang/String; public static final field FIELD_POLICY_KEY_ARGS Ljava/lang/String; public static final field FIELD_POLICY_PAGINATION_ARGS Ljava/lang/String; + public static final field IGNORE_ERRORS Ljava/lang/String; public static final field NONNULL Ljava/lang/String; public static final field NULL_ONLY_ON_ERROR Ljava/lang/String; public static final field OPTIONAL Ljava/lang/String; public static final field REQUIRES_OPT_IN Ljava/lang/String; public static final field TYPE_POLICY Ljava/lang/String; public final fun getDirectiveDefinitions ()Ljava/util/Map; + public final fun getErrorAware ()Z public final fun getForeignNames ()Ljava/util/Map; public final fun getMutationTypeDefinition ()Lcom/apollographql/apollo3/ast/GQLTypeDefinition; public final fun getQueryTypeDefinition ()Lcom/apollographql/apollo3/ast/GQLTypeDefinition; diff --git a/libraries/apollo-compiler/api/apollo-compiler.api b/libraries/apollo-compiler/api/apollo-compiler.api index bf4bcc79ea5..c24763f2a72 100644 --- a/libraries/apollo-compiler/api/apollo-compiler.api +++ b/libraries/apollo-compiler/api/apollo-compiler.api @@ -402,7 +402,6 @@ public final class com/apollographql/apollo3/compiler/ir/IrCatchTo : java/lang/E public static final field NoCatch Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public static final field Null Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public static final field Result Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; - public static final field Throw Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public static fun getEntries ()Lkotlin/enums/EnumEntries; public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; public static fun values ()[Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/ExecutableCommon.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/ExecutableCommon.kt index 3d295b231ed..8bcf0ec93a7 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/ExecutableCommon.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/ExecutableCommon.kt @@ -1,7 +1,9 @@ package com.apollographql.apollo3.compiler.codegen.java.file +import com.apollographql.apollo3.compiler.capitalizeFirstLetter import com.apollographql.apollo3.compiler.codegen.Identifier import com.apollographql.apollo3.compiler.codegen.Identifier.customScalarAdapters +import com.apollographql.apollo3.compiler.codegen.Identifier.ignoreErrors import com.apollographql.apollo3.compiler.codegen.Identifier.root import com.apollographql.apollo3.compiler.codegen.Identifier.rootField import com.apollographql.apollo3.compiler.codegen.Identifier.serializeVariables @@ -42,6 +44,15 @@ internal fun serializeVariablesMethodSpec( .build() } +internal fun ignoreErrorsFunSpec(value: Boolean): MethodSpec { + return MethodSpec.methodBuilder("get${ignoreErrors.capitalizeFirstLetter()}") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(JavaClassNames.Override) + .returns(TypeName.BOOLEAN) + .addCode("return $L;", value.toString()) + .build() +} + internal fun adapterMethodSpec( resolver: JavaResolver, property: IrProperty, diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/FragmentBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/FragmentBuilder.kt index ba60d635894..92962b1e51b 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/FragmentBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/FragmentBuilder.kt @@ -74,6 +74,7 @@ internal class FragmentBuilder( .addMethod(serializeVariablesMethodSpec()) .addMethod(adapterMethodSpec(context.resolver, fragment.dataProperty)) .addMethod(selectionsMethodSpec()) + .addMethod(ignoreErrorsFunSpec(false)) // Fragments can have multiple data shapes .addTypes(dataTypeSpecs()) .build() diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/OperationBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/OperationBuilder.kt index 6d96a433429..6e8fafc67df 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/OperationBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/file/OperationBuilder.kt @@ -105,6 +105,7 @@ internal class OperationBuilder( addMethod(buildDataOverloadMethod()) } .addTypes(dataTypeSpecs()) + .addMethod(ignoreErrorsFunSpec(false)) .addField( FieldSpec.builder(JavaClassNames.String, OPERATION_ID) .addModifiers(Modifier.FINAL) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/java/operationBased/antlr_tokens/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/java/operationBased/antlr_tokens/TestQuery.java.expected index 49574193c04..a0ce87b1899 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/java/operationBased/antlr_tokens/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/java/operationBased/antlr_tokens/TestQuery.java.expected @@ -125,6 +125,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional operation = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/kotlin/responseBased/antlr_tokens/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/kotlin/responseBased/antlr_tokens/TestQuery.kt.expected index d8c366a199d..2dbad4f9ccb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/kotlin/responseBased/antlr_tokens/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/antlr_tokens/kotlin/responseBased/antlr_tokens/TestQuery.kt.expected @@ -23,6 +23,8 @@ import com.example.antlr_tokens.type.Query as CompiledQuery public data class TestQuery( public val operation: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/java/operationBased/arguments_hardcoded/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/java/operationBased/arguments_hardcoded/TestQuery.java.expected index 5dfe8617d61..d7b312c9aa2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/java/operationBased/arguments_hardcoded/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/java/operationBased/arguments_hardcoded/TestQuery.java.expected @@ -119,6 +119,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/TestQuery.kt.expected index b209697d94d..5b06972723f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.arguments_hardcoded.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/TestQuery.kt.expected index 50ec55d3a69..82f135defa8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.big_query.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/java/operationBased/capitalized_fields/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/java/operationBased/capitalized_fields/TestQuery.java.expected index 4c8008ba087..867f458bfe2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/java/operationBased/capitalized_fields/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/java/operationBased/capitalized_fields/TestQuery.java.expected @@ -121,6 +121,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/TestQuery.kt.expected index 23cc61acd94..09f85a8ead3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.capitalized_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/TestQuery.kt.expected index 7a0eab4c028..88b3a46410a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.capitalized_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/java/operationBased/case_sensitive_enum/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/java/operationBased/case_sensitive_enum/TestQuery.java.expected index 5ebbd5cb804..48471f7e070 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/java/operationBased/case_sensitive_enum/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/java/operationBased/case_sensitive_enum/TestQuery.java.expected @@ -114,6 +114,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/kotlin/responseBased/case_sensitive_enum/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/kotlin/responseBased/case_sensitive_enum/TestQuery.kt.expected index 3a40d4dd161..920f18188e0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/kotlin/responseBased/case_sensitive_enum/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/case_sensitive_enum/kotlin/responseBased/case_sensitive_enum/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.case_sensitive_enum.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/companion/java/operationBased/companion/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/companion/java/operationBased/companion/TestQuery.java.expected index 83d7a8a8ae4..8214972e0a8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/companion/java/operationBased/companion/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/companion/java/operationBased/companion/TestQuery.java.expected @@ -116,6 +116,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/TestQuery.kt.expected index 0c9fc36d0de..3c4e7646eb2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.`companion`.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/java/operationBased/custom_scalar_type/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/java/operationBased/custom_scalar_type/TestQuery.java.expected index ca725775f71..3ed8ce636e9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/java/operationBased/custom_scalar_type/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/java/operationBased/custom_scalar_type/TestQuery.java.expected @@ -124,6 +124,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/TestQuery.kt.expected index 2690e1397f8..22d23411653 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.custom_scalar_type.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/AnimalQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/AnimalQuery.java.expected index 0824e2fc55b..6f0e308b530 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/AnimalQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/AnimalQuery.java.expected @@ -147,6 +147,11 @@ public class AnimalQuery implements Query { return buildData(map, new DefaultFakeResolver(__Schema.types)); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/CharacterQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/CharacterQuery.java.expected index ba0e9d21cd5..a1974ac1553 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/CharacterQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/CharacterQuery.java.expected @@ -149,6 +149,11 @@ public class CharacterQuery implements Query { return buildData(map, new DefaultFakeResolver(__Schema.types)); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/NodeQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/NodeQuery.java.expected index 109751d0959..3fd585b504c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/NodeQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/NodeQuery.java.expected @@ -148,6 +148,11 @@ public class NodeQuery implements Query { return buildData(map, new DefaultFakeResolver(__Schema.types)); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/CatFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/CatFragmentImpl.java.expected index f2d866ac7ea..12da57a042f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/CatFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/CatFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class CatFragmentImpl implements Fragment { .selections(CatFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DogFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DogFragmentImpl.java.expected index 6338fea0fd0..c4f69bfb8c2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DogFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DogFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class DogFragmentImpl implements Fragment { .selections(DogFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DroidFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DroidFragmentImpl.java.expected index de41b0a6ab7..424ca6a8219 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DroidFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/DroidFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class DroidFragmentImpl implements Fragment { .selections(DroidFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/HumanFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/HumanFragmentImpl.java.expected index 9523ed5d450..6cd6a7c7775 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/HumanFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/java/operationBased/data_builders/fragment/HumanFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class HumanFragmentImpl implements Fragment { .selections(HumanFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/AnimalQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/AnimalQuery.kt.expected index 1e1005a682a..69b655737f1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/AnimalQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/AnimalQuery.kt.expected @@ -30,6 +30,8 @@ import kotlin.Unit import com.example.data_builders.type.Query as CompiledQuery public class AnimalQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/CharacterQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/CharacterQuery.kt.expected index 1ba9a3b2654..2c124574549 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/CharacterQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/CharacterQuery.kt.expected @@ -30,6 +30,8 @@ import kotlin.Unit import com.example.data_builders.type.Query as CompiledQuery public class CharacterQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/NodeQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/NodeQuery.kt.expected index 59961026fd4..2ac82298a74 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/NodeQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/NodeQuery.kt.expected @@ -30,6 +30,8 @@ import kotlin.Unit import com.example.data_builders.type.Query as CompiledQuery public class NodeQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl.kt.expected index 1fe684d17c3..ce4ab4ecd7a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl.kt.expected @@ -25,6 +25,8 @@ import kotlin.Int import kotlin.Unit public class CatFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl.kt.expected index 5f8ac1fc856..56b8575bad6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl.kt.expected @@ -25,6 +25,8 @@ import kotlin.Int import kotlin.Unit public class DogFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl.kt.expected index 93b18028d74..6d15745fea4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl.kt.expected @@ -25,6 +25,8 @@ import kotlin.Int import kotlin.Unit public class DroidFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl.kt.expected index d50778c9b22..04e0c5fc71e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl.kt.expected @@ -25,6 +25,8 @@ import kotlin.Int import kotlin.Unit public class HumanFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/AnimalQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/AnimalQuery.kt.expected index 3f13c45e839..6ddf2f30718 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/AnimalQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/AnimalQuery.kt.expected @@ -31,6 +31,8 @@ import kotlin.Unit import com.example.data_builders.type.Query as CompiledQuery public class AnimalQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/CharacterQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/CharacterQuery.kt.expected index 76a31ac3efb..f9ab04c7494 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/CharacterQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/CharacterQuery.kt.expected @@ -31,6 +31,8 @@ import kotlin.Unit import com.example.data_builders.type.Query as CompiledQuery public class CharacterQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/NodeQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/NodeQuery.kt.expected index 230b94b80ef..31ee35a510e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/NodeQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/NodeQuery.kt.expected @@ -31,6 +31,8 @@ import kotlin.Unit import com.example.data_builders.type.Query as CompiledQuery public class NodeQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl.kt.expected index a88b0cbbc5f..0e1f89af0a1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl.kt.expected @@ -26,6 +26,8 @@ import kotlin.String import kotlin.Unit public class CatFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl.kt.expected index 033c863215b..dc57cbbe0d2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl.kt.expected @@ -26,6 +26,8 @@ import kotlin.String import kotlin.Unit public class DogFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl.kt.expected index 72e8e9270ba..3b4533eb10a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl.kt.expected @@ -26,6 +26,8 @@ import kotlin.String import kotlin.Unit public class DroidFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl.kt.expected index ee28de88738..d49d44ec8af 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl.kt.expected @@ -26,6 +26,8 @@ import kotlin.String import kotlin.Unit public class HumanFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/TestQuery.java.expected index 2697619497c..bd12ea9ad92 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/TestQuery.java.expected @@ -129,6 +129,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.java.expected index 828778e4e14..94c6553f888 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/java/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class HorseFragmentImpl implements Fragment { .selections(HorseFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/TestQuery.kt.expected index 28b57c802e0..7b9ab1c99b0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.decapitalized_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected index d016bfaaad9..35d009d3faa 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HorseFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/TestQuery.kt.expected index b66543ae818..9fc5e5328c2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.decapitalized_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected index 6985a655ace..2d3d5156fe3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/fragment/HorseFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class HorseFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/CatQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/CatQuery.java.expected index 7c5b729d3f1..06b582700c5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/CatQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/CatQuery.java.expected @@ -127,6 +127,11 @@ public class CatQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.java.expected index 7cf031f8b0c..a562d4135cc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/java/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class AnimalFragmentImpl implements Fragment { .selections(AnimalFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/CatQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/CatQuery.kt.expected index d3195564d2e..20e8ab2f67b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/CatQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/CatQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.deprecated_merged_field.type.Query as CompiledQuery public class CatQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected index 30b367b8105..216179de924 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class AnimalFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/CatQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/CatQuery.kt.expected index 3a1e89e8446..25b02dd68c2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/CatQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/CatQuery.kt.expected @@ -26,6 +26,8 @@ import kotlin.Suppress import com.example.deprecated_merged_field.type.Query as CompiledQuery public class CatQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected index 96a343980a8..620f2f0e436 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import kotlin.Suppress public class AnimalFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/java/operationBased/deprecation/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/java/operationBased/deprecation/TestQuery.java.expected index 539c54463a2..7ba01456930 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/java/operationBased/deprecation/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/java/operationBased/deprecation/TestQuery.java.expected @@ -128,6 +128,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional episode = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/TestQuery.kt.expected index cc0db280951..4d7310a57a7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/TestQuery.kt.expected @@ -25,6 +25,8 @@ import com.example.deprecation.type.Query as CompiledQuery public data class TestQuery( public val episode: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/java/operationBased/enum_field/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/java/operationBased/enum_field/TestQuery.java.expected index 445f83fc79b..036c0fd3970 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/java/operationBased/enum_field/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/java/operationBased/enum_field/TestQuery.java.expected @@ -116,6 +116,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/kotlin/responseBased/enum_field/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/kotlin/responseBased/enum_field/TestQuery.kt.expected index 6745a544d8f..16770b2eac0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/kotlin/responseBased/enum_field/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/enum_field/kotlin/responseBased/enum_field/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.enum_field.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/java/operationBased/enums_as_sealed/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/java/operationBased/enums_as_sealed/TestQuery.java.expected index be4873fccab..6dab214ca55 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/java/operationBased/enums_as_sealed/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/java/operationBased/enums_as_sealed/TestQuery.java.expected @@ -114,6 +114,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/kotlin/responseBased/enums_as_sealed/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/kotlin/responseBased/enums_as_sealed/TestQuery.kt.expected index 05d7d7ec531..901c423e412 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/kotlin/responseBased/enums_as_sealed/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/enums_as_sealed/kotlin/responseBased/enums_as_sealed/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.enums_as_sealed.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/java/operationBased/field_with_include_directive/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/java/operationBased/field_with_include_directive/TestQuery.java.expected index ccf62c11fea..8d2beb47d28 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/java/operationBased/field_with_include_directive/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/java/operationBased/field_with_include_directive/TestQuery.java.expected @@ -134,6 +134,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Boolean includeName; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/kotlin/responseBased/field_with_include_directive/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/kotlin/responseBased/field_with_include_directive/TestQuery.kt.expected index 5f620cc2311..eac8a7410a7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/kotlin/responseBased/field_with_include_directive/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/field_with_include_directive/kotlin/responseBased/field_with_include_directive/TestQuery.kt.expected @@ -24,6 +24,8 @@ public data class TestQuery( public val includeName: Boolean, public val skipFriends: Boolean, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/java/operationBased/fieldset_with_multiple_super/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/java/operationBased/fieldset_with_multiple_super/TestQuery.java.expected index eccd6a6f799..e226cffca46 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/java/operationBased/fieldset_with_multiple_super/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/java/operationBased/fieldset_with_multiple_super/TestQuery.java.expected @@ -129,6 +129,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/operationBased/fieldset_with_multiple_super/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/operationBased/fieldset_with_multiple_super/TestQuery.kt.expected index 7cbfd9018eb..cc7d886a518 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/operationBased/fieldset_with_multiple_super/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/operationBased/fieldset_with_multiple_super/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.fieldset_with_multiple_super.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/TestQuery.kt.expected index 9e71cad128c..17a25c2405a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.fieldset_with_multiple_super.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/TestQuery.java.expected index 422312b7700..10fd4f1969f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/TestQuery.java.expected @@ -180,6 +180,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Boolean withDetails; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.java.expected index afff8f2f4f2..2185d6a35a7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class DroidDetailsImpl implements Fragment { .selections(DroidDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.java.expected index c5c818adf8e..4b735c512ea 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.java.expected index e95ed839808..336ed7c480f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HumanDetailsImpl implements Fragment { .selections(HumanDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.java.expected index 04af773622f..4ba1d95e2a6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/java/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class OtherDroidDetailsImpl implements Fragment { .selections(OtherDroidDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/TestQuery.kt.expected index 37f4dcf9a86..29857dd62bc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/TestQuery.kt.expected @@ -31,6 +31,8 @@ public data class TestQuery( public val optionalWithDefaultTrue: Optional = Optional.Absent, public val optionalWithNoDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.kt.expected index 5df6f6d8d03..540cc71965b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/DroidDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.kt.expected index f0e2a41e0a9..0ca5a25a48e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.kt.expected index 104f136ec5c..1718fa77ae2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HumanDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.kt.expected index ddf73fe2739..99327d3f935 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class OtherDroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/TestQuery.java.expected index 816de7f564a..ff98f90125d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/TestQuery.java.expected @@ -129,6 +129,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.java.expected index 533a8be31b6..34eb7a5b753 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/java/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/TestQuery.kt.expected index 65e225d9312..255a7126d6c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.fragment_spread_with_nested_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected index 4647a47d24f..11768dedca1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/TestQuery.kt.expected index 6986883c512..e731b693661 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.fragment_spread_with_nested_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected index 0fc01f08bce..d4173dbe125 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.collections.List public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/TestQuery.java.expected index bd793c6ca2d..95202f4fa65 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/TestQuery.java.expected @@ -136,6 +136,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.java.expected index 5251403a88c..b5e0c495924 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class CharacterDetailsImpl implements Fragment { .selections(CharacterDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.java.expected index 5eb7c3fa171..07347d6b819 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.java.expected index 89548457501..0cb46746b12 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/java/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HumanDetailsImpl implements Fragment { .selections(HumanDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/TestQuery.kt.expected index d76ce4fd9c3..a5ce671d79b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.fragment_used_twice.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected index 16ac96b7191..7bfa3a6d8e0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CharacterDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected index 30aa4170d45..839da845e3c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected index 0488a199ae3..9d207489e0d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/TestQuery.kt.expected index a3b68ce7499..8ef78fd4e61 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.Suppress import com.example.fragment_used_twice.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected index 11f86cdd2ea..0500ba563c9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class CharacterDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected index 9b3b6d5facd..ae5fa9bc0ce 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected index e5d035a21f2..730adfe903a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/TestQuery.java.expected index 664f783d738..20e1f735eed 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/TestQuery.java.expected @@ -148,6 +148,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.java.expected index 35e9c00c78d..aca0e3d4685 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class DroidDetailsImpl implements Fragment { .selections(DroidDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.java.expected index 5a6d7d3f210..c8c8b367a59 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.java.expected index a694026d347..9b7fb4e28eb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/java/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HumanDetailsImpl implements Fragment { .selections(HumanDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/TestQuery.kt.expected index 73664f29008..d0696078f2a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.fragment_with_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected index 5201275941d..9de134939e6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected index f2c9f88d364..ee6d58b2f8d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected index 3a7e7b8f92c..6fd43ac60ed 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/TestQuery.kt.expected index 2e693669b81..018b5c59387 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/TestQuery.kt.expected @@ -27,6 +27,8 @@ import kotlin.collections.List import com.example.fragment_with_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected index e12e4c0eb2f..4c9368f832c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected index fd38dd6c30f..b6168f4c3ce 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl.kt.expected @@ -21,6 +21,8 @@ import kotlin.Suppress import kotlin.collections.List public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected index c646dde0720..4b8d15c5633 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/TestQuery.java.expected index 6e66bfdd63b..53ac4195ec2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/TestQuery.java.expected @@ -124,6 +124,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.java.expected index ae25822c331..29b051d9a1a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/java/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class IFragmentImpl implements Fragment { .selections(iFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected index 3a1a3234ed3..229d2a75388 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.fragment_with_multiple_fieldsets.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected index fe554dbeab8..9ec681386c1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class IFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected index 3b6c7a7658e..519d83dbc4a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.Suppress import com.example.fragment_with_multiple_fieldsets.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected index fb7f52a056f..724add7ac85 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class IFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/TestQuery.java.expected index 903a06afa65..3427bfb5262 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/TestQuery.java.expected @@ -127,6 +127,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.java.expected index 2cad6fa6ff7..7362d060cf9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.java.expected @@ -79,4 +79,9 @@ public class DroidDetails1Impl implements Fragment { .selections(DroidDetails1Selections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.java.expected index e10b609f656..66c8b7a942c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/java/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.java.expected @@ -79,4 +79,9 @@ public class DroidDetails2Impl implements Fragment { .selections(DroidDetails2Selections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/TestQuery.kt.expected index d1750590fb9..c072e2d8079 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.fragments_same_type_condition.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected index 4c62f101e64..f8a12c45873 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetails1Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected index b781fc4e565..c49006ce905 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetails2Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/TestQuery.kt.expected index b79fa3dbe58..3c930bb9acd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.Suppress import com.example.fragments_same_type_condition.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected index eaa92af1762..845ccfe968f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class DroidDetails1Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected index 262350c75cf..6d1525a9a58 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails2Impl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class DroidDetails2Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.java.expected index c132d9a21d1..941ca2e9d20 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.java.expected @@ -121,6 +121,11 @@ public class InlineMultipleWithDefer implements Query .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.java.expected index 22ebb5714ea..10731d4c092 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.java.expected @@ -122,6 +122,11 @@ public class SpreadMultipleWithDefer implements Query .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.java.expected index 0205a8496d9..58edaf80f54 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.java.expected @@ -79,4 +79,9 @@ public class CharacterDetails2Impl implements Fragment { .selections(CharacterDetails2Selections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.java.expected index b1962d64ec0..d1cc3917b3e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.java.expected @@ -79,4 +79,9 @@ public class CharacterDetails3Impl implements Fragment { .selections(CharacterDetails3Selections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.java.expected index 8e6d10ed2dc..a74d551088a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class CharacterDetailsImpl implements Fragment { .selections(CharacterDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.java.expected index b65c4ef1cd7..640695d4535 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/java/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class DroidDetailsImpl implements Fragment { .selections(DroidDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.kt.expected index 01e24cc9800..0e77178483a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDefer.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.fragments_with_defer_and_include_directives.type.Query as CompiledQuery public class InlineMultipleWithDefer() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferAndInclude.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferAndInclude.kt.expected index daa4c20d168..d8ae1f6fb75 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferAndInclude.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferAndInclude.kt.expected @@ -25,6 +25,8 @@ public data class InlineMultipleWithDeferAndInclude( public val cond3: Boolean, public val cond4: Boolean, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferWithIf.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferWithIf.kt.expected index 79151641914..fd49cf4f4ca 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferWithIf.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineMultipleWithDeferWithIf.kt.expected @@ -22,6 +22,8 @@ import com.example.fragments_with_defer_and_include_directives.type.Query as Com public data class InlineMultipleWithDeferWithIf( public val cond: Boolean, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineSingleWithDefer.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineSingleWithDefer.kt.expected index 9dbb01c6464..eb941a83927 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineSingleWithDefer.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/InlineSingleWithDefer.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.fragments_with_defer_and_include_directives.type.Query as CompiledQuery public class InlineSingleWithDefer() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.kt.expected index ae58b807384..740b45b853c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDefer.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.fragments_with_defer_and_include_directives.type.Query as CompiledQuery public class SpreadMultipleWithDefer() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferAndInclude.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferAndInclude.kt.expected index dabd8de64d1..55663096c93 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferAndInclude.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferAndInclude.kt.expected @@ -26,6 +26,8 @@ public data class SpreadMultipleWithDeferAndInclude( public val cond3: Boolean, public val cond4: Boolean, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferWithIf.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferWithIf.kt.expected index 34ede6ad221..01eeb31ecaf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferWithIf.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadMultipleWithDeferWithIf.kt.expected @@ -25,6 +25,8 @@ import com.example.fragments_with_defer_and_include_directives.type.Query as Com public data class SpreadMultipleWithDeferWithIf( public val cond: Boolean, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadSingleWithDefer.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadSingleWithDefer.kt.expected index c7a60ff7f05..46dc6cbcdc0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadSingleWithDefer.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/SpreadSingleWithDefer.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.fragments_with_defer_and_include_directives.type.Query as CompiledQuery public class SpreadSingleWithDefer() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.kt.expected index ae6458c411d..d402494350b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails2Impl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CharacterDetails2Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.kt.expected index 411fe18cdfa..af061c2f35a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetails3Impl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CharacterDetails3Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.kt.expected index 4ec357954d2..429151aee34 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/CharacterDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CharacterDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.kt.expected index ef144536898..94d677a1b29 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/fragment/DroidDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/TestQuery.java.expected index e6123fa8c63..e389c39a099 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/TestQuery.java.expected @@ -134,6 +134,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.java.expected index 3fd20747f8c..76986692c6a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class DroidDetailsImpl implements Fragment { .selections(DroidDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.java.expected index 6379f17373e..360f242aa7e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/java/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HumanDetailsImpl implements Fragment { .selections(HumanDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/TestQuery.kt.expected index 86262e101e6..4ca59805780 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.fragments_with_type_condition.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected index 67712565504..2da568bd49c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected index d9794403717..bbcf1413c64 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/TestQuery.kt.expected index c79761009e8..307539692cb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.Suppress import com.example.fragments_with_type_condition.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected index a869f6d49f2..2a60777182e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected index 65ec2281388..0789323376e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.Int import kotlin.String public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/java/operationBased/hero_details/HeroDetails.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/java/operationBased/hero_details/HeroDetails.java.expected index 4e928061449..e52b80439b6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/java/operationBased/hero_details/HeroDetails.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/java/operationBased/hero_details/HeroDetails.java.expected @@ -127,6 +127,11 @@ public class HeroDetails implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/HeroDetails.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/HeroDetails.kt.expected index 45db495bf45..a27572cb382 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/HeroDetails.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/HeroDetails.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.hero_details.type.Query as CompiledQuery public class HeroDetails() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/java/operationBased/hero_details_semantic_naming/HeroDetailsQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/java/operationBased/hero_details_semantic_naming/HeroDetailsQuery.java.expected index bbc24133fa5..f93123ca5e8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/java/operationBased/hero_details_semantic_naming/HeroDetailsQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/java/operationBased/hero_details_semantic_naming/HeroDetailsQuery.java.expected @@ -125,6 +125,11 @@ public class HeroDetailsQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/HeroDetailsQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/HeroDetailsQuery.kt.expected index 9af63736b29..6713b401abe 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/HeroDetailsQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/HeroDetailsQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.hero_details_semantic_naming.type.Query as CompiledQuery public class HeroDetailsQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/java/operationBased/hero_name/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/java/operationBased/hero_name/TestQuery.java.expected index 0c5bbb9270c..aeefd91a877 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/java/operationBased/hero_name/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/java/operationBased/hero_name/TestQuery.java.expected @@ -120,6 +120,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/TestQuery.kt.expected index 5d03ebfd9a4..1e357194229 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.hero_name.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/TestQuery.kt.expected index de4b4fe10d1..7eb78bbfddc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.hero_name.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/java/operationBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/java/operationBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.java.expected index 9b604b83482..4a3f80d2dcd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/java/operationBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/java/operationBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.java.expected @@ -125,6 +125,11 @@ public class TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVer .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional episodeAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.kt.expected index f08480ca2e2..3693ae11ea0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.kt.expected @@ -29,6 +29,8 @@ public data class ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/java/operationBased/hero_with_review/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/java/operationBased/hero_with_review/TestQuery.java.expected index e47d6c7fe6c..6caef17d853 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/java/operationBased/hero_with_review/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/java/operationBased/hero_with_review/TestQuery.java.expected @@ -135,6 +135,11 @@ public class TestQuery implements Mutation { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Episode ep; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/TestQuery.kt.expected index 0678d2586dc..5bb268d735c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/TestQuery.kt.expected @@ -24,6 +24,8 @@ import com.example.hero_with_review.type.Mutation as CompiledMutation public data class TestQuery( public val ep: Episode, ) : Mutation { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/java/operationBased/inline_fragment_for_non_optional_field/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/java/operationBased/inline_fragment_for_non_optional_field/TestQuery.java.expected index f7f83486c72..8efc2547db5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/java/operationBased/inline_fragment_for_non_optional_field/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/java/operationBased/inline_fragment_for_non_optional_field/TestQuery.java.expected @@ -120,6 +120,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/operationBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/operationBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected index 18d09ff4de2..b49056d74d7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/operationBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/operationBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.inline_fragment_for_non_optional_field.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/responseBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/responseBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected index a278dfa4e69..906a6c6368b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/responseBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/responseBased/inline_fragment_for_non_optional_field/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.inline_fragment_for_non_optional_field.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/java/operationBased/inline_fragment_inside_inline_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/java/operationBased/inline_fragment_inside_inline_fragment/TestQuery.java.expected index f987f4b1ab2..b51e25868d7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/java/operationBased/inline_fragment_inside_inline_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/java/operationBased/inline_fragment_inside_inline_fragment/TestQuery.java.expected @@ -126,6 +126,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected index 85219bfc04f..530aeef72a7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.inline_fragment_inside_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected index c68030c8cec..5a18a44974e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.inline_fragment_inside_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/java/operationBased/inline_fragment_intersection/TestOperation.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/java/operationBased/inline_fragment_intersection/TestOperation.java.expected index 14c60e565e7..7cd8a535ae7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/java/operationBased/inline_fragment_intersection/TestOperation.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/java/operationBased/inline_fragment_intersection/TestOperation.java.expected @@ -154,6 +154,11 @@ public class TestOperation implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/TestOperation.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/TestOperation.kt.expected index 14ca71fa491..4e00f721d2b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/TestOperation.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/TestOperation.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.inline_fragment_intersection.type.Query as CompiledQuery public class TestOperation() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/TestOperation.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/TestOperation.kt.expected index 3078a5ed91a..cf21661e2b5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/TestOperation.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/TestOperation.kt.expected @@ -25,6 +25,8 @@ import kotlin.collections.List import com.example.inline_fragment_intersection.type.Query as CompiledQuery public class TestOperation() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/java/operationBased/inline_fragment_merge_fields/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/java/operationBased/inline_fragment_merge_fields/TestQuery.java.expected index 4780e1ec871..167d171e510 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/java/operationBased/inline_fragment_merge_fields/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/java/operationBased/inline_fragment_merge_fields/TestQuery.java.expected @@ -135,6 +135,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/TestQuery.kt.expected index a77dfc3ffda..c5d2afaac17 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.inline_fragment_merge_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/TestQuery.kt.expected index a8bc3818151..485969af5d9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.inline_fragment_merge_fields.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/java/operationBased/inline_fragment_simple/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/java/operationBased/inline_fragment_simple/TestQuery.java.expected index 08d0054758f..c453f2074e3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/java/operationBased/inline_fragment_simple/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/java/operationBased/inline_fragment_simple/TestQuery.java.expected @@ -119,6 +119,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/operationBased/inline_fragment_simple/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/operationBased/inline_fragment_simple/TestQuery.kt.expected index 6c073059052..66d7ef260cd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/operationBased/inline_fragment_simple/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/operationBased/inline_fragment_simple/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.inline_fragment_simple.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/TestQuery.kt.expected index 7412637ba37..ab85113ddcf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.inline_fragment_simple.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/java/operationBased/inline_fragment_type_coercion/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/java/operationBased/inline_fragment_type_coercion/TestQuery.java.expected index 947d1880807..b013529de77 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/java/operationBased/inline_fragment_type_coercion/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/java/operationBased/inline_fragment_type_coercion/TestQuery.java.expected @@ -119,6 +119,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/TestQuery.kt.expected index 8d7a078d0a8..26b8b797013 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.inline_fragment_type_coercion.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/TestQuery.kt.expected index e7b05ac141d..142132beb85 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.inline_fragment_type_coercion.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/java/operationBased/inline_fragment_with_include_directive/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/java/operationBased/inline_fragment_with_include_directive/TestQuery.java.expected index 8fd79c055d1..3e0a6885bc1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/java/operationBased/inline_fragment_with_include_directive/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/java/operationBased/inline_fragment_with_include_directive/TestQuery.java.expected @@ -142,6 +142,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Boolean withDetails; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/TestQuery.kt.expected index c6b4d46720d..24b409dd8a5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/TestQuery.kt.expected @@ -23,6 +23,8 @@ public data class TestQuery( public val withDetails: Boolean, public val skipHumanDetails: Boolean, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/java/operationBased/inline_fragments_with_friends/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/java/operationBased/inline_fragments_with_friends/TestQuery.java.expected index c7ef9453f03..89a0ff80d72 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/java/operationBased/inline_fragments_with_friends/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/java/operationBased/inline_fragments_with_friends/TestQuery.java.expected @@ -131,6 +131,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/TestQuery.kt.expected index da4a6fb3e11..a4fab75130e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.inline_fragments_with_friends.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/TestQuery.kt.expected index ab20c6b842d..cdb6e9db77c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.collections.List import com.example.inline_fragments_with_friends.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/java/operationBased/input_object_oneof/FindUserQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/java/operationBased/input_object_oneof/FindUserQuery.java.expected index f57de553b80..e1b3b924dbf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/java/operationBased/input_object_oneof/FindUserQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/java/operationBased/input_object_oneof/FindUserQuery.java.expected @@ -123,6 +123,11 @@ public class FindUserQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private FindUserInput findUserInput; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/kotlin/responseBased/input_object_oneof/FindUserQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/kotlin/responseBased/input_object_oneof/FindUserQuery.kt.expected index e7401634d98..67ca8470a82 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/kotlin/responseBased/input_object_oneof/FindUserQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_oneof/kotlin/responseBased/input_object_oneof/FindUserQuery.kt.expected @@ -23,6 +23,8 @@ import com.example.input_object_oneof.type.Query as CompiledQuery public data class FindUserQuery( public val findUserInput: FindUserInput, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/java/operationBased/input_object_type/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/java/operationBased/input_object_type/TestQuery.java.expected index 096a278ea4f..fb6fc398090 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/java/operationBased/input_object_type/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/java/operationBased/input_object_type/TestQuery.java.expected @@ -133,6 +133,11 @@ public class TestQuery implements Mutation { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Episode ep; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/TestQuery.kt.expected index 3029cc4f2c0..202a053dc6e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/TestQuery.kt.expected @@ -26,6 +26,8 @@ public data class TestQuery( public val ep: Episode, public val review: ReviewInput, ) : Mutation { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/java/operationBased/input_object_variable_and_argument/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/java/operationBased/input_object_variable_and_argument/TestQuery.java.expected index 5dee517f824..a92d2e9267f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/java/operationBased/input_object_variable_and_argument/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/java/operationBased/input_object_variable_and_argument/TestQuery.java.expected @@ -152,6 +152,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional episode = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/TestQuery.kt.expected index eb3474a8e41..2dfa2026468 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/TestQuery.kt.expected @@ -28,6 +28,8 @@ public data class TestQuery( public val stars: Int, public val greenValue: Double, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/java/operationBased/input_object_variable_and_argument_with_generated_methods/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/java/operationBased/input_object_variable_and_argument_with_generated_methods/TestQuery.java.expected index 1340f939153..1db3f59b0e2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/java/operationBased/input_object_variable_and_argument_with_generated_methods/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/java/operationBased/input_object_variable_and_argument_with_generated_methods/TestQuery.java.expected @@ -152,6 +152,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional episode = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/kotlin/responseBased/input_object_variable_and_argument_with_generated_methods/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/kotlin/responseBased/input_object_variable_and_argument_with_generated_methods/TestQuery.kt.expected index 7a3bf0ca6af..dd5da1a8617 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/kotlin/responseBased/input_object_variable_and_argument_with_generated_methods/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument_with_generated_methods/kotlin/responseBased/input_object_variable_and_argument_with_generated_methods/TestQuery.kt.expected @@ -31,6 +31,8 @@ public class TestQuery( ) : Query { private var __hashCode: Int? = null + override val ignoreErrors: Boolean = false + override fun hashCode(): Int { if (__hashCode == null) { var __h = episode.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/java/operationBased/interface_always_nested/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/java/operationBased/interface_always_nested/TestQuery.java.expected index 88094b9dfeb..3078b4689cb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/java/operationBased/interface_always_nested/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/java/operationBased/interface_always_nested/TestQuery.java.expected @@ -122,6 +122,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/operationBased/interface_always_nested/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/operationBased/interface_always_nested/TestQuery.kt.expected index a1ff9ee06e5..617362c3756 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/operationBased/interface_always_nested/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/operationBased/interface_always_nested/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.interface_always_nested.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/TestQuery.kt.expected index 831ac529806..a6b5e1f99e2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.interface_always_nested.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/java/operationBased/interface_on_interface/GetHuman.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/java/operationBased/interface_on_interface/GetHuman.java.expected index 0acb1062c00..c681fbc421e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/java/operationBased/interface_on_interface/GetHuman.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/java/operationBased/interface_on_interface/GetHuman.java.expected @@ -124,6 +124,11 @@ public class GetHuman implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/GetHuman.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/GetHuman.kt.expected index 5309bdab88b..2f46f9fdee2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/GetHuman.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/GetHuman.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.interface_on_interface.type.Query as CompiledQuery public class GetHuman() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/GetHuman.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/GetHuman.kt.expected index 36b052a1e0a..bc0ee7c81c3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/GetHuman.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/GetHuman.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.interface_on_interface.type.Query as CompiledQuery public class GetHuman() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/java/operationBased/introspection_query/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/java/operationBased/introspection_query/TestQuery.java.expected index dd3ca0c99be..cd0cd1d69c5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/java/operationBased/introspection_query/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/java/operationBased/introspection_query/TestQuery.java.expected @@ -126,6 +126,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/TestQuery.kt.expected index ca779f5057b..45509342c88 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.introspection_query.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/java/operationBased/java8annotation/LoginBarber.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/java/operationBased/java8annotation/LoginBarber.java.expected index 9f3bff95093..8790def77f7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/java/operationBased/java8annotation/LoginBarber.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/java/operationBased/java8annotation/LoginBarber.java.expected @@ -124,6 +124,11 @@ public class LoginBarber implements Mutation { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private com.example.java8annotation.type.Login input; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/LoginBarber.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/LoginBarber.kt.expected index 27dcae8d839..09b3dd1105a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/LoginBarber.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/LoginBarber.kt.expected @@ -23,6 +23,8 @@ import com.example.java8annotation.type.Mutation as CompiledMutation public data class LoginBarber( public val input: Login, ) : Mutation { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/java/operationBased/java_android_annotations/MyQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/java/operationBased/java_android_annotations/MyQuery.java.expected index bc1125fa675..a7f74bb24d0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/java/operationBased/java_android_annotations/MyQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/java/operationBased/java_android_annotations/MyQuery.java.expected @@ -183,6 +183,11 @@ public class MyQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional nullableInt = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/MyQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/MyQuery.kt.expected index a34eb4f65d2..3deced57258 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/MyQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/MyQuery.kt.expected @@ -31,6 +31,8 @@ public data class MyQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/java/operationBased/java_apollo_optionals/MyQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/java/operationBased/java_apollo_optionals/MyQuery.java.expected index 368c82d6a9f..707e2f5fe3c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/java/operationBased/java_apollo_optionals/MyQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/java/operationBased/java_apollo_optionals/MyQuery.java.expected @@ -176,6 +176,11 @@ public class MyQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional> nullableInt = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/MyQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/MyQuery.kt.expected index 2e61fabfdbe..c5c46b4a67c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/MyQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/MyQuery.kt.expected @@ -31,6 +31,8 @@ public data class MyQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/java/operationBased/java_guava_optionals/MyQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/java/operationBased/java_guava_optionals/MyQuery.java.expected index 8552323c5d7..2accba80998 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/java/operationBased/java_guava_optionals/MyQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/java/operationBased/java_guava_optionals/MyQuery.java.expected @@ -176,6 +176,11 @@ public class MyQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional> nullableInt = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/MyQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/MyQuery.kt.expected index fd6caeda043..42df8e63d75 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/MyQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/MyQuery.kt.expected @@ -31,6 +31,8 @@ public data class MyQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/java/operationBased/java_hashcode/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/java/operationBased/java_hashcode/TestQuery.java.expected index 4b50f31d284..d9157bc88dc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/java/operationBased/java_hashcode/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/java/operationBased/java_hashcode/TestQuery.java.expected @@ -114,6 +114,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/kotlin/responseBased/java_hashcode/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/kotlin/responseBased/java_hashcode/TestQuery.kt.expected index 50e53ae3cc2..c0f1454aeea 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/kotlin/responseBased/java_hashcode/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_hashcode/kotlin/responseBased/java_hashcode/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.java_hashcode.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/java/operationBased/java_java_optionals/MyQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/java/operationBased/java_java_optionals/MyQuery.java.expected index 58d03fa5bf0..b48957f4458 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/java/operationBased/java_java_optionals/MyQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/java/operationBased/java_java_optionals/MyQuery.java.expected @@ -176,6 +176,11 @@ public class MyQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional> nullableInt = Optional.empty(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/MyQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/MyQuery.kt.expected index 064024f3531..7b68efd6a42 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/MyQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/MyQuery.kt.expected @@ -31,6 +31,8 @@ public data class MyQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/java/operationBased/java_jetbrains_annotations/MyQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/java/operationBased/java_jetbrains_annotations/MyQuery.java.expected index 465edc6753b..3670a795372 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/java/operationBased/java_jetbrains_annotations/MyQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/java/operationBased/java_jetbrains_annotations/MyQuery.java.expected @@ -183,6 +183,11 @@ public class MyQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional<@Nullable Integer> nullableInt = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/MyQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/MyQuery.kt.expected index f09b5f4140d..58d3a3d372b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/MyQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/MyQuery.kt.expected @@ -31,6 +31,8 @@ public data class MyQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/java/operationBased/java_jsr305_annotations/MyQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/java/operationBased/java_jsr305_annotations/MyQuery.java.expected index 11dfee4582d..1529539d7cf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/java/operationBased/java_jsr305_annotations/MyQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/java/operationBased/java_jsr305_annotations/MyQuery.java.expected @@ -183,6 +183,11 @@ public class MyQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional nullableInt = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/MyQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/MyQuery.kt.expected index 431f2750535..f303f5333fe 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/MyQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/MyQuery.kt.expected @@ -31,6 +31,8 @@ public data class MyQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/java/operationBased/java_primitive_types/JavaPrimitiveQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/java/operationBased/java_primitive_types/JavaPrimitiveQuery.java.expected index d8eafccf54d..f1e2b152efa 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/java/operationBased/java_primitive_types/JavaPrimitiveQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/java/operationBased/java_primitive_types/JavaPrimitiveQuery.java.expected @@ -172,6 +172,11 @@ public class JavaPrimitiveQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional nullableInt = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/JavaPrimitiveQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/JavaPrimitiveQuery.kt.expected index 3b1c1422e8a..7e1b806aae6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/JavaPrimitiveQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/JavaPrimitiveQuery.kt.expected @@ -30,6 +30,8 @@ public data class JavaPrimitiveQuery( public val nonNullableInput: MyInput, public val nonNullableInputWithDefault: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/java/operationBased/list_field_clash/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/java/operationBased/list_field_clash/TestQuery.java.expected index 93d3bbd9123..91deca42d06 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/java/operationBased/list_field_clash/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/java/operationBased/list_field_clash/TestQuery.java.expected @@ -117,6 +117,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/kotlin/responseBased/list_field_clash/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/kotlin/responseBased/list_field_clash/TestQuery.kt.expected index c11ba22e0f6..7e1620690ec 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/kotlin/responseBased/list_field_clash/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/list_field_clash/kotlin/responseBased/list_field_clash/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.list_field_clash.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/measurements b/libraries/apollo-compiler/src/test/graphql/com/example/measurements index 03b5f4c8d3f..980a522c7b5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/measurements +++ b/libraries/apollo-compiler/src/test/graphql/com/example/measurements @@ -2,247 +2,247 @@ // If you updated the codegen and test fixtures, you should commit this file too. Test: Total LOC: -aggregate-all 196571 -aggregate-kotlin-responseBased 62902 -aggregate-kotlin-operationBased 40747 +aggregate-all 197830 +aggregate-kotlin-responseBased 63172 +aggregate-kotlin-operationBased 40971 aggregate-kotlin-compat 0 -aggregate-java-operationBased 92922 +aggregate-java-operationBased 93687 -java-operationBased-fragments_with_defer_and_include_directives 5530 -kotlin-operationBased-fragments_with_defer_and_include_directives 3486 -java-operationBased-data_builders 2926 -kotlin-responseBased-fragment_with_inline_fragment 2402 -java-operationBased-mutation_create_review 2366 -kotlin-responseBased-data_builders 2271 -java-operationBased-fragment_with_inline_fragment 2221 -kotlin-operationBased-data_builders 1920 -java-operationBased-nested_named_fragments 1858 -java-operationBased-union_inline_fragments 1632 -java-operationBased-fragment_spread_with_include_directive 1617 -java-operationBased-unique_type_name 1615 -kotlin-responseBased-nested_named_fragments 1611 -java-operationBased-inline_fragment_intersection 1598 -java-operationBased-input_object_type 1584 -java-operationBased-mutation_create_review_semantic_naming 1568 -java-operationBased-root_query_fragment_with_nested_fragments 1561 -java-operationBased-simple_fragment 1463 -java-operationBased-named_fragment_delegate 1460 -kotlin-responseBased-mutation_create_review 1386 -kotlin-responseBased-named_fragment_delegate 1355 -java-operationBased-named_fragment_with_variables 1352 -kotlin-responseBased-unique_type_name 1339 -java-operationBased-nested_conditional_inline 1293 -kotlin-operationBased-fragment_with_inline_fragment 1277 -java-operationBased-fragment_used_twice 1272 -java-operationBased-multiple_fragments 1260 -kotlin-responseBased-root_query_fragment_with_nested_fragments 1255 -java-operationBased-nested_field_with_multiple_fieldsets 1254 -kotlin-responseBased-input_object_type 1238 -kotlin-operationBased-nested_named_fragments 1237 -java-operationBased-two_heroes_with_friends 1211 -kotlin-responseBased-inline_fragment_intersection 1209 -java-operationBased-inline_fragment_merge_fields 1209 -kotlin-responseBased-simple_fragment 1166 -java-operationBased-named_fragment_inside_inline_fragment 1160 -java-operationBased-fragments_with_type_condition 1154 -kotlin-responseBased-fragment_used_twice 1140 -java-operationBased-target_name 1126 -kotlin-operationBased-inline_fragment_intersection 1118 -kotlin-operationBased-union_inline_fragments 1115 -kotlin-responseBased-union_inline_fragments 1115 -java-operationBased-root_query_inline_fragment 1094 -kotlin-operationBased-unique_type_name 1094 -kotlin-responseBased-fragments_with_type_condition 1093 -java-operationBased-java_jetbrains_annotations 1093 -java-operationBased-java_android_annotations 1090 -java-operationBased-java_jsr305_annotations 1090 -kotlin-operationBased-fragment_spread_with_include_directive 1089 -java-operationBased-java_guava_optionals 1074 -java-operationBased-java_java_optionals 1074 -java-operationBased-java_apollo_optionals 1073 -kotlin-responseBased-multiple_fragments 1052 -java-operationBased-simple_fragment_with_inline_fragments 1046 -kotlin-responseBased-simple_fragment_with_inline_fragments 1045 -java-operationBased-inline_fragments_with_friends 1036 -kotlin-operationBased-root_query_fragment_with_nested_fragments 1033 -kotlin-responseBased-nested_conditional_inline 1031 -java-operationBased-fragment_spread_with_nested_fields 1030 -kotlin-responseBased-named_fragment_with_variables 1020 -java-operationBased-operationbased2_ex8 1020 -java-operationBased-java_primitive_types 1018 -kotlin-operationBased-simple_fragment 1014 -kotlin-operationBased-named_fragment_delegate 997 -java-operationBased-decapitalized_fields 971 -java-operationBased-fragments_same_type_condition 947 -java-operationBased-simple_union 946 -kotlin-responseBased-operationbased2_ex8 945 -java-operationBased-deprecated_merged_field 926 -java-operationBased-hero_details 919 -java-operationBased-not_all_combinations_are_needed 916 -java-operationBased-input_object_oneof 913 -java-operationBased-simple_inline_fragment 901 -java-operationBased-fieldset_with_multiple_super 900 -kotlin-operationBased-nested_conditional_inline 897 -java-operationBased-inline_fragment_with_include_directive 895 -java-operationBased-introspection_query 889 -kotlin-responseBased-mutation_create_review_semantic_naming 878 -kotlin-operationBased-fragment_used_twice 876 -kotlin-operationBased-named_fragment_with_variables 871 -kotlin-responseBased-fragment_spread_with_nested_fields 867 -java-operationBased-test_inline 864 -java-operationBased-union_fragment 861 -java-operationBased-inline_fragment_inside_inline_fragment 853 -kotlin-responseBased-nested_field_with_multiple_fieldsets 830 -kotlin-operationBased-multiple_fragments 828 -kotlin-operationBased-fragments_with_type_condition 824 -java-operationBased-named_fragment_without_implementation 821 -kotlin-operationBased-nested_field_with_multiple_fieldsets 800 -kotlin-operationBased-inline_fragment_merge_fields 794 -kotlin-responseBased-two_heroes_with_friends 793 -kotlin-operationBased-named_fragment_inside_inline_fragment 791 -java-operationBased-fragment_with_multiple_fieldsets 784 -java-operationBased-hero_details_semantic_naming 783 -java-operationBased-operationbased2_ex7 781 -kotlin-responseBased-inline_fragments_with_friends 780 -kotlin-responseBased-target_name 775 -kotlin-operationBased-root_query_inline_fragment 774 -kotlin-responseBased-named_fragment_inside_inline_fragment 772 -java-operationBased-suppressed_warnings 769 -kotlin-responseBased-deprecated_merged_field 768 -java-operationBased-path_vs_flat_accessors 761 -kotlin-responseBased-root_query_inline_fragment 750 -kotlin-responseBased-simple_union 749 -kotlin-operationBased-target_name 747 -java-operationBased-reserved_keywords 740 -java-operationBased-typename_always_first 738 -kotlin-operationBased-inline_fragments_with_friends 729 -kotlin-responseBased-fragments_same_type_condition 725 -java-operationBased-interface_on_interface 713 -kotlin-operationBased-simple_fragment_with_inline_fragments 707 -java-operationBased-root_query_fragment 698 -kotlin-operationBased-fragment_spread_with_nested_fields 695 -java-operationBased-input_object_variable_and_argument 694 -java-operationBased-input_object_variable_and_argument_with_generated_methods 694 -java-operationBased-monomorphic 670 -kotlin-operationBased-operationbased2_ex8 669 -java-operationBased-interface_always_nested 668 -kotlin-operationBased-fragments_same_type_condition 654 -kotlin-responseBased-input_object_variable_and_argument_with_generated_methods 650 -java-operationBased-capitalized_fields 649 -java-operationBased-recursive_selection 646 -kotlin-responseBased-union_fragment 646 -kotlin-responseBased-fragment_with_multiple_fieldsets 645 -kotlin-operationBased-simple_union 645 -kotlin-responseBased-test_inline 643 -kotlin-responseBased-named_fragment_without_implementation 642 -java-operationBased-hero_with_review 637 -kotlin-responseBased-hero_details 636 -java-operationBased-deprecation 633 -kotlin-operationBased-decapitalized_fields 631 -kotlin-operationBased-deprecated_merged_field 628 -kotlin-responseBased-inline_fragment_merge_fields 624 -kotlin-operationBased-not_all_combinations_are_needed 621 -java-operationBased-field_with_include_directive 618 -kotlin-operationBased-union_fragment 618 -java-operationBased-hero_name_query_long_name 617 -kotlin-operationBased-inline_fragment_inside_inline_fragment 617 -kotlin-operationBased-inline_fragment_with_include_directive 616 -java-operationBased-custom_scalar_type 615 -java-operationBased-variable_default_value 614 -kotlin-responseBased-inline_fragment_inside_inline_fragment 611 -java-operationBased-hero_name 610 -kotlin-operationBased-simple_inline_fragment 610 -kotlin-operationBased-fieldset_with_multiple_super 608 -kotlin-operationBased-named_fragment_without_implementation 607 -kotlin-responseBased-java_android_annotations 604 -kotlin-responseBased-java_apollo_optionals 604 -kotlin-responseBased-java_guava_optionals 604 -kotlin-responseBased-java_java_optionals 604 -kotlin-responseBased-java_jetbrains_annotations 604 -kotlin-responseBased-java_jsr305_annotations 604 -kotlin-responseBased-simple_inline_fragment 603 -kotlin-responseBased-operationbased2_ex7 602 -kotlin-responseBased-not_all_combinations_are_needed 596 -kotlin-responseBased-fieldset_with_multiple_super 595 -kotlin-responseBased-decapitalized_fields 594 -kotlin-responseBased-introspection_query 591 -java-operationBased-optional 591 -java-operationBased-java8annotation 590 -java-operationBased-enum_field 580 -java-operationBased-inline_fragment_for_non_optional_field 578 -kotlin-responseBased-reserved_keywords 574 -java-operationBased-inline_fragment_type_coercion 572 -kotlin-responseBased-java_primitive_types 568 -kotlin-operationBased-test_inline 567 -java-operationBased-two_heroes_unique 567 -kotlin-responseBased-input_object_variable_and_argument 561 -java-operationBased-list_field_clash 559 -java-operationBased-inline_fragment_simple 557 -kotlin-operationBased-reserved_keywords 547 -kotlin-responseBased-path_vs_flat_accessors 546 -kotlin-responseBased-hero_details_semantic_naming 539 -kotlin-responseBased-root_query_fragment 533 -kotlin-responseBased-typename_always_first 533 -kotlin-operationBased-fragment_with_multiple_fieldsets 529 -kotlin-responseBased-hero_with_review 523 -kotlin-operationBased-typename_always_first 522 -kotlin-responseBased-interface_on_interface 521 -kotlin-operationBased-operationbased2_ex7 521 -java-operationBased-starships 517 -kotlin-responseBased-suppressed_warnings 516 -kotlin-operationBased-path_vs_flat_accessors 515 -kotlin-responseBased-input_object_oneof 511 -java-operationBased-antlr_tokens 505 -kotlin-responseBased-hero_name 503 -java-operationBased-subscriptions 501 -kotlin-operationBased-interface_on_interface 495 -kotlin-responseBased-hero_name_query_long_name 493 -kotlin-responseBased-interface_always_nested 490 -java-operationBased-arguments_hardcoded 484 -kotlin-responseBased-custom_scalar_type 482 -kotlin-operationBased-root_query_fragment 482 -kotlin-responseBased-variable_default_value 467 -kotlin-operationBased-interface_always_nested 462 -java-operationBased-merged_include 462 -java-operationBased-operation_id_generator 462 -kotlin-responseBased-deprecation 459 -kotlin-operationBased-monomorphic 459 -kotlin-responseBased-monomorphic 459 -kotlin-responseBased-inline_fragment_for_non_optional_field 458 -kotlin-responseBased-enum_field 457 -java-operationBased-enums_as_sealed 452 -kotlin-responseBased-optional 451 -java-operationBased-case_sensitive_enum 449 -kotlin-operationBased-hero_name 446 -kotlin-responseBased-field_with_include_directive 444 -java-operationBased-nonnull 443 -kotlin-operationBased-capitalized_fields 440 -kotlin-responseBased-inline_fragment_type_coercion 436 -java-operationBased-companion 434 -java-operationBased-object 429 -kotlin-responseBased-inline_fragment_simple 427 -kotlin-responseBased-recursive_selection 427 -kotlin-operationBased-inline_fragment_for_non_optional_field 415 -kotlin-responseBased-list_field_clash 404 -kotlin-responseBased-capitalized_fields 402 -kotlin-responseBased-two_heroes_unique 402 -kotlin-operationBased-inline_fragment_type_coercion 401 -kotlin-operationBased-inline_fragment_simple 400 -kotlin-responseBased-starships 382 -kotlin-responseBased-java8annotation 381 -kotlin-responseBased-antlr_tokens 379 -kotlin-responseBased-arguments_hardcoded 370 -kotlin-responseBased-subscriptions 369 -kotlin-responseBased-enums_as_sealed 351 -kotlin-responseBased-operation_id_generator 337 -kotlin-responseBased-merged_include 335 -kotlin-responseBased-case_sensitive_enum 332 -java-operationBased-java_hashcode 330 -kotlin-responseBased-big_query 324 -kotlin-responseBased-nonnull 321 -kotlin-operationBased-companion 309 -kotlin-responseBased-object 307 -kotlin-responseBased-java_hashcode 247 +java-operationBased-fragments_with_defer_and_include_directives 5590 +kotlin-operationBased-fragments_with_defer_and_include_directives 3510 +java-operationBased-data_builders 2961 +kotlin-responseBased-fragment_with_inline_fragment 2410 +java-operationBased-mutation_create_review 2371 +kotlin-responseBased-data_builders 2285 +java-operationBased-fragment_with_inline_fragment 2241 +kotlin-operationBased-data_builders 1934 +java-operationBased-nested_named_fragments 1878 +java-operationBased-fragment_spread_with_include_directive 1642 +java-operationBased-union_inline_fragments 1637 +java-operationBased-unique_type_name 1625 +kotlin-responseBased-nested_named_fragments 1619 +java-operationBased-inline_fragment_intersection 1603 +java-operationBased-input_object_type 1589 +java-operationBased-root_query_fragment_with_nested_fragments 1581 +java-operationBased-mutation_create_review_semantic_naming 1573 +java-operationBased-simple_fragment 1478 +java-operationBased-named_fragment_delegate 1475 +kotlin-responseBased-mutation_create_review 1388 +java-operationBased-named_fragment_with_variables 1367 +kotlin-responseBased-named_fragment_delegate 1361 +kotlin-responseBased-unique_type_name 1343 +java-operationBased-nested_conditional_inline 1298 +java-operationBased-fragment_used_twice 1292 +kotlin-operationBased-fragment_with_inline_fragment 1285 +java-operationBased-multiple_fragments 1280 +kotlin-responseBased-root_query_fragment_with_nested_fragments 1263 +java-operationBased-nested_field_with_multiple_fieldsets 1259 +kotlin-operationBased-nested_named_fragments 1245 +kotlin-responseBased-input_object_type 1240 +java-operationBased-two_heroes_with_friends 1216 +java-operationBased-inline_fragment_merge_fields 1214 +kotlin-responseBased-inline_fragment_intersection 1211 +java-operationBased-named_fragment_inside_inline_fragment 1175 +kotlin-responseBased-simple_fragment 1172 +java-operationBased-fragments_with_type_condition 1169 +kotlin-responseBased-fragment_used_twice 1148 +java-operationBased-target_name 1131 +kotlin-operationBased-inline_fragment_intersection 1120 +kotlin-operationBased-union_inline_fragments 1117 +kotlin-responseBased-union_inline_fragments 1117 +kotlin-operationBased-fragment_spread_with_include_directive 1099 +kotlin-responseBased-fragments_with_type_condition 1099 +java-operationBased-root_query_inline_fragment 1099 +java-operationBased-java_jetbrains_annotations 1098 +kotlin-operationBased-unique_type_name 1098 +java-operationBased-java_android_annotations 1095 +java-operationBased-java_jsr305_annotations 1095 +java-operationBased-java_guava_optionals 1079 +java-operationBased-java_java_optionals 1079 +java-operationBased-java_apollo_optionals 1078 +kotlin-responseBased-multiple_fragments 1060 +java-operationBased-simple_fragment_with_inline_fragments 1056 +kotlin-responseBased-simple_fragment_with_inline_fragments 1049 +java-operationBased-inline_fragments_with_friends 1041 +kotlin-operationBased-root_query_fragment_with_nested_fragments 1041 +java-operationBased-fragment_spread_with_nested_fields 1040 +kotlin-responseBased-nested_conditional_inline 1033 +java-operationBased-operationbased2_ex8 1030 +kotlin-responseBased-named_fragment_with_variables 1026 +java-operationBased-java_primitive_types 1023 +kotlin-operationBased-simple_fragment 1020 +kotlin-operationBased-named_fragment_delegate 1003 +java-operationBased-decapitalized_fields 981 +java-operationBased-fragments_same_type_condition 962 +java-operationBased-simple_union 961 +kotlin-responseBased-operationbased2_ex8 949 +java-operationBased-deprecated_merged_field 936 +java-operationBased-not_all_combinations_are_needed 926 +java-operationBased-hero_details 924 +java-operationBased-input_object_oneof 918 +java-operationBased-simple_inline_fragment 906 +java-operationBased-fieldset_with_multiple_super 905 +java-operationBased-inline_fragment_with_include_directive 900 +kotlin-operationBased-nested_conditional_inline 899 +java-operationBased-introspection_query 894 +kotlin-operationBased-fragment_used_twice 884 +kotlin-responseBased-mutation_create_review_semantic_naming 880 +kotlin-operationBased-named_fragment_with_variables 877 +kotlin-responseBased-fragment_spread_with_nested_fields 871 +java-operationBased-union_fragment 871 +java-operationBased-test_inline 869 +java-operationBased-inline_fragment_inside_inline_fragment 858 +kotlin-operationBased-multiple_fragments 836 +kotlin-responseBased-nested_field_with_multiple_fieldsets 832 +kotlin-operationBased-fragments_with_type_condition 830 +java-operationBased-named_fragment_without_implementation 826 +kotlin-operationBased-nested_field_with_multiple_fieldsets 802 +kotlin-operationBased-named_fragment_inside_inline_fragment 797 +kotlin-operationBased-inline_fragment_merge_fields 796 +kotlin-responseBased-two_heroes_with_friends 795 +java-operationBased-fragment_with_multiple_fieldsets 794 +java-operationBased-hero_details_semantic_naming 788 +java-operationBased-operationbased2_ex7 786 +kotlin-responseBased-inline_fragments_with_friends 782 +kotlin-responseBased-named_fragment_inside_inline_fragment 778 +kotlin-responseBased-target_name 777 +kotlin-operationBased-root_query_inline_fragment 776 +java-operationBased-suppressed_warnings 774 +kotlin-responseBased-deprecated_merged_field 772 +java-operationBased-path_vs_flat_accessors 766 +kotlin-responseBased-simple_union 755 +kotlin-responseBased-root_query_inline_fragment 752 +kotlin-operationBased-target_name 749 +java-operationBased-reserved_keywords 745 +java-operationBased-typename_always_first 743 +kotlin-responseBased-fragments_same_type_condition 731 +kotlin-operationBased-inline_fragments_with_friends 731 +java-operationBased-interface_on_interface 718 +kotlin-operationBased-simple_fragment_with_inline_fragments 711 +java-operationBased-root_query_fragment 708 +kotlin-operationBased-fragment_spread_with_nested_fields 699 +java-operationBased-input_object_variable_and_argument 699 +java-operationBased-input_object_variable_and_argument_with_generated_methods 699 +java-operationBased-monomorphic 675 +java-operationBased-interface_always_nested 673 +kotlin-operationBased-operationbased2_ex8 673 +kotlin-operationBased-fragments_same_type_condition 660 +java-operationBased-capitalized_fields 654 +kotlin-responseBased-input_object_variable_and_argument_with_generated_methods 652 +java-operationBased-recursive_selection 651 +kotlin-operationBased-simple_union 651 +kotlin-responseBased-union_fragment 650 +kotlin-responseBased-fragment_with_multiple_fieldsets 649 +kotlin-responseBased-test_inline 645 +kotlin-responseBased-named_fragment_without_implementation 644 +java-operationBased-hero_with_review 642 +java-operationBased-deprecation 638 +kotlin-responseBased-hero_details 638 +kotlin-operationBased-decapitalized_fields 635 +kotlin-operationBased-deprecated_merged_field 632 +kotlin-responseBased-inline_fragment_merge_fields 626 +kotlin-operationBased-not_all_combinations_are_needed 625 +java-operationBased-field_with_include_directive 623 +java-operationBased-hero_name_query_long_name 622 +kotlin-operationBased-union_fragment 622 +java-operationBased-custom_scalar_type 620 +kotlin-operationBased-inline_fragment_inside_inline_fragment 619 +java-operationBased-variable_default_value 619 +kotlin-operationBased-inline_fragment_with_include_directive 618 +java-operationBased-hero_name 615 +kotlin-responseBased-inline_fragment_inside_inline_fragment 613 +kotlin-operationBased-simple_inline_fragment 612 +kotlin-operationBased-fieldset_with_multiple_super 610 +kotlin-operationBased-named_fragment_without_implementation 609 +kotlin-responseBased-java_android_annotations 606 +kotlin-responseBased-java_apollo_optionals 606 +kotlin-responseBased-java_guava_optionals 606 +kotlin-responseBased-java_java_optionals 606 +kotlin-responseBased-java_jetbrains_annotations 606 +kotlin-responseBased-java_jsr305_annotations 606 +kotlin-responseBased-simple_inline_fragment 605 +kotlin-responseBased-operationbased2_ex7 604 +kotlin-responseBased-not_all_combinations_are_needed 600 +kotlin-responseBased-decapitalized_fields 598 +kotlin-responseBased-fieldset_with_multiple_super 597 +java-operationBased-optional 596 +java-operationBased-java8annotation 595 +kotlin-responseBased-introspection_query 593 +java-operationBased-enum_field 585 +java-operationBased-inline_fragment_for_non_optional_field 583 +java-operationBased-inline_fragment_type_coercion 577 +kotlin-responseBased-reserved_keywords 576 +java-operationBased-two_heroes_unique 572 +kotlin-responseBased-java_primitive_types 570 +kotlin-operationBased-test_inline 569 +java-operationBased-list_field_clash 564 +kotlin-responseBased-input_object_variable_and_argument 563 +java-operationBased-inline_fragment_simple 562 +kotlin-operationBased-reserved_keywords 549 +kotlin-responseBased-path_vs_flat_accessors 548 +kotlin-responseBased-hero_details_semantic_naming 541 +kotlin-responseBased-root_query_fragment 537 +kotlin-responseBased-typename_always_first 535 +kotlin-operationBased-fragment_with_multiple_fieldsets 533 +kotlin-responseBased-hero_with_review 525 +kotlin-operationBased-typename_always_first 524 +kotlin-responseBased-interface_on_interface 523 +kotlin-operationBased-operationbased2_ex7 523 +java-operationBased-starships 522 +kotlin-responseBased-suppressed_warnings 518 +kotlin-operationBased-path_vs_flat_accessors 517 +kotlin-responseBased-input_object_oneof 513 +java-operationBased-antlr_tokens 510 +java-operationBased-subscriptions 506 +kotlin-responseBased-hero_name 505 +kotlin-operationBased-interface_on_interface 497 +kotlin-responseBased-hero_name_query_long_name 495 +kotlin-responseBased-interface_always_nested 492 +java-operationBased-arguments_hardcoded 489 +kotlin-operationBased-root_query_fragment 486 +kotlin-responseBased-custom_scalar_type 484 +kotlin-responseBased-variable_default_value 469 +java-operationBased-merged_include 467 +java-operationBased-operation_id_generator 467 +kotlin-operationBased-interface_always_nested 464 +kotlin-responseBased-deprecation 461 +kotlin-operationBased-monomorphic 461 +kotlin-responseBased-monomorphic 461 +kotlin-responseBased-inline_fragment_for_non_optional_field 460 +kotlin-responseBased-enum_field 459 +java-operationBased-enums_as_sealed 457 +java-operationBased-case_sensitive_enum 454 +kotlin-responseBased-optional 453 +kotlin-operationBased-hero_name 448 +java-operationBased-nonnull 448 +kotlin-responseBased-field_with_include_directive 446 +kotlin-operationBased-capitalized_fields 442 +java-operationBased-companion 439 +kotlin-responseBased-inline_fragment_type_coercion 438 +java-operationBased-object 434 +kotlin-responseBased-inline_fragment_simple 429 +kotlin-responseBased-recursive_selection 429 +kotlin-operationBased-inline_fragment_for_non_optional_field 417 +kotlin-responseBased-list_field_clash 406 +kotlin-responseBased-capitalized_fields 404 +kotlin-responseBased-two_heroes_unique 404 +kotlin-operationBased-inline_fragment_type_coercion 403 +kotlin-operationBased-inline_fragment_simple 402 +kotlin-responseBased-starships 384 +kotlin-responseBased-java8annotation 383 +kotlin-responseBased-antlr_tokens 381 +kotlin-responseBased-arguments_hardcoded 372 +kotlin-responseBased-subscriptions 371 +kotlin-responseBased-enums_as_sealed 353 +kotlin-responseBased-operation_id_generator 339 +kotlin-responseBased-merged_include 337 +java-operationBased-java_hashcode 335 +kotlin-responseBased-case_sensitive_enum 334 +kotlin-responseBased-big_query 326 +kotlin-responseBased-nonnull 323 +kotlin-operationBased-companion 311 +kotlin-responseBased-object 309 +kotlin-responseBased-java_hashcode 249 kotlin-responseBased-__schema 128 java-operationBased-__schema 103 kotlin-responseBased-empty 91 diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/java/operationBased/merged_include/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/java/operationBased/merged_include/TestQuery.java.expected index 87dd1fc54ed..6c275690ebb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/java/operationBased/merged_include/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/java/operationBased/merged_include/TestQuery.java.expected @@ -118,6 +118,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/TestQuery.kt.expected index 43237be8b11..4bde69cd566 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.merged_include.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/java/operationBased/monomorphic/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/java/operationBased/monomorphic/TestQuery.java.expected index 34d8d62ebb9..ad1c67e1c25 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/java/operationBased/monomorphic/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/java/operationBased/monomorphic/TestQuery.java.expected @@ -121,6 +121,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/TestQuery.kt.expected index b4f5d22ae9c..dc36dd306dd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.monomorphic.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/TestQuery.kt.expected index e4f2644ba14..a6b877eb76f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.monomorphic.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/TestQuery.java.expected index f4ae7936b00..7754ad0134c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/TestQuery.java.expected @@ -133,6 +133,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/AFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/AFragmentImpl.java.expected index f2c422f3ad0..a6e83ee060f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/AFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/AFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class AFragmentImpl implements Fragment { .selections(aFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment1Impl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment1Impl.java.expected index 9dbbb0d48fd..ab5fbf4df68 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment1Impl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment1Impl.java.expected @@ -79,4 +79,9 @@ public class Fragment1Impl implements Fragment { .selections(fragment1Selections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment2Impl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment2Impl.java.expected index a8409646221..8c60ac133e3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment2Impl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/java/operationBased/multiple_fragments/fragment/Fragment2Impl.java.expected @@ -79,4 +79,9 @@ public class Fragment2Impl implements Fragment { .selections(fragment2Selections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/TestQuery.kt.expected index e4ded39396e..bb12a08476c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.multiple_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/AFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/AFragmentImpl.kt.expected index c897fcc7a59..44d2695a64d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/AFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/AFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class AFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment1Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment1Impl.kt.expected index 7f9d40c28c2..f4f806cf742 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment1Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment1Impl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class Fragment1Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment2Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment2Impl.kt.expected index 4aa0d66392b..2d028d479e4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment2Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/fragment/Fragment2Impl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class Fragment2Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/TestQuery.kt.expected index 8a17de86515..a1ec0ba91b9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.Suppress import com.example.multiple_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl.kt.expected index 4fc55bea62e..41265a81237 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class AFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment1Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment1Impl.kt.expected index 7104c573e8e..1b6bd1bb156 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment1Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment1Impl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class Fragment1Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment2Impl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment2Impl.kt.expected index ce07e88a59b..d2e11d56876 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment2Impl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/Fragment2Impl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class Fragment2Impl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/java/operationBased/mutation_create_review/CreateReviewForEpisode.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/java/operationBased/mutation_create_review/CreateReviewForEpisode.java.expected index a10cdccd84c..bf945257a9b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/java/operationBased/mutation_create_review/CreateReviewForEpisode.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/java/operationBased/mutation_create_review/CreateReviewForEpisode.java.expected @@ -161,6 +161,11 @@ public class CreateReviewForEpisode implements Mutation { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/java/operationBased/mutation_create_review_semantic_naming/CreateReviewForEpisodeMutation.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/java/operationBased/mutation_create_review_semantic_naming/CreateReviewForEpisodeMutation.java.expected index 60c589f75f8..1c93a49cde1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/java/operationBased/mutation_create_review_semantic_naming/CreateReviewForEpisodeMutation.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/java/operationBased/mutation_create_review_semantic_naming/CreateReviewForEpisodeMutation.java.expected @@ -133,6 +133,11 @@ public class CreateReviewForEpisodeMutation implements Mutation { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/TestQuery.java.expected index be4e35b7ca2..76a5e2c5c66 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/TestQuery.java.expected @@ -139,6 +139,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.java.expected index ef19cbbdfdc..fc2b97f69f4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class DroidDetailsImpl implements Fragment { .selections(DroidDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.java.expected index 0c77d647034..637d91bfc3b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/java/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HumanDetailsImpl implements Fragment { .selections(HumanDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/TestQuery.kt.expected index 83a462e4627..f716942da8d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.named_fragment_delegate.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected index 5f1da73cd91..02cabc0cc70 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected index b854e6c098d..447b682ff18 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/TestQuery.kt.expected index 0fbbf71fc2d..704c7c4f103 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.collections.List import com.example.named_fragment_delegate.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected index 26377e4af27..5dfed768eb7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.collections.List public class DroidDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected index 37c6e7cb1f0..64952ab4447 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.collections.List public class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/GetHero.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/GetHero.java.expected index 01e19927d1a..4d9c190566f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/GetHero.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/GetHero.java.expected @@ -130,6 +130,11 @@ public class GetHero implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.java.expected index 23c0826093c..89dae25cc1a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.java.expected @@ -79,4 +79,9 @@ public class CharacterAppearsInImpl implements Fragment { .selections(characterAppearsInSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.java.expected index 3af9059856a..db756f4de73 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/java/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.java.expected @@ -79,4 +79,9 @@ public class CharacterNameImpl implements Fragment { .selections(characterNameSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/GetHero.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/GetHero.kt.expected index 6f66cd0b26d..b9e59d45746 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/GetHero.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/GetHero.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.named_fragment_inside_inline_fragment.type.Query as CompiledQuery public class GetHero() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected index 315abd234bf..af21c1ee2cc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CharacterAppearsInImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected index 2381e3af421..5ca006186d3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CharacterNameImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/GetHero.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/GetHero.kt.expected index 969645ea9f8..a562449f662 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/GetHero.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/GetHero.kt.expected @@ -26,6 +26,8 @@ import kotlin.collections.List import com.example.named_fragment_inside_inline_fragment.type.Query as CompiledQuery public class GetHero() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected index 57f263a5200..53879ba3b76 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.Int import kotlin.collections.List public class CharacterAppearsInImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected index 8e8eb81ed18..3c3a50fc2f3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class CharacterNameImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/GetUser.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/GetUser.java.expected index f95d66ff003..204b4135a14 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/GetUser.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/GetUser.java.expected @@ -154,6 +154,11 @@ public class GetUser implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private String organizationId; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.java.expected index 3e86a522e72..0a9e3c2b6bc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.java.expected @@ -102,4 +102,9 @@ public class QueryFragmentImpl implements Fragment { .selections(QueryFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.java.expected index 09476d51993..6df35f2a3fd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/java/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.java.expected @@ -87,4 +87,9 @@ public class UserFragmentImpl implements Fragment { .selections(UserFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/GetUser.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/GetUser.kt.expected index b5ada393088..f9175a2511c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/GetUser.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/GetUser.kt.expected @@ -27,6 +27,8 @@ public data class GetUser( public val query: UserQuery, public val size: Int, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected index cb2b9281533..02024417ca4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected @@ -24,6 +24,8 @@ public data class QueryFragmentImpl( public val query: UserQuery, public val size: Int, ) : Fragment { + override val ignoreErrors: Boolean = false + override fun serializeVariables( writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected index 18e30bb2794..763e00f86e1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.Int public data class UserFragmentImpl( public val size: Int, ) : Fragment { + override val ignoreErrors: Boolean = false + override fun serializeVariables( writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/GetUser.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/GetUser.kt.expected index 4246f39c392..81172446408 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/GetUser.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/GetUser.kt.expected @@ -30,6 +30,8 @@ public data class GetUser( public val query: UserQuery, public val size: Int, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected index 563492985e0..411e01955ce 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl.kt.expected @@ -26,6 +26,8 @@ public data class QueryFragmentImpl( public val query: UserQuery, public val size: Int, ) : Fragment { + override val ignoreErrors: Boolean = false + override fun serializeVariables( writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected index 4273d9d7d8e..fc0e2a6ada6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl.kt.expected @@ -21,6 +21,8 @@ import kotlin.String public data class UserFragmentImpl( public val size: Int, ) : Fragment { + override val ignoreErrors: Boolean = false + override fun serializeVariables( writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/java/operationBased/named_fragment_without_implementation/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/java/operationBased/named_fragment_without_implementation/TestQuery.java.expected index 7497a02b54a..0b8e72a9226 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/java/operationBased/named_fragment_without_implementation/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/java/operationBased/named_fragment_without_implementation/TestQuery.java.expected @@ -128,6 +128,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/TestQuery.kt.expected index 7134b246707..135ded6978c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.named_fragment_without_implementation.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/TestQuery.kt.expected index 9e17c2fad90..d28137edccb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.Suppress import com.example.named_fragment_without_implementation.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/java/operationBased/nested_conditional_inline/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/java/operationBased/nested_conditional_inline/TestQuery.java.expected index b433bd30562..f2cb98871f6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/java/operationBased/nested_conditional_inline/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/java/operationBased/nested_conditional_inline/TestQuery.java.expected @@ -145,6 +145,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional episode = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/TestQuery.kt.expected index 37c86b805d3..2f57ed35409 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/TestQuery.kt.expected @@ -26,6 +26,8 @@ import com.example.nested_conditional_inline.type.Query as CompiledQuery public data class TestQuery( public val episode: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/TestQuery.kt.expected index 0a779c56e6b..d2749340f7c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/TestQuery.kt.expected @@ -27,6 +27,8 @@ import com.example.nested_conditional_inline.type.Query as CompiledQuery public data class TestQuery( public val episode: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/java/operationBased/nested_field_with_multiple_fieldsets/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/java/operationBased/nested_field_with_multiple_fieldsets/TestQuery.java.expected index 4dc71f7aa52..a580650bf2b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/java/operationBased/nested_field_with_multiple_fieldsets/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/java/operationBased/nested_field_with_multiple_fieldsets/TestQuery.java.expected @@ -137,6 +137,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/operationBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/operationBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected index db18ea3bced..2d3f34d3253 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/operationBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/operationBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.nested_field_with_multiple_fieldsets.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected index 1a286ff4d6c..e344bd3e24d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.nested_field_with_multiple_fieldsets.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/AllStarships.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/AllStarships.java.expected index 535c6977dc7..57e6ceac429 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/AllStarships.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/AllStarships.java.expected @@ -148,6 +148,11 @@ public class AllStarships implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.java.expected index b16f8d0eed4..7ffd96444c5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class PilotFragmentImpl implements Fragment { .selections(pilotFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.java.expected index 892a3301f45..442849b87cf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class PlanetFragmentImpl implements Fragment { .selections(planetFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.java.expected index 96f493fba0d..80dcd640e8d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/java/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class StarshipFragmentImpl implements Fragment { .selections(starshipFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/AllStarships.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/AllStarships.kt.expected index 6cdef690eae..d6b562bfa56 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/AllStarships.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/AllStarships.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.nested_named_fragments.type.Root as CompiledRoot public class AllStarships() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected index 5dd0d423c5b..898ff0d94c2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class PilotFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected index 0030bfbd2bb..0f1c5a35dc5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class PlanetFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected index 7238b556d1d..4622db0831c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class StarshipFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/AllStarships.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/AllStarships.kt.expected index ac03dba3368..19b1418bba2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/AllStarships.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/AllStarships.kt.expected @@ -26,6 +26,8 @@ import kotlin.collections.List import com.example.nested_named_fragments.type.Root as CompiledRoot public class AllStarships() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected index 71f62a3c8d6..0382b494288 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class PilotFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected index 9a0c90ffbfa..a3b6398e987 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PlanetFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class PlanetFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected index 74761f29cf7..f766d0e9102 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl.kt.expected @@ -21,6 +21,8 @@ import kotlin.Suppress import kotlin.collections.List public class StarshipFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/java/operationBased/nonnull/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/java/operationBased/nonnull/TestQuery.java.expected index e8dc3e09721..8dc05535e44 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/java/operationBased/nonnull/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/java/operationBased/nonnull/TestQuery.java.expected @@ -115,6 +115,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/TestQuery.kt.expected index 27dcbcd5653..18694c555c4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.nonnull.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/TestQuery.java.expected index 7843f140bfc..da5141c2d3c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/TestQuery.java.expected @@ -128,6 +128,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.java.expected index 9f0ec05aa0e..474ddd1223c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/java/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class BFragmentImpl implements Fragment { .selections(bFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/TestQuery.kt.expected index 92b106e9659..a331bf09ab2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.not_all_combinations_are_needed.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected index 2ab2b297752..63cfc0c3dcd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class BFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/TestQuery.kt.expected index a83efecce8f..26d9c63a240 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.not_all_combinations_are_needed.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected index 609feccba29..7b1b8d4fc11 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/fragment/BFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class BFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/object/java/operationBased/object/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/object/java/operationBased/object/TestQuery.java.expected index 5b127f65a17..fb89909130f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/object/java/operationBased/object/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/object/java/operationBased/object/TestQuery.java.expected @@ -115,6 +115,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/object/kotlin/responseBased/object/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/object/kotlin/responseBased/object/TestQuery.kt.expected index 0933901c169..18b0a6dc2c3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/object/kotlin/responseBased/object/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/object/kotlin/responseBased/object/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.`object`.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/java/operationBased/operation_id_generator/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/java/operationBased/operation_id_generator/TestQuery.java.expected index 135c08e62d9..2897cb87588 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/java/operationBased/operation_id_generator/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/java/operationBased/operation_id_generator/TestQuery.java.expected @@ -116,6 +116,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/TestQuery.kt.expected index 8fe4bc50828..beddbf3cbf4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.operation_id_generator.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/java/operationBased/operationbased2_ex7/TestOperation.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/java/operationBased/operationbased2_ex7/TestOperation.java.expected index 297e307ed9f..1684db5fb65 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/java/operationBased/operationbased2_ex7/TestOperation.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/java/operationBased/operationbased2_ex7/TestOperation.java.expected @@ -126,6 +126,11 @@ public class TestOperation implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/TestOperation.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/TestOperation.kt.expected index b6891ae5e30..eadeb6be72f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/TestOperation.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/TestOperation.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.operationbased2_ex7.type.Query as CompiledQuery public class TestOperation() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/TestOperation.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/TestOperation.kt.expected index be66f278ad4..66ad3ff89a5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/TestOperation.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/TestOperation.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.operationbased2_ex7.type.Query as CompiledQuery public class TestOperation() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/TestOperation.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/TestOperation.java.expected index 69f5251b292..2eefdbbd9d4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/TestOperation.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/TestOperation.java.expected @@ -131,6 +131,11 @@ public class TestOperation implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.java.expected index 044a7a732e4..0fc29894edb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/java/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class AnimalFragmentImpl implements Fragment { .selections(AnimalFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/TestOperation.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/TestOperation.kt.expected index c275aec3b05..8f6536a1883 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/TestOperation.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/TestOperation.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.operationbased2_ex8.type.Query as CompiledQuery public class TestOperation() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected index 51e7d146e3e..a91da5fe9d4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class AnimalFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/TestOperation.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/TestOperation.kt.expected index f08ad465192..f89b08016a4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/TestOperation.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/TestOperation.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.operationbased2_ex8.type.Query as CompiledQuery public class TestOperation() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected index 01237b3b2bb..a6697a3eaf5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class AnimalFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/optional/java/operationBased/optional/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/optional/java/operationBased/optional/TestQuery.java.expected index ea2c2773cf4..521e0620e19 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/optional/java/operationBased/optional/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/optional/java/operationBased/optional/TestQuery.java.expected @@ -118,6 +118,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/TestQuery.kt.expected index fd664e30faa..f4415ffa45f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.optional.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/java/operationBased/path_vs_flat_accessors/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/java/operationBased/path_vs_flat_accessors/TestQuery.java.expected index 2f7d1e1802c..1e3d91eb509 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/java/operationBased/path_vs_flat_accessors/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/java/operationBased/path_vs_flat_accessors/TestQuery.java.expected @@ -124,6 +124,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/operationBased/path_vs_flat_accessors/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/operationBased/path_vs_flat_accessors/TestQuery.kt.expected index 28ac8a8187b..bdd07ff0a94 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/operationBased/path_vs_flat_accessors/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/operationBased/path_vs_flat_accessors/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.path_vs_flat_accessors.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/TestQuery.kt.expected index 0e9611a7cde..5e3e35a455c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import com.example.path_vs_flat_accessors.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/java/operationBased/recursive_selection/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/java/operationBased/recursive_selection/TestQuery.java.expected index e7fae74db51..99d1682dc0f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/java/operationBased/recursive_selection/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/java/operationBased/recursive_selection/TestQuery.java.expected @@ -122,6 +122,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/TestQuery.kt.expected index 2e2f7fb3a1f..08363b081d5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.recursive_selection.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/java/operationBased/reserved_keywords/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/java/operationBased/reserved_keywords/TestQuery.java.expected index 75f238c1244..a1281795c91 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/java/operationBased/reserved_keywords/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/java/operationBased/reserved_keywords/TestQuery.java.expected @@ -122,6 +122,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/TestQuery.kt.expected index 04c27b99d80..ad944675ca4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.reserved_keywords.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/TestQuery.kt.expected index b8b5037791d..9d4ba1e870d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.reserved_keywords.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/TestQuery.java.expected index 7cadda244ca..fa6e4dcfd37 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/TestQuery.java.expected @@ -122,6 +122,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/fragment/QueryFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/fragment/QueryFragmentImpl.java.expected index 78ea577e5a9..197a45fd908 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/fragment/QueryFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/java/operationBased/root_query_fragment/fragment/QueryFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class QueryFragmentImpl implements Fragment { .selections(QueryFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/TestQuery.kt.expected index e9f97752557..ad4a89a983c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.root_query_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected index 5db892c8f35..33b31e64c64 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class QueryFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/TestQuery.kt.expected index 09775a633c6..4e3e5ce35fe 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.root_query_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected index 1a0c17aa6f4..8b3994f5033 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class QueryFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/TestQuery.java.expected index d059b167612..0fa90169233 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/TestQuery.java.expected @@ -143,6 +143,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.java.expected index 30fa86b073c..f3a8d9e0a38 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class DroidFragmentImpl implements Fragment { .selections(droidFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.java.expected index 7f24883657f..3217efe81df 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class HeroFragmentImpl implements Fragment { .selections(heroFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.java.expected index 4645e845b17..777fb902759 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/java/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class QueryFragmentImpl implements Fragment { .selections(QueryFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected index 9cb000f4693..a744d896f09 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.root_query_fragment_with_nested_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected index 9da890770ac..9fad8bcbe67 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DroidFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected index d3f62bc2790..caaf6cd0ed2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected index f8938eeadcf..062223a15c4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class QueryFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected index 4b9278130ed..7b1bb97e35d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.Suppress import com.example.root_query_fragment_with_nested_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected index aec7fd5935e..1a7152cd5ad 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/DroidFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class DroidFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected index 1e78a6004b6..98191bfb28c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/HeroFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class HeroFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected index ed6d57bf237..13ed85d1a80 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/fragment/QueryFragmentImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.Suppress public class QueryFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/java/operationBased/root_query_inline_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/java/operationBased/root_query_inline_fragment/TestQuery.java.expected index 966124ddbe6..d8ebaef7c15 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/java/operationBased/root_query_inline_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/java/operationBased/root_query_inline_fragment/TestQuery.java.expected @@ -134,6 +134,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/TestQuery.kt.expected index 2dd2ef54de0..8f4b38be765 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.root_query_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/TestQuery.kt.expected index 6f61b208265..9e4bc5340b3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.collections.List import com.example.root_query_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/TestQuery.java.expected index 713cc2e9780..9bdb1c1ebfc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/TestQuery.java.expected @@ -153,6 +153,11 @@ public class TestQuery implements Query { return buildData(map, new DefaultFakeResolver(__Schema.types)); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HeroDetailsImpl.java.expected index 00cd8a74a00..f9aa9d59867 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HeroDetailsImpl.java.expected @@ -83,4 +83,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HumanDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HumanDetailsImpl.java.expected index eb2fd730381..4883932d253 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HumanDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/java/operationBased/simple_fragment/fragment/HumanDetailsImpl.java.expected @@ -82,4 +82,9 @@ public class HumanDetailsImpl implements Fragment { .selections(HumanDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/TestQuery.kt.expected index 7d755d61906..a93b43c121d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/TestQuery.kt.expected @@ -34,6 +34,8 @@ import com.example.simple_fragment.type.Query as CompiledQuery * for both query and fragments */ internal class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected index b5645ad3bcf..d2debb42a42 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected @@ -31,6 +31,8 @@ import kotlin.Unit * with multi lines support */ internal class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected index ba64f5e96e0..d55f5260336 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected @@ -28,6 +28,8 @@ import kotlin.Unit * Fragment with Java / Kotlin docs generation */ internal class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/TestQuery.kt.expected index 389736e7964..e681c4a5c5b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/TestQuery.kt.expected @@ -36,6 +36,8 @@ import com.example.simple_fragment.type.Query as CompiledQuery * for both query and fragments */ internal class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected index 2fdb9fd5f98..0e56312583b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl.kt.expected @@ -33,6 +33,8 @@ import kotlin.Unit * with multi lines support */ internal class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected index 53ece038bf7..910bd011861 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl.kt.expected @@ -29,6 +29,8 @@ import kotlin.Unit * Fragment with Java / Kotlin docs generation */ internal class HumanDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/TestQuery.java.expected index 12972d71f1c..43a51b28972 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/TestQuery.java.expected @@ -131,6 +131,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.java.expected index 8c1484247cd..849e0ffb6d3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/java/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected index fcbea772b43..2d650047f24 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.simple_fragment_with_inline_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected index 0d390ba117e..2c5111268f5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected index f6ea35482a3..e32c97e9d3d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/TestQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.collections.List import com.example.simple_fragment_with_inline_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected index f8067b0b377..4130d233c95 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl.kt.expected @@ -22,6 +22,8 @@ import kotlin.Suppress import kotlin.collections.List public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/java/operationBased/simple_inline_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/java/operationBased/simple_inline_fragment/TestQuery.java.expected index 61c03366379..fe57bcbf16f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/java/operationBased/simple_inline_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/java/operationBased/simple_inline_fragment/TestQuery.java.expected @@ -129,6 +129,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/TestQuery.kt.expected index 3a47fa1f3a8..a1da3f14233 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.simple_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/TestQuery.kt.expected index fe874d703e8..e78cf814fc7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.simple_inline_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/AnimalQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/AnimalQuery.java.expected index a232797f18c..c643397f8ab 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/AnimalQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/AnimalQuery.java.expected @@ -127,6 +127,11 @@ public class AnimalQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/CatFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/CatFragmentImpl.java.expected index 1f9b142df38..cc72a2b6ab8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/CatFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/CatFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class CatFragmentImpl implements Fragment { .selections(CatFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/DogFragmentImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/DogFragmentImpl.java.expected index c068a7632a8..76378a4a5cf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/DogFragmentImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/java/operationBased/simple_union/fragment/DogFragmentImpl.java.expected @@ -79,4 +79,9 @@ public class DogFragmentImpl implements Fragment { .selections(DogFragmentSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/AnimalQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/AnimalQuery.kt.expected index ef51a55077a..d87782165d5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/AnimalQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/AnimalQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.String import com.example.simple_union.type.Query as CompiledQuery public class AnimalQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl.kt.expected index 93e12455cf0..ab16b2cba00 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class CatFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl.kt.expected index 08a29ec470c..0ef2421abd1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class DogFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/AnimalQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/AnimalQuery.kt.expected index 1f30e357d72..b21bff966a6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/AnimalQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/AnimalQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.Suppress import com.example.simple_union.type.Query as CompiledQuery public class AnimalQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl.kt.expected index a9269a3b30b..cb5d58d07d1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class CatFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl.kt.expected index 74c772bdf84..7d1b8c9273f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl.kt.expected @@ -19,6 +19,8 @@ import kotlin.Int import kotlin.String public class DogFragmentImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/starships/java/operationBased/starships/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/starships/java/operationBased/starships/TestQuery.java.expected index 27882da1a21..1a38382d812 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/starships/java/operationBased/starships/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/starships/java/operationBased/starships/TestQuery.java.expected @@ -126,6 +126,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private String id; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/TestQuery.kt.expected index c8cbccc3054..f284e10402f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/TestQuery.kt.expected @@ -24,6 +24,8 @@ import com.example.starships.type.Query as CompiledQuery public data class TestQuery( public val id: String, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/java/operationBased/subscriptions/TestSubscription.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/java/operationBased/subscriptions/TestSubscription.java.expected index 977e79da322..e33b7cda565 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/java/operationBased/subscriptions/TestSubscription.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/java/operationBased/subscriptions/TestSubscription.java.expected @@ -124,6 +124,11 @@ public class TestSubscription implements Subscription { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private String repo; diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/TestSubscription.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/TestSubscription.kt.expected index a5bcf6f92ba..41e69093ee4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/TestSubscription.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/TestSubscription.kt.expected @@ -23,6 +23,8 @@ import com.example.subscriptions.type.Subscription as CompiledSubscription public data class TestSubscription( public val repo: String, ) : Subscription { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/java/operationBased/suppressed_warnings/CatQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/java/operationBased/suppressed_warnings/CatQuery.java.expected index 5e79490327a..c2cdef72b88 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/java/operationBased/suppressed_warnings/CatQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/java/operationBased/suppressed_warnings/CatQuery.java.expected @@ -127,6 +127,11 @@ public class CatQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional filter = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/CatQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/CatQuery.kt.expected index 8f40c3b5427..0735570dd2d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/CatQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/CatQuery.kt.expected @@ -26,6 +26,8 @@ import com.example.suppressed_warnings.type.Query as CompiledQuery public data class CatQuery( public val filter: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/java/operationBased/target_name/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/java/operationBased/target_name/TestQuery.java.expected index 293fe1ebb30..8d29b005e45 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/java/operationBased/target_name/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/java/operationBased/target_name/TestQuery.java.expected @@ -150,6 +150,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional input = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/operationBased/target_name/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/operationBased/target_name/TestQuery.kt.expected index 60b6ca7d18c..895db3e513c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/operationBased/target_name/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/operationBased/target_name/TestQuery.kt.expected @@ -28,6 +28,8 @@ public data class TestQuery( public val scalar: Optional = Optional.Absent, public val `enum`: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/TestQuery.kt.expected index 34eb26f1233..385de5b155b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/TestQuery.kt.expected @@ -29,6 +29,8 @@ public data class TestQuery( public val scalar: Optional = Optional.Absent, public val `enum`: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/java/operationBased/test_inline/GetPage.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/java/operationBased/test_inline/GetPage.java.expected index d4179b8b25c..1be56719916 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/java/operationBased/test_inline/GetPage.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/java/operationBased/test_inline/GetPage.java.expected @@ -127,6 +127,11 @@ public class GetPage implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/GetPage.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/GetPage.kt.expected index 2338383bc9f..bd961e24f2c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/GetPage.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/GetPage.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.test_inline.type.Query as CompiledQuery public class GetPage() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/GetPage.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/GetPage.kt.expected index c5ab75dc963..c968a00d8b3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/GetPage.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/GetPage.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.test_inline.type.Query as CompiledQuery public class GetPage() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/java/operationBased/two_heroes_unique/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/java/operationBased/two_heroes_unique/TestQuery.java.expected index dba648f5ecf..8965187339f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/java/operationBased/two_heroes_unique/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/java/operationBased/two_heroes_unique/TestQuery.java.expected @@ -119,6 +119,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/TestQuery.kt.expected index b32c9e39ac0..29fbd77d741 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/TestQuery.kt.expected @@ -21,6 +21,8 @@ import kotlin.String import com.example.two_heroes_unique.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/java/operationBased/two_heroes_with_friends/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/java/operationBased/two_heroes_with_friends/TestQuery.java.expected index a10097df269..d15184c3bba 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/java/operationBased/two_heroes_with_friends/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/java/operationBased/two_heroes_with_friends/TestQuery.java.expected @@ -137,6 +137,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/TestQuery.kt.expected index 5d044c5a8ed..0ee13bd1bae 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.collections.List import com.example.two_heroes_with_friends.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/java/operationBased/typename_always_first/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/java/operationBased/typename_always_first/TestQuery.java.expected index cae9dd694af..0fa7ee64e04 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/java/operationBased/typename_always_first/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/java/operationBased/typename_always_first/TestQuery.java.expected @@ -126,6 +126,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/TestQuery.kt.expected index b45b2519083..88587fc48b9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/TestQuery.kt.expected @@ -22,6 +22,8 @@ import kotlin.String import com.example.typename_always_first.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/TestQuery.kt.expected index cadb16af56d..029bd0704c4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.Suppress import com.example.typename_always_first.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/TestQuery.java.expected index e364d52dc16..9b17f72c339 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/TestQuery.java.expected @@ -125,6 +125,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/fragment/StarshipImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/fragment/StarshipImpl.java.expected index a9caff658a8..5facb170b84 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/fragment/StarshipImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/java/operationBased/union_fragment/fragment/StarshipImpl.java.expected @@ -78,4 +78,9 @@ public class StarshipImpl implements Fragment { .selections(StarshipSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/TestQuery.kt.expected index 29b30a97c2c..74c246bbf85 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.union_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl.kt.expected index 76bc13138b9..04ad6bb4c39 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl.kt.expected @@ -17,6 +17,8 @@ import kotlin.Boolean import kotlin.Int public class StarshipImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/TestQuery.kt.expected index ab63c7adf7d..c1d9131512b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.union_fragment.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl.kt.expected index 340143b19f2..079186ed9e1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Int import kotlin.String public class StarshipImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/java/operationBased/union_inline_fragments/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/java/operationBased/union_inline_fragments/TestQuery.java.expected index c5be5f82ac7..5ad27df864e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/java/operationBased/union_inline_fragments/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/java/operationBased/union_inline_fragments/TestQuery.java.expected @@ -145,6 +145,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/TestQuery.kt.expected index e261c65714f..b6b666c92a5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/TestQuery.kt.expected @@ -23,6 +23,8 @@ import kotlin.collections.List import com.example.union_inline_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/TestQuery.kt.expected index 1a9d14aa418..ae51cd5ca4f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/TestQuery.kt.expected @@ -24,6 +24,8 @@ import kotlin.collections.List import com.example.union_inline_fragments.type.Query as CompiledQuery public class TestQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/HeroDetailQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/HeroDetailQuery.java.expected index af5a75ee75b..9326f23a3fc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/HeroDetailQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/HeroDetailQuery.java.expected @@ -145,6 +145,11 @@ public class HeroDetailQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { Builder() { } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/fragment/HeroDetailsImpl.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/fragment/HeroDetailsImpl.java.expected index aaa187103ea..18182180663 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/fragment/HeroDetailsImpl.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/java/operationBased/unique_type_name/fragment/HeroDetailsImpl.java.expected @@ -79,4 +79,9 @@ public class HeroDetailsImpl implements Fragment { .selections(HeroDetailsSelections.__root) .build(); } + + @Override + public boolean getIgnoreErrors() { + return false; + } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/HeroDetailQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/HeroDetailQuery.kt.expected index 265286121ba..cee9481b067 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/HeroDetailQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/HeroDetailQuery.kt.expected @@ -25,6 +25,8 @@ import kotlin.collections.List import com.example.unique_type_name.type.Query as CompiledQuery public class HeroDetailQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected index c22e36defb5..b9ef0af5229 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected @@ -18,6 +18,8 @@ import kotlin.Boolean import kotlin.Int public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/HeroDetailQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/HeroDetailQuery.kt.expected index 9eb93dad4ec..53df24336a8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/HeroDetailQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/HeroDetailQuery.kt.expected @@ -26,6 +26,8 @@ import kotlin.collections.List import com.example.unique_type_name.type.Query as CompiledQuery public class HeroDetailQuery() : Query { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected index 6a98a22cec4..5eb8bee38b0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl.kt.expected @@ -20,6 +20,8 @@ import kotlin.String import kotlin.collections.List public class HeroDetailsImpl() : Fragment { + override val ignoreErrors: Boolean = false + override fun equals(other: Any?): Boolean = other != null && other::class == this::class override fun hashCode(): Int = this::class.hashCode() diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/java/operationBased/variable_default_value/TestQuery.java.expected b/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/java/operationBased/variable_default_value/TestQuery.java.expected index 1a40455f2e6..1706ff21d4c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/java/operationBased/variable_default_value/TestQuery.java.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/java/operationBased/variable_default_value/TestQuery.java.expected @@ -124,6 +124,11 @@ public class TestQuery implements Query { .build(); } + @Override + public boolean getIgnoreErrors() { + return false; + } + public static final class Builder { private Optional episode = Optional.absent(); diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/TestQuery.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/TestQuery.kt.expected index 00591eb83f7..3b52dd4ac91 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/TestQuery.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/TestQuery.kt.expected @@ -25,6 +25,8 @@ import com.example.variable_default_value.type.Query as CompiledQuery public data class TestQuery @JvmOverloads constructor( public val episode: Optional = Optional.Absent, ) : Query { + override val ignoreErrors: Boolean = false + override fun id(): String = OPERATION_ID override fun document(): String = OPERATION_DOCUMENT From 4ea61316eba3c3ad9d45a26951c7138dde0a89f2 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Mon, 27 Nov 2023 22:48:10 +0100 Subject: [PATCH 13/42] fix test --- .../browser-tests/src/commonTest/kotlin/test/HeadersTest.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/browser-tests/src/commonTest/kotlin/test/HeadersTest.kt b/tests/browser-tests/src/commonTest/kotlin/test/HeadersTest.kt index e97599665bf..2f7be72e25e 100644 --- a/tests/browser-tests/src/commonTest/kotlin/test/HeadersTest.kt +++ b/tests/browser-tests/src/commonTest/kotlin/test/HeadersTest.kt @@ -1,8 +1,8 @@ package test import com.apollographql.apollo3.ApolloClient -import com.apollographql.apollo3.api.CompiledField import com.apollographql.apollo3.api.Adapter +import com.apollographql.apollo3.api.CompiledField import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.Subscription import com.apollographql.apollo3.api.json.JsonWriter @@ -57,4 +57,7 @@ class NothingSubscription : Subscription { override fun rootField(): CompiledField { TODO("Not yet implemented") } + + override val ignoreErrors: Boolean + get() = false } From f265e27d377b577c84e7e2982a5b49aabf46ac3b Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Tue, 28 Nov 2023 00:09:37 +0100 Subject: [PATCH 14/42] fix nullable + catchToNull --- .../compiler/codegen/kotlin/KotlinResolver.kt | 11 +--- .../codegen/kotlin/adapter/AdapterCommon.kt | 3 +- .../compiler/ir/IrOperationsBuilder.kt | 5 -- .../catch/src/main/graphql/operations.graphql | 21 +++++++- tests/catch/src/test/kotlin/test/CatchTest.kt | 50 ++++++++++++++++++- 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt index 78f28a02200..2290c043339 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt @@ -79,17 +79,8 @@ internal class KotlinResolver( classNames.put(ResolverKey(kind, id), ClassName(memberName.packageName, memberName.simpleName)) } - /** - * Because CatchToNull implies nullable, [removeCatchTo] will make the unwrapped type non-nullable - */ private fun IrType.removeCatchTo(): IrType { - return catchTo(IrCatchTo.NoCatch).let { - if (catchTo == IrCatchTo.Null) { - it.nullable(false) - } else { - it - } - } + return catchTo(IrCatchTo.NoCatch) } internal fun resolveIrType(type: IrType, jsExport: Boolean, isInterface: Boolean = false): TypeName { diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/adapter/AdapterCommon.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/adapter/AdapterCommon.kt index 2c6adaaff2e..f422db71759 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/adapter/AdapterCommon.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/adapter/AdapterCommon.kt @@ -17,6 +17,7 @@ import com.apollographql.apollo3.compiler.codegen.kotlin.KotlinSymbols import com.apollographql.apollo3.compiler.codegen.kotlin.helpers.codeBlock import com.apollographql.apollo3.compiler.ir.BLabel import com.apollographql.apollo3.compiler.ir.BooleanExpression +import com.apollographql.apollo3.compiler.ir.IrCatchTo import com.apollographql.apollo3.compiler.ir.IrModel import com.apollographql.apollo3.compiler.ir.IrModelType import com.apollographql.apollo3.compiler.ir.IrProperty @@ -158,7 +159,7 @@ internal fun readFromResponseCodeBlock( .indent() .add(model.properties.map { property -> val maybeAssertNotNull = if ( - !property.info.type.nullable + (property.info.type.catchTo == IrCatchTo.Result || !property.info.type.nullable) && !property.info.type.optional && !checkedProperties.contains(property.info.responseName) ) { diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index dea57838f88..5d375bc852b 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -699,11 +699,6 @@ internal class IrOperationsBuilder( if (catchLevel != null) { type = type.catchTo(catchLevel.to.toIr()) if (catchLevel.to == CatchTo.NULL) { - /** - * Mark the field as nullable which duplicates some information with CatchTo but is needed for - * other code paths to generate correct code and not consider this a required field - * See also `IrType.removeCatchTo` - */ type = type.nullable(true) } } diff --git a/tests/catch/src/main/graphql/operations.graphql b/tests/catch/src/main/graphql/operations.graphql index eddf0c9efb9..6de2c4ab9e7 100644 --- a/tests/catch/src/main/graphql/operations.graphql +++ b/tests/catch/src/main/graphql/operations.graphql @@ -8,7 +8,7 @@ query UserResult { user @catch(to: RESULT) { name } -}# +} query UserNull { user @catch(to: NULL) { @@ -21,9 +21,28 @@ query Product { price } } + +query ProductResult { + product @catch(to: RESULT) { + price + } +} + +query ProductNull { + product @catch(to: NULL) { + price + } +} + query ProductIgnoreErrors @ignoreErrors { product { price } } +query PriceNull { + product { + price @catch(to: NULL) + } +} + diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index dee62e68926..0426fb22848 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -9,8 +9,11 @@ import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse import com.apollographql.apollo3.api.valueOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException +import com.example.PriceNullQuery import com.example.ProductIgnoreErrorsQuery +import com.example.ProductNullQuery import com.example.ProductQuery +import com.example.ProductResultQuery import com.example.UserNullQuery import com.example.UserQuery import com.example.UserResultQuery @@ -37,6 +40,7 @@ class CatchTest { assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) } + @Test fun userNullOnUserNameError() { val response = UserNullQuery().parseResponse(userNameError) @@ -74,6 +78,21 @@ class CatchTest { assertEquals("cannot resolve price", exception.error.message) } + @Test + fun productResultOnProductPriceError() { + val response = ProductResultQuery().parseResponse(productPriceError) + + assertEquals("cannot resolve price", response.data?.product?.errorOrNull?.message) + } + + @Test + fun productNullOnProductPriceError() { + val response = ProductNullQuery().parseResponse(productPriceError) + + assertNull(response.data?.product) + assertNotNull(response.data) + } + @Test fun productIgnoreErrorsOnProductPriceError() { val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) @@ -82,11 +101,29 @@ class CatchTest { assertNull(response.data?.product?.price) assertEquals("cannot resolve price", response.errors?.single()?.message) } + + @Test + fun productPriceNullOnProductPriceError() { + val response = PriceNullQuery().parseResponse(productPriceError) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.price) + assertEquals("cannot resolve price", response.errors?.single()?.message) + } + + @Test + fun productPriceNullOnProductPriceNull() { + val response = PriceNullQuery().parseResponse(productPriceNull) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.price) + assertNull(response.errors) + } } private fun String.jsonReader(): JsonReader = Buffer().writeUtf8(this).jsonReader() -fun Query.parseResponse(json: String): ApolloResponse = parseResponse(json.jsonReader(), null, CustomScalarAdapters.Empty, null) +fun Query.parseResponse(json: String): ApolloResponse = parseResponse(json.jsonReader(), null, CustomScalarAdapters.Empty, null) @Language("json") val userNameError = """ @@ -131,4 +168,15 @@ val productPriceError = """ } } } + """.trimIndent() + +@Language("json") +val productPriceNull = """ + { + "data": { + "product": { + "price": null + } + } + } """.trimIndent() \ No newline at end of file From 540317a3adac06ae5fe968084f0d42d3aa9b87b6 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 29 Nov 2023 11:23:22 +0100 Subject: [PATCH 15/42] nullOnlyOnError -> semanticNonNull --- .../kotlin/com/apollographql/apollo3/ast/Schema.kt | 2 +- .../com/apollographql/apollo3/ast/gqldirective.kt | 4 ++-- .../apollo3/ast/internal/definitions.kt | 8 ++++---- .../apollo3/compiler/ir/IrOperationsBuilder.kt | 12 ++++++------ tests/catch/src/main/graphql/schema.graphqls | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt index bef48a92ef3..548cfbba299 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt @@ -205,7 +205,7 @@ class Schema internal constructor( const val OPTIONAL = "optional" const val REQUIRES_OPT_IN = "requiresOptIn" const val CATCH = "catch" - const val NULL_ONLY_ON_ERROR = "nullOnlyOnError" + const val SEMANTIC_NON_NULL = "semanticNonNull" const val IGNORE_ERRORS = "ignoreErrors" const val FIELD_POLICY_FOR_FIELD = "forField" diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index e183623dfe8..7811a52cba0 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -146,7 +146,7 @@ fun List.findCatches(schema: Schema): List { @ApolloInternal fun GQLFieldDefinition.findNooeLevels(schema: Schema): List { return directives.filter { - schema.originalDirectiveName(it.name) == Schema.NULL_ONLY_ON_ERROR + schema.originalDirectiveName(it.name) == Schema.SEMANTIC_NON_NULL }.map { it.getArgument("level", schema)?.toIntOrNull() } @@ -155,7 +155,7 @@ fun GQLFieldDefinition.findNooeLevels(schema: Schema): List { @ApolloInternal fun GQLTypeDefinition.findNooeLevels(fieldName: String, schema: Schema): List { return directives.filter { - schema.originalDirectiveName(it.name) == Schema.NULL_ONLY_ON_ERROR + schema.originalDirectiveName(it.name) == Schema.SEMANTIC_NON_NULL && it.getArgument("field", schema)?.toStringOrNull() == fieldName }.map { it.getArgument("level", schema)?.toIntOrNull() diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 46dea3555bc..e04ec797d3a 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -267,7 +267,7 @@ This directive can be applied on field definitions: ```graphql type User { - email: String @nullOnlyOnError + email: String @semanticNonNull } ``` @@ -275,7 +275,7 @@ It can also be applied on object type extensions for use in client applications not own the base schema: ```graphql -extend type User @nullOnlyOnError(field: "email") +extend type User @semanticNonNull(field: "email") ``` Control over list items is done using the `level` argument: @@ -283,7 +283,7 @@ Control over list items is done using the `level` argument: ```graphql type User { # friends is nullable but friends[0] is null only on errors - friends: [User] @nullOnlyOnError(level: 1) + friends: [User] @semanticNonNull(level: 1) } ``` @@ -294,7 +294,7 @@ to a field definition starting at 0 if there is no list. If level is null, the modifier is applied to all levels ""${'"'} -directive @nullOnlyOnError(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT +directive @semanticNonNull(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT ""${'"'} Indicates that a field acts as an error boundary in case of a GraphQL error. diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 5d375bc852b..9c514b5a3de 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -510,7 +510,7 @@ internal class IrOperationsBuilder( parentTypeDefinition.findNooeLevels(gqlField.name, schema).let { if (it.isNotEmpty()) { check(nooeLevels.isEmpty()) { - "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @nullOnlyOnError) in the schema." + "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @semanticNonNull) in the schema." } nooeLevels = it } @@ -518,14 +518,14 @@ internal class IrOperationsBuilder( if (parentTypeDefinition.isFieldNonNull(gqlField.name, schema)) { check(nooeLevels.isEmpty()) { - "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @nullOnlyOnError) in the schema." + "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @semanticNonNull) in the schema." } nooeLevels = listOf(0) } if (gqlField.directives.findNonnull(schema)) { check(nooeLevels.isEmpty()) { - "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @nullOnlyOnError) in the schema." + "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @semanticNonNull) in the schema." } nooeLevels = listOf(0) } @@ -674,12 +674,12 @@ internal class IrOperationsBuilder( } companion object { - private fun IrType.nooe(nullOnlyOnErrorLevels: List, level: Int): IrType { - val isNonNull = nullOnlyOnErrorLevels.any { it == null || it == level } + private fun IrType.nooe(semanticNonNullLevels: List, level: Int): IrType { + val isNonNull = semanticNonNullLevels.any { it == null || it == level } return when (this) { is IrNamedType -> this - is IrListType -> copy(ofType = ofType.nooe(nullOnlyOnErrorLevels, level + 1)) + is IrListType -> copy(ofType = ofType.nooe(semanticNonNullLevels, level + 1)) }.let { if (isNonNull) { it.nullable(false) diff --git a/tests/catch/src/main/graphql/schema.graphqls b/tests/catch/src/main/graphql/schema.graphqls index 231e553cb1b..5d9a7d08d6e 100644 --- a/tests/catch/src/main/graphql/schema.graphqls +++ b/tests/catch/src/main/graphql/schema.graphqls @@ -1,6 +1,6 @@ -extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@nullOnlyOnError", "@catch"]) +extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@semanticNonNull", "@catch"]) -#directive @nullOnlyOnError(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT +#directive @semanticNonNull(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT #directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) on FIELD enum CatchTo { @@ -11,15 +11,15 @@ enum CatchTo { type Query { nullable: Int - nullOnlyOnError: Int @nullOnlyOnError - deep: [[[Int]]] @nullOnlyOnError - user: User @nullOnlyOnError + semanticNonNull: Int @semanticNonNull + deep: [[[Int]]] @semanticNonNull + user: User @semanticNonNull product: Product } type User { - name: String @nullOnlyOnError - friends: [User] @nullOnlyOnError + name: String @semanticNonNull + friends: [User] @semanticNonNull } From efbe797519ad717c7e1201e653b9e987c1de16d4 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 29 Nov 2023 17:13:50 +0100 Subject: [PATCH 16/42] add ApolloExperimental --- .../commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt index 548cfbba299..314ec3830a7 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt @@ -205,7 +205,10 @@ class Schema internal constructor( const val OPTIONAL = "optional" const val REQUIRES_OPT_IN = "requiresOptIn" const val CATCH = "catch" + + @ApolloExperimental const val SEMANTIC_NON_NULL = "semanticNonNull" + @ApolloExperimental const val IGNORE_ERRORS = "ignoreErrors" const val FIELD_POLICY_FOR_FIELD = "forField" From 932cc4bf5ecf0dadf6871a7bb8a5823e19c87b8f Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 29 Nov 2023 19:04:37 +0100 Subject: [PATCH 17/42] fix api dump --- libraries/apollo-ast/api/apollo-ast.api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index 0ff25e8269b..8395f0448c1 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -946,9 +946,9 @@ public final class com/apollographql/apollo3/ast/Schema { public static final field FIELD_POLICY_PAGINATION_ARGS Ljava/lang/String; public static final field IGNORE_ERRORS Ljava/lang/String; public static final field NONNULL Ljava/lang/String; - public static final field NULL_ONLY_ON_ERROR Ljava/lang/String; public static final field OPTIONAL Ljava/lang/String; public static final field REQUIRES_OPT_IN Ljava/lang/String; + public static final field SEMANTIC_NON_NULL Ljava/lang/String; public static final field TYPE_POLICY Ljava/lang/String; public final fun getDirectiveDefinitions ()Ljava/util/Map; public final fun getErrorAware ()Z From 1c425e4441c8e0c0f37d06c2a743727f5f641719 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 29 Nov 2023 23:51:36 +0100 Subject: [PATCH 18/42] allow setting a default on the schema for @catch --- .../apollo3/ast/internal/definitions.kt | 38 ++++-- .../compiler/ir/IrOperationsBuilder.kt | 17 ++- .../apollo3/compiler/ir/IrType.kt | 59 ++++++--- tests/catch/build.gradle.kts | 15 ++- .../graphql/{ => default}/operations.graphql | 0 .../graphql/{ => default}/schema.graphqls | 3 - .../src/main/graphql/null/extra.graphqls | 1 + .../src/main/graphql/result/extra.graphqls | 1 + .../src/test/kotlin/test/CatchNullTest.kt | 114 +++++++++++++++++ .../src/test/kotlin/test/CatchResultTest.kt | 115 ++++++++++++++++++ tests/catch/src/test/kotlin/test/CatchTest.kt | 16 +-- 11 files changed, 333 insertions(+), 46 deletions(-) rename tests/catch/src/main/graphql/{ => default}/operations.graphql (100%) rename tests/catch/src/main/graphql/{ => default}/schema.graphqls (68%) create mode 100644 tests/catch/src/main/graphql/null/extra.graphqls create mode 100644 tests/catch/src/main/graphql/result/extra.graphqls create mode 100644 tests/catch/src/test/kotlin/test/CatchNullTest.kt create mode 100644 tests/catch/src/test/kotlin/test/CatchResultTest.kt diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index e04ec797d3a..0e3a71bc04d 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -287,29 +287,43 @@ type User { } ``` -@param field the name of the field if applied to an object definition or null if applied -to a field definition +The `field` argument is the name of the field if `@semanticNonNull` is applied to an object definition. +If `@semanticNonNull` is applied to a field definition, `field` must be null. -@param level in case of a list type, level is the dimension where to apply the modifier, -starting at 0 if there is no list. -If level is null, the modifier is applied to all levels +The `level` argument can be used to indicate what level is semantically non null in case of lists. +`level` starts at 0 if there is no list. If `level` is null, all levels are semantically non null. ""${'"'} directive @semanticNonNull(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT ""${'"'} -Indicates that a field acts as an error boundary in case of a GraphQL error. +Indicates that the given position stops GraphQL errors to propagate up the tree. -By default, the first GraphQL error throws and fails the whole response. +By default, the first GraphQL error stops the parsing and fails the whole response. +Using `@catch` recovers from this error and allows the parsing to continue. -@param level in case of a list type, level is the dimension where to apply the modifier, -starting at 0 if there is no list. -If level is null, the modifier is applied to all levels +`@catch` can be used on the schema definition, in which case, it is the default for +every field. If no `@catch` is applied to the schema definition, errors are not +caught by default and the parsing stops at the first error. + +The `to` argument can be used to choose how to recover from errors. See `CatchTo` +for more details. + +The `level` argument can be used to indicate where to catch in case of lists. +`level` starts at 0 if there is no list. If `level` is null, all levels catch. ""${'"'} -directive @catch(to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD +directive @catch(to: CatchTo! = RESULT, level: Int = null) repeatable on FIELD | SCHEMA enum CatchTo { - NULL, + ""${'"'} + Map to a result type that can contain either a value or an error. + ""${'"'} RESULT, + ""${'"'} + Map to a nullable type that will be null in the case of error. + This does not allow to distinguish between semantic null and error but + can be simpler in some cases. + ""${'"'} + NULL, } ""${'"'} diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 9c514b5a3de..5f49a847295 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -88,6 +88,8 @@ internal class IrOperationsBuilder( else -> error("codegenModels='$codegenModels' is not supported") } + val defaultCatch = schema.schemaDefinition?.directives?.findCatches(schema)?.singleOrNull() + fun build(): IrOperations { val operations = operationDefinitions.map { it.toIr() } val fragments = fragmentDefinitions.map { it.toIr() } @@ -482,7 +484,7 @@ internal class IrOperationsBuilder( val deprecationReason: String?, val optInFeature: String?, val nooes: List, - val catchs: List, + val catches: List, val forceOptional: Boolean, /** @@ -542,7 +544,7 @@ internal class IrOperationsBuilder( nooes = nooeLevels, forceOptional = gqlField.directives.optionalValue(schema) == true, parentType = fieldWithParent.parentType, - catchs = gqlField.directives.findCatches(schema) + catches = gqlField.directives.findCatches(schema) ) }.groupBy { it.responseName @@ -624,7 +626,7 @@ internal class IrOperationsBuilder( } } // Finally, transform into Result or Nullable depending on catch - .catch(first.catchs, 0) + .catch(first.catches, defaultCatch, 0) /** * Depending on the parent object/interface in which the field is queried, the field definition might have different descriptions/deprecationReasons @@ -689,13 +691,16 @@ internal class IrOperationsBuilder( } } - private fun IrType.catch(catchLevels: List, level: Int): IrType { - val catchLevel = catchLevels.firstOrNull { it.level == null || it.level == level } + private fun IrType.catch(catchLevels: List, defaultCatch: Catch?, level: Int): IrType { + var catchLevel = catchLevels.firstOrNull { it.level == null || it.level == level } var type = when (this) { is IrNamedType -> this - is IrListType -> copy(ofType = ofType.catch(catchLevels, level + 1)) + is IrListType -> copy(ofType = ofType.catch(catchLevels, defaultCatch, level + 1)) } + if (catchLevel == null && type.maybeError) { + catchLevel = defaultCatch + } if (catchLevel != null) { type = type.catchTo(catchLevel.to.toIr()) if (catchLevel.to == CatchTo.NULL) { diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt index ca08b57bfb2..0eab503b743 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt @@ -43,11 +43,33 @@ import kotlinx.serialization.Serializable */ @Serializable sealed interface IrType { + /** + * This type may by an error + * true if the type is nullable in the server schema + */ + val maybeError: Boolean + + /** + * This type is nullable in Kotlin + */ val nullable: Boolean + + /** + * This type is optional in Kotlin + */ val optional: Boolean + + /** + * reading this type must catch exceptions during parsing + */ val catchTo: IrCatchTo - fun copyWith(nullable: Boolean = this.nullable, optional: Boolean = this.optional, catchTo: IrCatchTo = this.catchTo): IrType + fun copyWith( + maybeError: Boolean = this.maybeError, + nullable: Boolean = this.nullable, + optional: Boolean = this.optional, + catchTo: IrCatchTo = this.catchTo, + ): IrType fun rawType(): IrNamedType } @@ -61,6 +83,7 @@ enum class IrCatchTo { fun IrType.nullable(nullable: Boolean): IrType = copyWith(nullable = nullable) fun IrType.optional(optional: Boolean): IrType = copyWith(optional = optional) fun IrType.catchTo(catchTo: IrCatchTo): IrType = copyWith(catchTo = catchTo) +fun IrType.maybeError(maybeError: Boolean): IrType = copyWith(maybeError = maybeError) @Serializable @SerialName("list") @@ -69,8 +92,9 @@ data class IrListType( override val nullable: Boolean = false, override val optional: Boolean = false, override val catchTo: IrCatchTo = IrCatchTo.NoCatch, + override val maybeError: Boolean = false, ) : IrType { - override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) + override fun copyWith(maybeError: Boolean, nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo, maybeError = maybeError) override fun rawType() = ofType.rawType() } @@ -88,8 +112,9 @@ data class IrScalarType( override val nullable: Boolean = false, override val optional: Boolean = false, override val catchTo: IrCatchTo = IrCatchTo.NoCatch, + override val maybeError: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) + override fun copyWith(maybeError: Boolean, nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo, maybeError = maybeError) override fun rawType() = this } @@ -100,8 +125,9 @@ data class IrInputObjectType( override val nullable: Boolean = false, override val optional: Boolean = false, override val catchTo: IrCatchTo = IrCatchTo.NoCatch, + override val maybeError: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) + override fun copyWith(maybeError: Boolean, nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo, maybeError = maybeError) override fun rawType() = this } @@ -112,8 +138,9 @@ data class IrEnumType( override val nullable: Boolean = false, override val optional: Boolean = false, override val catchTo: IrCatchTo = IrCatchTo.NoCatch, + override val maybeError: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) + override fun copyWith(maybeError: Boolean, nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo, maybeError = maybeError) override fun rawType() = this } @@ -124,8 +151,9 @@ data class IrObjectType( override val nullable: Boolean = false, override val optional: Boolean = false, override val catchTo: IrCatchTo = IrCatchTo.NoCatch, + override val maybeError: Boolean = false, ) : IrNamedType { - override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) + override fun copyWith(maybeError: Boolean, nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo, maybeError = maybeError) override fun rawType() = this } @@ -155,11 +183,12 @@ internal data class IrModelType( override val nullable: Boolean = false, override val optional: Boolean = false, override val catchTo: IrCatchTo = IrCatchTo.NoCatch, + override val maybeError: Boolean = false, ) : IrNamedType { override val name: String get() = path - override fun copyWith(nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo) + override fun copyWith(maybeError: Boolean, nullable: Boolean, optional: Boolean, catchTo: IrCatchTo): IrType = copy(nullable = nullable, optional = optional, catchTo = catchTo, maybeError = maybeError) override fun rawType() = this } @@ -178,32 +207,32 @@ internal fun IrType.replacePlaceholder(newPath: String): IrType { internal fun GQLType.toIr(schema: Schema): IrType { return when (this) { - is GQLNonNullType -> type.toIr(schema).copyWith(nullable = false) - is GQLListType -> IrListType(ofType = type.toIr(schema), nullable = true) + is GQLNonNullType -> type.toIr(schema).copyWith(nullable = false, maybeError = false) + is GQLListType -> IrListType(ofType = type.toIr(schema), nullable = true, maybeError = true) is GQLNamedType -> { when (schema.typeDefinition(name)) { is GQLScalarTypeDefinition -> { - IrScalarType(name, nullable = true) + IrScalarType(name, nullable = true, maybeError = true) } is GQLEnumTypeDefinition -> { - IrEnumType(name, nullable = true) + IrEnumType(name, nullable = true, maybeError = true) } is GQLInputObjectTypeDefinition -> { - IrInputObjectType(name, nullable = true) + IrInputObjectType(name, nullable = true, maybeError = true) } is GQLObjectTypeDefinition -> { - IrModelType(MODEL_UNKNOWN, nullable = true) + IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = true) } is GQLInterfaceTypeDefinition -> { - IrModelType(MODEL_UNKNOWN, nullable = true) + IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = true) } is GQLUnionTypeDefinition -> { - IrModelType(MODEL_UNKNOWN, nullable = true) + IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = true) } } } diff --git a/tests/catch/build.gradle.kts b/tests/catch/build.gradle.kts index f466e1911ce..c5ac4018f5a 100644 --- a/tests/catch/build.gradle.kts +++ b/tests/catch/build.gradle.kts @@ -14,7 +14,18 @@ dependencies { } apollo { - service("service") { - packageName.set("com.example") + service("default") { + srcDir("src/main/graphql/default") + packageName.set("default") + } + service("null") { + srcDir("src/main/graphql/default") + srcDir("src/main/graphql/null") + packageName.set("null") + } + service("result") { + srcDir("src/main/graphql/default") + srcDir("src/main/graphql/result") + packageName.set("result") } } diff --git a/tests/catch/src/main/graphql/operations.graphql b/tests/catch/src/main/graphql/default/operations.graphql similarity index 100% rename from tests/catch/src/main/graphql/operations.graphql rename to tests/catch/src/main/graphql/default/operations.graphql diff --git a/tests/catch/src/main/graphql/schema.graphqls b/tests/catch/src/main/graphql/default/schema.graphqls similarity index 68% rename from tests/catch/src/main/graphql/schema.graphqls rename to tests/catch/src/main/graphql/default/schema.graphqls index 5d9a7d08d6e..27a27f1a552 100644 --- a/tests/catch/src/main/graphql/schema.graphqls +++ b/tests/catch/src/main/graphql/default/schema.graphqls @@ -1,8 +1,5 @@ extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@semanticNonNull", "@catch"]) -#directive @semanticNonNull(field: String = null, level: Int = null) repeatable on FIELD_DEFINITION | OBJECT -#directive @catch(if: Boolean! = true, to: CatchTo! = RESULT, level: Int = null) on FIELD - enum CatchTo { NULL, THROW, diff --git a/tests/catch/src/main/graphql/null/extra.graphqls b/tests/catch/src/main/graphql/null/extra.graphqls new file mode 100644 index 00000000000..f6bc88f6d5f --- /dev/null +++ b/tests/catch/src/main/graphql/null/extra.graphqls @@ -0,0 +1 @@ +extend schema @catch(to: NULL) \ No newline at end of file diff --git a/tests/catch/src/main/graphql/result/extra.graphqls b/tests/catch/src/main/graphql/result/extra.graphqls new file mode 100644 index 00000000000..9b59eabae86 --- /dev/null +++ b/tests/catch/src/main/graphql/result/extra.graphqls @@ -0,0 +1 @@ +extend schema @catch(to: RESULT) \ No newline at end of file diff --git a/tests/catch/src/test/kotlin/test/CatchNullTest.kt b/tests/catch/src/test/kotlin/test/CatchNullTest.kt new file mode 100644 index 00000000000..445b43ca9d0 --- /dev/null +++ b/tests/catch/src/test/kotlin/test/CatchNullTest.kt @@ -0,0 +1,114 @@ +package test + +import com.apollographql.apollo3.api.errorOrNull +import com.apollographql.apollo3.api.valueOrThrow +import com.apollographql.apollo3.exception.ApolloGraphQLException +import `null`.PriceNullQuery +import `null`.ProductIgnoreErrorsQuery +import `null`.ProductNullQuery +import `null`.ProductQuery +import `null`.ProductResultQuery +import `null`.UserNullQuery +import `null`.UserQuery +import `null`.UserResultQuery +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class CatchNullTest { + @Test + fun userOnUserNameError() { + val response = UserQuery().parseResponse(userNameError) + val exception = response.exception + assertIs(exception) + assertEquals("cannot resolve name", exception.error.message) + } + + @Test + fun userResultOnUserNameError() { + val response = UserResultQuery().parseResponse(userNameError) + + assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) + } + + @Test + fun userNullOnUserNameError() { + val response = UserNullQuery().parseResponse(userNameError) + + assertNull(response.data!!.user) + } + + @Test + fun userThrowOnUserSuccess() { + val response = UserQuery().parseResponse(userSuccess) + + assertEquals("Pancakes", response.data!!.user?.name) + } + + @Test + fun userResultOnUserSuccess() { + val response = UserResultQuery().parseResponse(userSuccess) + + assertEquals("Pancakes", response.data!!.user.valueOrThrow().name) + } + + @Test + fun userNullOnUserSuccess() { + val response = UserNullQuery().parseResponse(userSuccess) + + assertEquals("Pancakes", response.data!!.user!!.name) + } + + @Test + fun productOnProductPriceError() { + val response = ProductQuery().parseResponse(productPriceError) + + val exception = response.exception + assertIs(exception) + assertEquals("cannot resolve price", exception.error.message) + } + + @Test + fun productResultOnProductPriceError() { + val response = ProductResultQuery().parseResponse(productPriceError) + + assertEquals("cannot resolve price", response.data?.product?.errorOrNull?.message) + } + + @Test + fun productNullOnProductPriceError() { + val response = ProductNullQuery().parseResponse(productPriceError) + + assertNull(response.data?.product) + assertNotNull(response.data) + } + + @Test + fun productIgnoreErrorsOnProductPriceError() { + val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.price) + assertEquals("cannot resolve price", response.errors?.single()?.message) + } + + @Test + fun productPriceNullOnProductPriceError() { + val response = PriceNullQuery().parseResponse(productPriceError) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.price) + assertEquals("cannot resolve price", response.errors?.single()?.message) + } + + @Test + fun productPriceNullOnProductPriceNull() { + val response = PriceNullQuery().parseResponse(productPriceNull) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.price) + assertNull(response.errors) + } +} diff --git a/tests/catch/src/test/kotlin/test/CatchResultTest.kt b/tests/catch/src/test/kotlin/test/CatchResultTest.kt new file mode 100644 index 00000000000..e8955fcf76e --- /dev/null +++ b/tests/catch/src/test/kotlin/test/CatchResultTest.kt @@ -0,0 +1,115 @@ +package test + +import com.apollographql.apollo3.api.errorOrNull +import com.apollographql.apollo3.api.valueOrNull +import com.apollographql.apollo3.api.valueOrThrow +import com.apollographql.apollo3.exception.ApolloGraphQLException +import result.PriceNullQuery +import result.ProductIgnoreErrorsQuery +import result.ProductNullQuery +import result.ProductQuery +import result.ProductResultQuery +import result.UserNullQuery +import result.UserQuery +import result.UserResultQuery +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class CatchResultTest { + @Test + fun userOnUserNameError() { + val response = UserQuery().parseResponse(userNameError) + val exception = response.exception + assertIs(exception) + assertEquals("cannot resolve name", exception.error.message) + } + + @Test + fun userResultOnUserNameError() { + val response = UserResultQuery().parseResponse(userNameError) + + assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) + } + + @Test + fun userNullOnUserNameError() { + val response = UserNullQuery().parseResponse(userNameError) + + assertNull(response.data!!.user) + } + + @Test + fun userThrowOnUserSuccess() { + val response = UserQuery().parseResponse(userSuccess) + + assertEquals("Pancakes", response.data!!.user.valueOrNull?.name?.valueOrNull) + } + + @Test + fun userResultOnUserSuccess() { + val response = UserResultQuery().parseResponse(userSuccess) + + assertEquals("Pancakes", response.data!!.user.valueOrThrow().name.valueOrNull) + } + + @Test + fun userNullOnUserSuccess() { + val response = UserNullQuery().parseResponse(userSuccess) + + assertEquals("Pancakes", response.data!!.user!!.name.valueOrNull) + } + + @Test + fun productOnProductPriceError() { + val response = ProductQuery().parseResponse(productPriceError) + + val exception = response.exception + assertIs(exception) + assertEquals("cannot resolve price", exception.error.message) + } + + @Test + fun productResultOnProductPriceError() { + val response = ProductResultQuery().parseResponse(productPriceError) + + assertEquals("cannot resolve price", response.data?.product?.errorOrNull?.message) + } + + @Test + fun productNullOnProductPriceError() { + val response = ProductNullQuery().parseResponse(productPriceError) + + assertNull(response.data?.product) + assertNotNull(response.data) + } + + @Test + fun productIgnoreErrorsOnProductPriceError() { + val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.valueOrNull?.price) + assertEquals("cannot resolve price", response.errors?.single()?.message) + } + + @Test + fun productPriceNullOnProductPriceError() { + val response = PriceNullQuery().parseResponse(productPriceError) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.valueOrNull?.price) + assertEquals("cannot resolve price", response.errors?.single()?.message) + } + + @Test + fun productPriceNullOnProductPriceNull() { + val response = PriceNullQuery().parseResponse(productPriceNull) + + assertNotNull(response.data?.product) + assertNull(response.data?.product?.valueOrNull?.price) + assertNull(response.errors) + } +} diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index 0426fb22848..c7733ab582d 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -9,14 +9,14 @@ import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse import com.apollographql.apollo3.api.valueOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException -import com.example.PriceNullQuery -import com.example.ProductIgnoreErrorsQuery -import com.example.ProductNullQuery -import com.example.ProductQuery -import com.example.ProductResultQuery -import com.example.UserNullQuery -import com.example.UserQuery -import com.example.UserResultQuery +import default.PriceNullQuery +import default.ProductIgnoreErrorsQuery +import default.ProductNullQuery +import default.ProductQuery +import default.ProductResultQuery +import default.UserNullQuery +import default.UserQuery +import default.UserResultQuery import okio.Buffer import org.intellij.lang.annotations.Language import kotlin.test.Test From 2f66e4f6cf42194d865c0a887c8ff540701bea00 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Wed, 29 Nov 2023 23:58:35 +0100 Subject: [PATCH 19/42] add catch(to: THROW) --- .../apollographql/apollo3/ast/gqldirective.kt | 4 +++- .../apollo3/ast/internal/definitions.kt | 13 ++++++++---- .../compiler/ir/IrOperationsBuilder.kt | 3 ++- tests/catch/build.gradle.kts | 7 ++++--- .../src/main/graphql/null/operations.graphql | 5 +++++ .../{default => shared}/operations.graphql | 0 .../{default => shared}/schema.graphqls | 0 .../src/main/graphql/throw/extra.graphqls | 1 + .../src/test/kotlin/test/CatchNullTest.kt | 21 +++++++++++++------ .../src/test/kotlin/test/CatchResultTest.kt | 12 +++++------ tests/catch/src/test/kotlin/test/CatchTest.kt | 2 +- 11 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 tests/catch/src/main/graphql/null/operations.graphql rename tests/catch/src/main/graphql/{default => shared}/operations.graphql (100%) rename tests/catch/src/main/graphql/{default => shared}/schema.graphqls (100%) create mode 100644 tests/catch/src/main/graphql/throw/extra.graphqls diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index 7811a52cba0..4078a3ac221 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -77,7 +77,8 @@ fun List.findNonnull(schema: Schema) = any { schema.originalDirect enum class CatchTo { RESULT, - NULL + NULL, + THROW } @ApolloInternal @@ -124,6 +125,7 @@ private fun GQLValue?.toCatchTo(): CatchTo { is GQLEnumValue -> when (this.value) { "NULL" -> CatchTo.NULL "RESULT" -> CatchTo.RESULT + "THROW" -> CatchTo.THROW else -> error("Unknown CatchTo value: ${this.value}") } diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 0e3a71bc04d..1aaf592434a 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -301,8 +301,9 @@ Indicates that the given position stops GraphQL errors to propagate up the tree. By default, the first GraphQL error stops the parsing and fails the whole response. Using `@catch` recovers from this error and allows the parsing to continue. -`@catch` can be used on the schema definition, in which case, it is the default for -every field. If no `@catch` is applied to the schema definition, errors are not +`@catch` can be used on the schema definition. In this case, it is the default for +every field that can return an error (nullable fields). +If no `@catch` is applied to the schema definition, errors are not caught by default and the parsing stops at the first error. The `to` argument can be used to choose how to recover from errors. See `CatchTo` @@ -324,12 +325,16 @@ enum CatchTo { can be simpler in some cases. ""${'"'} NULL, + ""${'"'} + Do not catch and let any exception through + ""${'"'} + THROW } ""${'"'} -Never throw on errors. +Never throw on field errors. This is used for backward compatibility for clients where this was the default behaviour. ""${'"'} -directive @ignoreErrors on QUERY | MUTATION | SUBSCRIPTION +directive @ignoreFieldErrors on QUERY | MUTATION | SUBSCRIPTION """.trimIndent() \ No newline at end of file diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 5f49a847295..2eb28a6f0c0 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -88,7 +88,7 @@ internal class IrOperationsBuilder( else -> error("codegenModels='$codegenModels' is not supported") } - val defaultCatch = schema.schemaDefinition?.directives?.findCatches(schema)?.singleOrNull() + private val defaultCatch = schema.schemaDefinition?.directives?.findCatches(schema)?.singleOrNull() fun build(): IrOperations { val operations = operationDefinitions.map { it.toIr() } @@ -715,6 +715,7 @@ internal class IrOperationsBuilder( return when (this) { CatchTo.RESULT -> IrCatchTo.Result CatchTo.NULL -> IrCatchTo.Null + CatchTo.THROW -> IrCatchTo.NoCatch } } diff --git a/tests/catch/build.gradle.kts b/tests/catch/build.gradle.kts index c5ac4018f5a..b26bd13e8a1 100644 --- a/tests/catch/build.gradle.kts +++ b/tests/catch/build.gradle.kts @@ -15,16 +15,17 @@ dependencies { apollo { service("default") { - srcDir("src/main/graphql/default") + srcDir("src/main/graphql/shared") + srcDir("src/main/graphql/throw") packageName.set("default") } service("null") { - srcDir("src/main/graphql/default") + srcDir("src/main/graphql/shared") srcDir("src/main/graphql/null") packageName.set("null") } service("result") { - srcDir("src/main/graphql/default") + srcDir("src/main/graphql/shared") srcDir("src/main/graphql/result") packageName.set("result") } diff --git a/tests/catch/src/main/graphql/null/operations.graphql b/tests/catch/src/main/graphql/null/operations.graphql new file mode 100644 index 00000000000..703bd1aab47 --- /dev/null +++ b/tests/catch/src/main/graphql/null/operations.graphql @@ -0,0 +1,5 @@ +query ProductThrow { + product @catch(to: THROW) { + price + } +} diff --git a/tests/catch/src/main/graphql/default/operations.graphql b/tests/catch/src/main/graphql/shared/operations.graphql similarity index 100% rename from tests/catch/src/main/graphql/default/operations.graphql rename to tests/catch/src/main/graphql/shared/operations.graphql diff --git a/tests/catch/src/main/graphql/default/schema.graphqls b/tests/catch/src/main/graphql/shared/schema.graphqls similarity index 100% rename from tests/catch/src/main/graphql/default/schema.graphqls rename to tests/catch/src/main/graphql/shared/schema.graphqls diff --git a/tests/catch/src/main/graphql/throw/extra.graphqls b/tests/catch/src/main/graphql/throw/extra.graphqls new file mode 100644 index 00000000000..2655c348258 --- /dev/null +++ b/tests/catch/src/main/graphql/throw/extra.graphqls @@ -0,0 +1 @@ +extend schema @catch(to: THROW) \ No newline at end of file diff --git a/tests/catch/src/test/kotlin/test/CatchNullTest.kt b/tests/catch/src/test/kotlin/test/CatchNullTest.kt index 445b43ca9d0..32563e0d1e1 100644 --- a/tests/catch/src/test/kotlin/test/CatchNullTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchNullTest.kt @@ -1,6 +1,6 @@ package test -import com.apollographql.apollo3.api.errorOrNull +import com.apollographql.apollo3.api.valueOrNull import com.apollographql.apollo3.api.valueOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException import `null`.PriceNullQuery @@ -8,6 +8,7 @@ import `null`.ProductIgnoreErrorsQuery import `null`.ProductNullQuery import `null`.ProductQuery import `null`.ProductResultQuery +import `null`.ProductThrowQuery import `null`.UserNullQuery import `null`.UserQuery import `null`.UserResultQuery @@ -30,18 +31,18 @@ class CatchNullTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) + assertNull(response.data?.user?.valueOrNull?.name) } @Test fun userNullOnUserNameError() { val response = UserNullQuery().parseResponse(userNameError) - assertNull(response.data!!.user) + assertNull(response.data!!.user?.name) } @Test - fun userThrowOnUserSuccess() { + fun userOnUserSuccess() { val response = UserQuery().parseResponse(userSuccess) assertEquals("Pancakes", response.data!!.user?.name) @@ -65,23 +66,31 @@ class CatchNullTest { fun productOnProductPriceError() { val response = ProductQuery().parseResponse(productPriceError) + assertNotNull(response.data) val exception = response.exception assertIs(exception) assertEquals("cannot resolve price", exception.error.message) } + @Test + fun productThrowOnProductPriceError() { + val response = ProductThrowQuery().parseResponse(productPriceError) + + assertNull(response.data) + } + @Test fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertEquals("cannot resolve price", response.data?.product?.errorOrNull?.message) + assertNull(null, response.data?.product?.valueOrNull?.price) } @Test fun productNullOnProductPriceError() { val response = ProductNullQuery().parseResponse(productPriceError) - assertNull(response.data?.product) + assertNull(response.data?.product?.price) assertNotNull(response.data) } diff --git a/tests/catch/src/test/kotlin/test/CatchResultTest.kt b/tests/catch/src/test/kotlin/test/CatchResultTest.kt index e8955fcf76e..d488fac13a0 100644 --- a/tests/catch/src/test/kotlin/test/CatchResultTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchResultTest.kt @@ -31,18 +31,18 @@ class CatchResultTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) + assertEquals("cannot resolve name", response.data?.user?.valueOrNull?.name?.errorOrNull?.message) } @Test fun userNullOnUserNameError() { val response = UserNullQuery().parseResponse(userNameError) - assertNull(response.data!!.user) + assertEquals("cannot resolve name", response.data!!.user?.name?.errorOrNull?.message) } @Test - fun userThrowOnUserSuccess() { + fun userOnUserSuccess() { val response = UserQuery().parseResponse(userSuccess) assertEquals("Pancakes", response.data!!.user.valueOrNull?.name?.valueOrNull) @@ -75,14 +75,14 @@ class CatchResultTest { fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertEquals("cannot resolve price", response.data?.product?.errorOrNull?.message) + assertEquals("cannot resolve price", response.data?.product?.valueOrNull?.price?.errorOrNull?.message) } @Test fun productNullOnProductPriceError() { val response = ProductNullQuery().parseResponse(productPriceError) - assertNull(response.data?.product) + assertEquals("cannot resolve price", response.data?.product?.price?.errorOrNull?.message) assertNotNull(response.data) } @@ -91,7 +91,7 @@ class CatchResultTest { val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull?.price) + assertNull(response.data?.product?.valueOrNull?.price?.valueOrNull) assertEquals("cannot resolve price", response.errors?.single()?.message) } diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index c7733ab582d..f05303a86b9 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -49,7 +49,7 @@ class CatchTest { } @Test - fun userThrowOnUserSuccess() { + fun userOnUserSuccess() { val response = UserQuery().parseResponse(userSuccess) assertEquals("Pancakes", response.data!!.user.name) From e8de0ac8e2175e975c3bfac78bfe320499b36c7c Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 00:41:25 +0100 Subject: [PATCH 20/42] enforce chosing a default CatchTo --- .../ast/internal/ExecutableValidationScope.kt | 1 + .../ast/internal/SchemaValidationScope.kt | 50 +++++++++++++++++++ .../ast/internal/validation/defer_labels.kt | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt index 466bcd7abec..def914dc26d 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt @@ -344,6 +344,7 @@ internal class ExecutableValidationScope( validateCommon(this, selections, directives, rootTypeDefinition) fieldsInSetCanMerge(selections.collectFields(rootTypeDefinition.name)) + issues.addAll(validateDeferLabels(this, rootTypeDefinition.name, schema, fragmentDefinitions)) val allVariableUsages = selections.collectFragmentSpreads().flatMap { fragmentVariableUsages.get(it) ?: emptyList() } + variableUsages diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt index 36ee1e68fe7..467ca9ed5c6 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt @@ -16,6 +16,7 @@ import com.apollographql.apollo3.ast.GQLListValue import com.apollographql.apollo3.ast.GQLNamed import com.apollographql.apollo3.ast.GQLNamedType import com.apollographql.apollo3.ast.GQLNonNullType +import com.apollographql.apollo3.ast.GQLNullValue import com.apollographql.apollo3.ast.GQLObjectTypeDefinition import com.apollographql.apollo3.ast.GQLObjectValue import com.apollographql.apollo3.ast.GQLOperationTypeDefinition @@ -183,6 +184,7 @@ internal fun validateSchema(definitions: List, requiresApolloDefi mergedScope.validateInterfaces() mergedScope.validateObjects() mergedScope.validateInputObjects() + mergedScope.validateCatch(mergedSchemaDefinition) val keyFields = mergedScope.validateAndComputeKeyFields() val connectionTypes = mergedScope.computeConnectionTypes() @@ -441,6 +443,54 @@ private fun ValidationScope.validateObjects() { } } +private fun ValidationScope.validateCatch(schemaDefinition: GQLSchemaDefinition?) { + val hasCatchDefinition = directiveDefinitions.any { + originalDirectiveName(it.key) == Schema.CATCH + } + + if (!hasCatchDefinition) { + return + } + + if (schemaDefinition == null) { + issues.add(OtherValidationIssue( + message = "Schemas that include the `@catch` definition must opt-in a default CatchTo. Use `extend schema @catch(to: \$to)`", + sourceLocation = null + )) + return + } + + + val catches = schemaDefinition.directives.filter { + originalDirectiveName(it.name) == Schema.CATCH + } + + if (catches.isEmpty()) { + issues.add(OtherValidationIssue( + message = "Schemas that include the `@catch` definition must opt-in a default CatchTo. Use `extend schema @catch(to: \$to)`", + sourceLocation = schemaDefinition.sourceLocation + )) + return + } else if (catches.size > 1) { + issues.add(OtherValidationIssue( + message = "There can be only one `@catch` directive on the schema definition", + sourceLocation = schemaDefinition.sourceLocation + )) + return + } + + val catch = catches.single() + + catch.arguments.forEach { + if (it.name == "level" && it.value !is GQLNullValue) { + issues.add(OtherValidationIssue( + message = "The 'level' argument must be null when `@catch` is applied to the schema", + sourceLocation = it.sourceLocation + )) + } + } + +} private fun ValidationScope.validateInputObjects() { typeDefinitions.values.filterIsInstance().forEach { o -> if (o.inputFields.isEmpty()) { diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/validation/defer_labels.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/validation/defer_labels.kt index 477d1f6b009..367f26ab8be 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/validation/defer_labels.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/validation/defer_labels.kt @@ -187,4 +187,4 @@ internal fun validateDeferLabels( fragments: Map, ): List { return Scope(schema, fragments).validate(operation, parentType) -} \ No newline at end of file +} From 96b710d5e9137db989acf28f6a72dcbf00399579 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 12:38:50 +0100 Subject: [PATCH 21/42] add validation for @catch --- build-logic/src/main/kotlin/Testing.kt | 17 ++- .../apollographql/apollo3/ast/gqldirective.kt | 5 +- .../ast/internal/ExecutableValidationScope.kt | 135 ++++++++++++------ .../ast/internal/InputValueValidationScope.kt | 4 + .../apollo3/graphql/ast/test/ParserTest.kt | 7 +- .../apollo3/compiler/TestUtils.kt | 8 +- .../validation/operation/catch/catch.expected | 17 +++ .../validation/operation/catch/catch.graphql | 25 ++++ .../operation/catch/schema.graphqls | 8 ++ 9 files changed, 164 insertions(+), 62 deletions(-) create mode 100644 libraries/apollo-compiler/src/test/validation/operation/catch/catch.expected create mode 100644 libraries/apollo-compiler/src/test/validation/operation/catch/catch.graphql create mode 100644 libraries/apollo-compiler/src/test/validation/operation/catch/schema.graphqls diff --git a/build-logic/src/main/kotlin/Testing.kt b/build-logic/src/main/kotlin/Testing.kt index daf452f7caf..fcac18f4d7f 100644 --- a/build-logic/src/main/kotlin/Testing.kt +++ b/build-logic/src/main/kotlin/Testing.kt @@ -8,10 +8,9 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent fun Project.configureTesting() { tasks.withType(Test::class.java) { - systemProperty("updateTestFixtures", System.getProperty("updateTestFixtures")) - systemProperty("testFilter", System.getProperty("testFilter")) - systemProperty("codegenModels", System.getProperty("codegenModels")) - + forwardEnv("updateTestFixtures") + forwardEnv("testFilter") + forwardEnv("codegenModels") } pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { @@ -35,6 +34,16 @@ fun Project.configureTesting() { } } +/** + * forwards an environment variable to a test task and mark it as input + */ +fun Test.forwardEnv(name: String) { + System.getenv(name)?.let { value -> + environment(name, value) + inputs.property(name, value) + } +} + // See https://github.com/gradle/gradle/issues/23456 fun Test.addRelativeInput(name: String, dirPath: Any) { this.inputs.dir(dirPath).withPropertyName(name).withPathSensitivity(PathSensitivity.RELATIVE) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index 4078a3ac221..9cef31699cf 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -82,13 +82,14 @@ enum class CatchTo { } @ApolloInternal -class Catch(val to: CatchTo, val level: Int?) +data class Catch(val to: CatchTo, val level: Int?) private fun GQLDirectiveDefinition.getArgumentDefaultValue(argName: String): GQLValue? { return arguments.firstOrNull { it.name == argName }?.defaultValue } -private fun GQLDirective.getArgument(argName: String, schema: Schema): GQLValue? { +@ApolloInternal +fun GQLDirective.getArgument(argName: String, schema: Schema): GQLValue? { val directiveDefinition: GQLDirectiveDefinition = schema.directiveDefinitions.get(name)!! val argument = arguments.firstOrNull { it.name == argName } if (argument == null) { diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt index def914dc26d..82bedbcbb43 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt @@ -1,52 +1,8 @@ package com.apollographql.apollo3.ast.internal import com.apollographql.apollo3.annotations.ApolloInternal -import com.apollographql.apollo3.ast.AnonymousOperation -import com.apollographql.apollo3.ast.DeprecatedUsage -import com.apollographql.apollo3.ast.DifferentShape -import com.apollographql.apollo3.ast.ExecutableValidationResult -import com.apollographql.apollo3.ast.GQLArgument -import com.apollographql.apollo3.ast.GQLBooleanValue -import com.apollographql.apollo3.ast.GQLDirective -import com.apollographql.apollo3.ast.GQLDocument -import com.apollographql.apollo3.ast.GQLEnumTypeDefinition -import com.apollographql.apollo3.ast.GQLEnumValue -import com.apollographql.apollo3.ast.GQLField -import com.apollographql.apollo3.ast.GQLFloatValue -import com.apollographql.apollo3.ast.GQLFragmentDefinition -import com.apollographql.apollo3.ast.GQLFragmentSpread -import com.apollographql.apollo3.ast.GQLInlineFragment -import com.apollographql.apollo3.ast.GQLIntValue -import com.apollographql.apollo3.ast.GQLListType -import com.apollographql.apollo3.ast.GQLListValue -import com.apollographql.apollo3.ast.GQLNamedType -import com.apollographql.apollo3.ast.GQLNode -import com.apollographql.apollo3.ast.GQLNonNullType -import com.apollographql.apollo3.ast.GQLNullValue -import com.apollographql.apollo3.ast.GQLObjectTypeDefinition -import com.apollographql.apollo3.ast.GQLObjectValue -import com.apollographql.apollo3.ast.GQLOperationDefinition -import com.apollographql.apollo3.ast.GQLScalarTypeDefinition -import com.apollographql.apollo3.ast.GQLSelection -import com.apollographql.apollo3.ast.GQLStringValue -import com.apollographql.apollo3.ast.GQLType -import com.apollographql.apollo3.ast.GQLTypeDefinition -import com.apollographql.apollo3.ast.GQLValue -import com.apollographql.apollo3.ast.GQLVariableValue -import com.apollographql.apollo3.ast.Issue -import com.apollographql.apollo3.ast.OtherValidationIssue -import com.apollographql.apollo3.ast.Schema -import com.apollographql.apollo3.ast.UnusedFragment -import com.apollographql.apollo3.ast.UnusedVariable -import com.apollographql.apollo3.ast.VariableUsage -import com.apollographql.apollo3.ast.definitionFromScope -import com.apollographql.apollo3.ast.findDeprecationReason +import com.apollographql.apollo3.ast.* import com.apollographql.apollo3.ast.internal.validation.validateDeferLabels -import com.apollographql.apollo3.ast.pretty -import com.apollographql.apollo3.ast.rawType -import com.apollographql.apollo3.ast.responseName -import com.apollographql.apollo3.ast.rootTypeDefinition -import com.apollographql.apollo3.ast.sharesPossibleTypesWith @OptIn(ApolloInternal::class) @@ -67,6 +23,7 @@ internal class ExecutableValidationScope( private val fragmentVariableUsages = mutableMapOf>() private val cyclicFragments = mutableSetOf() private val usedFragments = mutableSetOf() + private val hasCatch = schema.directiveDefinitions.any { schema.originalTypeName(it.key) == Schema.CATCH } /** * These are scoped to the current operation/fragment being validated @@ -219,6 +176,84 @@ internal class ExecutableValidationScope( variableUsages.add(it) } } + if (hasCatch) { + validateCatches(fieldDefinition) + } + } + + private class CatchUsage(val level: Int?, val catchTo: String, val sourceLocation: SourceLocation?) + + private fun GQLType.maxDimension(): Int { + var dimension = 0 + var type = this + while (true) { + when(type) { + is GQLListType -> { + dimension++ + type = type.type + } + is GQLNonNullType -> { + dimension++ + type = type.type + } + else -> return dimension + } + } + } + private fun GQLField.validateCatches(fieldDefinition: GQLFieldDefinition) { + val levelToCatch = directives.filter { + schema.originalDirectiveName(it.name) == Schema.CATCH + }.mapNotNull { + val to = it.getArgument("to", schema) as? GQLEnumValue + if (to == null) { + // caught by other validation rules + return@mapNotNull null + } + val levelInt = when(val levelValue = it.getArgument("level", schema)) { + is GQLNullValue -> null + is GQLIntValue -> levelValue.value.toIntOrNull() ?: error("`@catch` level too big: ${levelValue.value}") + else -> return@mapNotNull null + } + + if (levelInt != null) { + val maxDimension = fieldDefinition.type.maxDimension() + if (levelInt > maxDimension) { + registerIssue( + message = "Invalid 'level' value '$levelInt' for `@catch` usage: this type has a max list level of $maxDimension", + sourceLocation = it.sourceLocation + ) + return@mapNotNull null + } + } + CatchUsage(levelInt, to.value, it.sourceLocation) + }.groupBy { + it.level + }.mapNotNull { + val sameLevel = it.value.distinct() + if (sameLevel.size > 1) { + registerIssue( + message = "Conflicting `@catch` usages for level '${it.key}': a given list level must have a single CatchTo value", + sourceLocation = it.value.first().sourceLocation + ) + return@mapNotNull null + } + + it.value.single() + }.associateBy { + it.level + } + + val default = levelToCatch[null]?.catchTo + levelToCatch.filter { + it.key != null + }.forEach { + if (default != null && it.value.catchTo != default) { + registerIssue( + message = "Conflicting `@catch` usages for level '${it.key}': this level conflicts with the default 'null' level", + sourceLocation = it.value.sourceLocation + ) + } + } } private fun GQLInlineFragment.validate(parentTypeDefinition: GQLTypeDefinition) { @@ -439,6 +474,10 @@ internal class ExecutableValidationScope( addFieldMergingIssue(fieldWithParentA.field, fieldWithParentB.field, "they have different types") return } + if (hasCatch && !areCatchesEqual(fieldA.directives.findCatches(schema), fieldB.directives.findCatches(schema))) { + addFieldMergingIssue(fieldWithParentA.field, fieldWithParentB.field, "they have different `@catch` directives") + return + } if (!areArgumentsEqual(fieldA.arguments, fieldB.arguments)) { addFieldMergingIssue(fieldWithParentA.field, fieldWithParentB.field, "they have different arguments") @@ -487,13 +526,17 @@ internal class ExecutableValidationScope( } } + private fun areCatchesEqual(catchesA: List, catchesB: List): Boolean { + return catchesA.toSet() == catchesB.toSet() + } + private fun areArgumentsEqual(argumentsA: List, argumentsB: List): Boolean { if (argumentsA.size != argumentsB.size) { return false } (argumentsA + argumentsB).groupBy { - // other validations will ensure no duplicates so it's safe to + // other validations will ensure no duplicates, so it's safe to // put everything in a Map here it.name }.values.forEach { diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/InputValueValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/InputValueValidationScope.kt index dee943ac1e9..b52c329b15f 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/InputValueValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/InputValueValidationScope.kt @@ -118,6 +118,10 @@ internal fun ValidationScope.validateAndCoerceValue( return validateAndCoerceEnum(value, expectedTypeDefinition) } + null -> { + registerIssue("Unknown type '${expectedType.pretty()}' for input value", value.sourceLocation) + return value + } else -> { registerIssue("Value cannot be of non-input type ${expectedType.pretty()}", value.sourceLocation) return value diff --git a/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt b/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt index 1fffaa7f20d..b04b340edf8 100644 --- a/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt +++ b/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt @@ -44,14 +44,11 @@ class ParserTest { return true } - return when (System.getProperty("updateTestFixtures")?.trim()) { - "on", "true", "1" -> true - else -> false - } + return false } private fun testFilterMatches(value: String): Boolean { - val testFilter = System.getenv("testFilter") ?: System.getProperty("testFilter") ?: return true + val testFilter = System.getenv("testFilter") ?: true return Regex(testFilter).containsMatchIn(value) } diff --git a/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/TestUtils.kt b/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/TestUtils.kt index 6c9a7a7101f..5da6a39c59f 100644 --- a/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/TestUtils.kt +++ b/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/TestUtils.kt @@ -18,10 +18,7 @@ internal object TestUtils { return true } - return when (System.getProperty("updateTestFixtures")?.trim()) { - "on", "true", "1" -> true - else -> false - } + return false } internal fun shouldUpdateMeasurements(): Boolean { return shouldUpdateTestFixtures() @@ -49,10 +46,11 @@ internal object TestUtils { * ./gradlew :apollo-compiler:test -testFilter="fragments_with_type_condition" --tests '*Codegen*' */ fun testFilterMatches(value: String): Boolean { - val testFilter = System.getenv("testFilter") ?: System.getProperty("testFilter") ?: return true + val testFilter = System.getenv("testFilter") ?: return true return Regex(testFilter).containsMatchIn(value) } + fun testParametersForGraphQLFilesIn(path: String): Collection> { return File(path) .walk() diff --git a/libraries/apollo-compiler/src/test/validation/operation/catch/catch.expected b/libraries/apollo-compiler/src/test/validation/operation/catch/catch.expected new file mode 100644 index 00000000000..10c6af4de40 --- /dev/null +++ b/libraries/apollo-compiler/src/test/validation/operation/catch/catch.expected @@ -0,0 +1,17 @@ +OtherValidationIssue (2:5) +`foo` cannot be merged with `foo` (at catch.graphql: (3, 5)): they have different `@catch` directives. Use different aliases on the fields to fetch both if this was intentional. +------------ +OtherValidationIssue (3:5) +`foo` cannot be merged with `foo` (at catch.graphql: (2, 5)): they have different `@catch` directives. Use different aliases on the fields to fetch both if this was intentional. +------------ +OtherValidationIssue (7:9) +Conflicting `@catch` usages for level 'null': a given list level must have a single CatchTo value +------------ +OtherValidationIssue (11:9) +Conflicting `@catch` usages for level '1': a given list level must have a single CatchTo value +------------ +OtherValidationIssue (15:9) +Conflicting `@catch` usages for level '1': this level conflicts with the default 'null' level +------------ +OtherValidationIssue (19:9) +Invalid 'level' value '3' for `@catch` usage: this type has a max list level of 2 \ No newline at end of file diff --git a/libraries/apollo-compiler/src/test/validation/operation/catch/catch.graphql b/libraries/apollo-compiler/src/test/validation/operation/catch/catch.graphql new file mode 100644 index 00000000000..fa2ea69b602 --- /dev/null +++ b/libraries/apollo-compiler/src/test/validation/operation/catch/catch.graphql @@ -0,0 +1,25 @@ +query Query1 { + foo + foo @catch(to: THROW) +} + +query Query2 { + foo @catch(to: THROW) @catch(to: NULL) +} + +query Query3 { + foo @catch(level: 1, to: THROW) @catch(level: 1, to: NULL) +} + +query Query4 { + foo @catch(level: 1, to: THROW) @catch(to: NULL) +} + +query Query5 { + foo @catch(level: 3, to: THROW) +} + +# OK +query Query6 { + foo @catch(level: 1, to: THROW) @catch(level: 2, to: NULL) +} diff --git a/libraries/apollo-compiler/src/test/validation/operation/catch/schema.graphqls b/libraries/apollo-compiler/src/test/validation/operation/catch/schema.graphqls new file mode 100644 index 00000000000..2a4e5896c36 --- /dev/null +++ b/libraries/apollo-compiler/src/test/validation/operation/catch/schema.graphqls @@ -0,0 +1,8 @@ +extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@semanticNonNull", "@catch", "CatchTo"]) + +extend schema @catch(to: THROW) + +type Query { + foo: [[Int]] +} + From bc1d52d8c8ac0b585fee0f5df3f266564cc2bf51 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 12:38:50 +0100 Subject: [PATCH 22/42] add validation for @catch --- tests/catch/src/main/graphql/shared/schema.graphqls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/catch/src/main/graphql/shared/schema.graphqls b/tests/catch/src/main/graphql/shared/schema.graphqls index 27a27f1a552..02112bb5455 100644 --- a/tests/catch/src/main/graphql/shared/schema.graphqls +++ b/tests/catch/src/main/graphql/shared/schema.graphqls @@ -1,4 +1,4 @@ -extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@semanticNonNull", "@catch"]) +extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@semanticNonNull", "@catch", "CatchTo"]) enum CatchTo { NULL, From eea2763d302c9d62ec22f4aefa8ae5fd36b26d0f Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 14:09:21 +0100 Subject: [PATCH 23/42] update api dump --- libraries/apollo-ast/api/apollo-ast.api | 1 + .../apollo-compiler/api/apollo-compiler.api | 66 +++++++++++-------- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index 8395f0448c1..f29a765c146 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -37,6 +37,7 @@ public final class com/apollographql/apollo3/ast/ApolloParser { public final class com/apollographql/apollo3/ast/CatchTo : java/lang/Enum { public static final field NULL Lcom/apollographql/apollo3/ast/CatchTo; public static final field RESULT Lcom/apollographql/apollo3/ast/CatchTo; + public static final field THROW Lcom/apollographql/apollo3/ast/CatchTo; public static fun getEntries ()Lkotlin/enums/EnumEntries; public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/ast/CatchTo; public static fun values ()[Lcom/apollographql/apollo3/ast/CatchTo; diff --git a/libraries/apollo-compiler/api/apollo-compiler.api b/libraries/apollo-compiler/api/apollo-compiler.api index c24763f2a72..402e62eea14 100644 --- a/libraries/apollo-compiler/api/apollo-compiler.api +++ b/libraries/apollo-compiler/api/apollo-compiler.api @@ -427,17 +427,19 @@ public final class com/apollographql/apollo3/compiler/ir/IrClassName { public final class com/apollographql/apollo3/compiler/ir/IrEnumType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrEnumType$Companion; - public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V - public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; - public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrEnumType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; - public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component5 ()Z + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrEnumType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrEnumType; + public fun copyWith (ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public fun getMaybeError ()Z public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -475,17 +477,19 @@ public final class com/apollographql/apollo3/compiler/ir/IrGraphqlTargetArgument public final class com/apollographql/apollo3/compiler/ir/IrInputObjectType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType$Companion; - public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V - public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; - public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; - public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component5 ()Z + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrInputObjectType; + public fun copyWith (ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public fun getMaybeError ()Z public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -512,17 +516,19 @@ public final class com/apollographql/apollo3/compiler/ir/IrInputObjectType$Compa public final class com/apollographql/apollo3/compiler/ir/IrListType : com/apollographql/apollo3/compiler/ir/IrType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrListType$Companion; - public fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V - public synthetic fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)V + public synthetic fun (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Lcom/apollographql/apollo3/compiler/ir/IrType; public final fun component2 ()Z public final fun component3 ()Z public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; - public final fun copy (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrListType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrListType;Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrListType; - public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component5 ()Z + public final fun copy (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)Lcom/apollographql/apollo3/compiler/ir/IrListType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrListType;Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrListType; + public fun copyWith (ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public fun getMaybeError ()Z public fun getNullable ()Z public final fun getOfType ()Lcom/apollographql/apollo3/compiler/ir/IrType; public fun getOptional ()Z @@ -558,17 +564,19 @@ public final class com/apollographql/apollo3/compiler/ir/IrNamedType$Companion { public final class com/apollographql/apollo3/compiler/ir/IrObjectType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrObjectType$Companion; - public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V - public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; - public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrObjectType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; - public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component5 ()Z + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrObjectType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrObjectType; + public fun copyWith (ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public fun getMaybeError ()Z public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -605,17 +613,19 @@ public final class com/apollographql/apollo3/compiler/ir/IrOperationsKt { public final class com/apollographql/apollo3/compiler/ir/IrScalarType : com/apollographql/apollo3/compiler/ir/IrNamedType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrScalarType$Companion; - public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)V - public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)V + public synthetic fun (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Z public final fun component3 ()Z public final fun component4 ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; - public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; - public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrScalarType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; - public fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun component5 ()Z + public final fun copy (Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;Z)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrScalarType;Ljava/lang/String;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ZILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrScalarType; + public fun copyWith (ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; public fun equals (Ljava/lang/Object;)Z public fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public fun getMaybeError ()Z public fun getName ()Ljava/lang/String; public fun getNullable ()Z public fun getOptional ()Z @@ -676,9 +686,10 @@ public final class com/apollographql/apollo3/compiler/ir/IrTargetObject { public abstract interface class com/apollographql/apollo3/compiler/ir/IrType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrType$Companion; - public abstract fun copyWith (ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; - public static synthetic fun copyWith$default (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public abstract fun copyWith (ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public static synthetic fun copyWith$default (Lcom/apollographql/apollo3/compiler/ir/IrType;ZZZLcom/apollographql/apollo3/compiler/ir/IrCatchTo;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrType; public abstract fun getCatchTo ()Lcom/apollographql/apollo3/compiler/ir/IrCatchTo; + public abstract fun getMaybeError ()Z public abstract fun getNullable ()Z public abstract fun getOptional ()Z public abstract fun rawType ()Lcom/apollographql/apollo3/compiler/ir/IrNamedType; @@ -690,6 +701,7 @@ public final class com/apollographql/apollo3/compiler/ir/IrType$Companion { public final class com/apollographql/apollo3/compiler/ir/IrTypeKt { public static final fun catchTo (Lcom/apollographql/apollo3/compiler/ir/IrType;Lcom/apollographql/apollo3/compiler/ir/IrCatchTo;)Lcom/apollographql/apollo3/compiler/ir/IrType; + public static final fun maybeError (Lcom/apollographql/apollo3/compiler/ir/IrType;Z)Lcom/apollographql/apollo3/compiler/ir/IrType; public static final fun nullable (Lcom/apollographql/apollo3/compiler/ir/IrType;Z)Lcom/apollographql/apollo3/compiler/ir/IrType; public static final fun optional (Lcom/apollographql/apollo3/compiler/ir/IrType;Z)Lcom/apollographql/apollo3/compiler/ir/IrType; } From 466df994cd291ebbab25327f50e8818495d5e8f3 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 14:13:03 +0100 Subject: [PATCH 24/42] fix ParserTest --- .../com/apollographql/apollo3/graphql/ast/test/ParserTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt b/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt index b04b340edf8..660a3ae840b 100644 --- a/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt +++ b/libraries/apollo-ast/src/jvmTest/kotlin/com/apollographql/apollo3/graphql/ast/test/ParserTest.kt @@ -48,7 +48,7 @@ class ParserTest { } private fun testFilterMatches(value: String): Boolean { - val testFilter = System.getenv("testFilter") ?: true + val testFilter = System.getenv("testFilter") ?: return true return Regex(testFilter).containsMatchIn(value) } From 411c64be358e189b81a90593fdd9065e4ffa96e7 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 14:35:39 +0100 Subject: [PATCH 25/42] fix tests --- tests/catch/src/main/graphql/null/operations.graphql | 2 +- tests/catch/src/main/graphql/shared/schema.graphqls | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/catch/src/main/graphql/null/operations.graphql b/tests/catch/src/main/graphql/null/operations.graphql index 703bd1aab47..db046cee5bc 100644 --- a/tests/catch/src/main/graphql/null/operations.graphql +++ b/tests/catch/src/main/graphql/null/operations.graphql @@ -1,5 +1,5 @@ query ProductThrow { product @catch(to: THROW) { - price + price @catch(to: THROW) } } diff --git a/tests/catch/src/main/graphql/shared/schema.graphqls b/tests/catch/src/main/graphql/shared/schema.graphqls index 02112bb5455..bd1f42af6b8 100644 --- a/tests/catch/src/main/graphql/shared/schema.graphqls +++ b/tests/catch/src/main/graphql/shared/schema.graphqls @@ -1,11 +1,5 @@ extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: ["@semanticNonNull", "@catch", "CatchTo"]) -enum CatchTo { - NULL, - THROW, - RESULT, -} - type Query { nullable: Int semanticNonNull: Int @semanticNonNull From 23e753b72f71a996686992a785d99f7c5c1ba66d Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 15:25:36 +0100 Subject: [PATCH 26/42] FieldResult.error -> FieldResult.exception --- libraries/apollo-api/api/apollo-api.api | 11 +++++----- .../com/apollographql/apollo3/api/Adapters.kt | 2 +- .../apollographql/apollo3/api/FieldResult.kt | 13 ++++++----- .../src/test/kotlin/test/CatchNullTest.kt | 4 ++-- .../src/test/kotlin/test/CatchResultTest.kt | 22 +++++++++---------- tests/catch/src/test/kotlin/test/CatchTest.kt | 7 +++--- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index a4e7dd7bf4b..cb5fd564d8d 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -606,9 +606,9 @@ public final class com/apollographql/apollo3/api/FakeResolverKt { public abstract interface class com/apollographql/apollo3/api/FieldResult { } -public final class com/apollographql/apollo3/api/FieldResult$Error : com/apollographql/apollo3/api/FieldResult { - public fun (Lcom/apollographql/apollo3/api/Error;)V - public final fun getError ()Lcom/apollographql/apollo3/api/Error; +public final class com/apollographql/apollo3/api/FieldResult$Failure : com/apollographql/apollo3/api/FieldResult { + public fun (Lcom/apollographql/apollo3/exception/ApolloException;)V + public final fun getException ()Lcom/apollographql/apollo3/exception/ApolloException; } public final class com/apollographql/apollo3/api/FieldResult$Success : com/apollographql/apollo3/api/FieldResult { @@ -617,10 +617,11 @@ public final class com/apollographql/apollo3/api/FieldResult$Success : com/apoll } public final class com/apollographql/apollo3/api/FieldResultKt { - public static final fun getErrorOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Lcom/apollographql/apollo3/api/Error; + public static final fun exceptionOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Exception; public static final fun getOrElse (Lcom/apollographql/apollo3/api/FieldResult;Ljava/lang/Object;)Ljava/lang/Object; - public static final fun getValueOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; + public static final fun graphQLErrorOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Lcom/apollographql/apollo3/api/Error; public static final fun isSuccess (Lcom/apollographql/apollo3/api/FieldResult;)Z + public static final fun valueOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; public static final fun valueOrThrow (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index fd7ced96428..962f7f6393f 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -386,7 +386,7 @@ class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter< return try { FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) } catch (e: ApolloGraphQLException) { - FieldResult.Error(e.error) + FieldResult.Failure(ApolloGraphQLException(e.error)) } } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt index 4176d9a0146..cf4c0519a85 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt @@ -1,20 +1,23 @@ package com.apollographql.apollo3.api +import com.apollographql.apollo3.exception.ApolloException import com.apollographql.apollo3.exception.ApolloGraphQLException +import com.apollographql.apollo3.exception.DefaultApolloException sealed interface FieldResult { class Success(val value: V) : FieldResult - class Error(val error: com.apollographql.apollo3.api.Error) : FieldResult + class Failure(val exception: ApolloException) : FieldResult } -fun FieldResult.getOrElse(fallback: V): V = if (this is FieldResult.Success) value else fallback val FieldResult.isSuccess: Boolean get() = this is FieldResult.Success -val FieldResult.valueOrNull: V? get() = if (this is FieldResult.Success) value else null -val FieldResult.errorOrNull: Error? get() = if (this is FieldResult.Error) error else null +fun FieldResult.getOrElse(fallback: V): V = if (this is FieldResult.Success) value else fallback +fun FieldResult.valueOrNull(): V? = if (this is FieldResult.Success) value else null +fun FieldResult.exceptionOrNull(): Exception? = if (this is FieldResult.Failure) exception else null +fun FieldResult.graphQLErrorOrNull(): Error? = (exceptionOrNull() as? ApolloGraphQLException)?.error fun FieldResult.valueOrThrow(): V { return when (this) { is FieldResult.Success -> value - is FieldResult.Error -> throw ApolloGraphQLException(error) + is FieldResult.Failure -> throw DefaultApolloException("Field error", exception) } } diff --git a/tests/catch/src/test/kotlin/test/CatchNullTest.kt b/tests/catch/src/test/kotlin/test/CatchNullTest.kt index 32563e0d1e1..5249b41b4b9 100644 --- a/tests/catch/src/test/kotlin/test/CatchNullTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchNullTest.kt @@ -31,7 +31,7 @@ class CatchNullTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertNull(response.data?.user?.valueOrNull?.name) + assertNull(response.data?.user?.valueOrNull()?.name) } @Test @@ -83,7 +83,7 @@ class CatchNullTest { fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertNull(null, response.data?.product?.valueOrNull?.price) + assertNull(null, response.data?.product?.valueOrNull()?.price) } @Test diff --git a/tests/catch/src/test/kotlin/test/CatchResultTest.kt b/tests/catch/src/test/kotlin/test/CatchResultTest.kt index d488fac13a0..055dbe78daf 100644 --- a/tests/catch/src/test/kotlin/test/CatchResultTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchResultTest.kt @@ -1,6 +1,6 @@ package test -import com.apollographql.apollo3.api.errorOrNull +import com.apollographql.apollo3.api.graphQLErrorOrNull import com.apollographql.apollo3.api.valueOrNull import com.apollographql.apollo3.api.valueOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException @@ -31,35 +31,35 @@ class CatchResultTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data?.user?.valueOrNull?.name?.errorOrNull?.message) + assertEquals("cannot resolve name", response.data?.user?.valueOrNull()?.name?.graphQLErrorOrNull()?.message) } @Test fun userNullOnUserNameError() { val response = UserNullQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data!!.user?.name?.errorOrNull?.message) + assertEquals("cannot resolve name", response.data!!.user?.name?.graphQLErrorOrNull()?.message) } @Test fun userOnUserSuccess() { val response = UserQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user.valueOrNull?.name?.valueOrNull) + assertEquals("Pancakes", response.data!!.user.valueOrNull()?.name?.valueOrNull()) } @Test fun userResultOnUserSuccess() { val response = UserResultQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user.valueOrThrow().name.valueOrNull) + assertEquals("Pancakes", response.data!!.user.valueOrThrow().name.valueOrNull()) } @Test fun userNullOnUserSuccess() { val response = UserNullQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user!!.name.valueOrNull) + assertEquals("Pancakes", response.data!!.user!!.name.valueOrNull()) } @Test @@ -75,14 +75,14 @@ class CatchResultTest { fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertEquals("cannot resolve price", response.data?.product?.valueOrNull?.price?.errorOrNull?.message) + assertEquals("cannot resolve price", response.data?.product?.valueOrNull()?.price?.graphQLErrorOrNull()?.message) } @Test fun productNullOnProductPriceError() { val response = ProductNullQuery().parseResponse(productPriceError) - assertEquals("cannot resolve price", response.data?.product?.price?.errorOrNull?.message) + assertEquals("cannot resolve price", response.data?.product?.price?.graphQLErrorOrNull()?.message) assertNotNull(response.data) } @@ -91,7 +91,7 @@ class CatchResultTest { val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull?.price?.valueOrNull) + assertNull(response.data?.product?.valueOrNull()?.price?.valueOrNull()) assertEquals("cannot resolve price", response.errors?.single()?.message) } @@ -100,7 +100,7 @@ class CatchResultTest { val response = PriceNullQuery().parseResponse(productPriceError) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull?.price) + assertNull(response.data?.product?.valueOrNull()?.price) assertEquals("cannot resolve price", response.errors?.single()?.message) } @@ -109,7 +109,7 @@ class CatchResultTest { val response = PriceNullQuery().parseResponse(productPriceNull) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull?.price) + assertNull(response.data?.product?.valueOrNull()?.price) assertNull(response.errors) } } diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index f05303a86b9..7eda9675fa9 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -3,7 +3,8 @@ package test import com.apollographql.apollo3.api.ApolloResponse import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.Query -import com.apollographql.apollo3.api.errorOrNull +import com.apollographql.apollo3.api.exceptionOrNull +import com.apollographql.apollo3.api.graphQLErrorOrNull import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse @@ -38,7 +39,7 @@ class CatchTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data?.user?.errorOrNull?.message) + assertEquals("cannot resolve name", response.data?.user?.graphQLErrorOrNull()?.message) } @Test @@ -82,7 +83,7 @@ class CatchTest { fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertEquals("cannot resolve price", response.data?.product?.errorOrNull?.message) + assertEquals("cannot resolve price", response.data?.product?.graphQLErrorOrNull()?.message) } @Test From 29c413d3fad498269f81283b7a1d60d1a13b1305 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 15:52:48 +0100 Subject: [PATCH 27/42] update message --- .../kotlin/com/apollographql/apollo3/api/Assertions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Assertions.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Assertions.kt index dfae5835e49..ca9f0351306 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Assertions.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Assertions.kt @@ -13,7 +13,7 @@ import kotlin.jvm.JvmName */ fun checkFieldNotMissing(value: Any?, name: String) { if (value == null) { - throw DefaultApolloException("Field '$name' is missing") + throw DefaultApolloException("Field '$name' is missing or null") } } @@ -35,5 +35,5 @@ fun assertOneOf(vararg args: Optional<*>) { * Helper function for the Kotlin codegen */ fun missingField(jsonReader: JsonReader, name: String): Nothing { - throw DefaultApolloException("Field '$name' is missing at path ${jsonReader.getPath()}") + throw DefaultApolloException("Field '$name' is missing or null at path ${jsonReader.getPath()}") } From fd899d459a0c8fa3f6ece6b9ae2c4ccf74fadc99 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 30 Nov 2023 17:06:53 +0100 Subject: [PATCH 28/42] simpler --- libraries/apollo-api/api/apollo-api.api | 4 +--- .../kotlin/com/apollographql/apollo3/api/Adapters.kt | 2 +- .../apollo3/api/CustomScalarAdapters.kt | 12 +----------- .../com/apollographql/apollo3/api/Executables.kt | 3 +-- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index cb5fd564d8d..f6c8275999f 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -401,8 +401,7 @@ public final class com/apollographql/apollo3/api/CustomScalarAdapters : com/apol public final field deferredFragmentIdentifiers Ljava/util/Set; public final field errors Ljava/util/List; public final field falseVariables Ljava/util/Set; - public final field ignoreErrors Z - public synthetic fun (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun adapterFor (Ljava/lang/String;)Lcom/apollographql/apollo3/api/Adapter; public fun getKey ()Lcom/apollographql/apollo3/api/ExecutionContext$Key; public final fun newBuilder ()Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; @@ -419,7 +418,6 @@ public final class com/apollographql/apollo3/api/CustomScalarAdapters$Builder { public final fun deferredFragmentIdentifiers (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; public final fun errors (Ljava/util/List;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; public final fun falseVariables (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; - public final fun ignoreErrors (Z)Lcom/apollographql/apollo3/api/CustomScalarAdapters$Builder; } public final class com/apollographql/apollo3/api/CustomScalarAdapters$Key : com/apollographql/apollo3/api/ExecutionContext$Key { diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index 962f7f6393f..b6616877d59 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -400,7 +400,7 @@ class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter< class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Adapter { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { - if (!customScalarAdapters.ignoreErrors && reader.peek() == JsonReader.Token.NULL) { + if (reader.peek() == JsonReader.Token.NULL) { val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) if (error != null) { reader.skipValue() diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt index cf555bbbf61..b699b3dc92a 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt @@ -27,11 +27,7 @@ class CustomScalarAdapters private constructor( */ @JvmField val errors: List?, - /** - * Whether to ignore errors for backward compatibility purposes - */ - @JvmField - val ignoreErrors: Boolean, + private val unsafe: Boolean, ) : ExecutionContext.Element { @@ -138,7 +134,6 @@ class CustomScalarAdapters private constructor( private var falseVariables: Set? = null private var deferredFragmentIdentifiers: Set? = null private var errors: List? = null - private var ignoreErrors: Boolean = false fun falseVariables(falseVariables: Set?) = apply { this.falseVariables = falseVariables @@ -152,10 +147,6 @@ class CustomScalarAdapters private constructor( this.errors = errors } - fun ignoreErrors(ignoreErrors: Boolean) = apply { - this.ignoreErrors = ignoreErrors - } - fun add( name: String, adapter: Adapter, @@ -190,7 +181,6 @@ class CustomScalarAdapters private constructor( falseVariables, deferredFragmentIdentifiers, errors, - ignoreErrors, unsafe, ) } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt index 8e981aaddc3..0a4e3606961 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Executables.kt @@ -77,8 +77,7 @@ fun Executable.parseData( val customScalarAdapters1 = customScalarAdapters.newBuilder() .falseVariables(falseVariables) .deferredFragmentIdentifiers(deferredFragmentIds) - .errors(errors) - .ignoreErrors(ignoreErrors) + .errors(if (ignoreErrors) emptyList() else errors) .build() return adapter().nullable().fromJson(jsonReader, customScalarAdapters1) } From 2fe76c37596547335b07b09cc8e8d960239a62ff Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 11:48:16 +0100 Subject: [PATCH 29/42] Update libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt Co-authored-by: Benoit Lubek --- .../kotlin/com/apollographql/apollo3/api/Adapters.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index b6616877d59..9dd9415500e 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -444,11 +444,11 @@ fun Adapter.list() = ListAdapter(this) @JvmName("-obj") fun Adapter.obj(buffered: Boolean = false) = ObjectAdapter(this, buffered) -@JvmName("-result") +@JvmName("-catchToResult") fun Adapter.catchToResult() = CatchToResultAdapter(this) @JvmName("-errorAware") fun Adapter.errorAware() = ErrorAwareAdapter(this) -@JvmName("-orNull") +@JvmName("-catchToNull") fun Adapter.catchToNull() = CatchToNullAdapter(this) \ No newline at end of file From 402d4d7355eb8c33fcdbf1517db1f054007f71e5 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 11:48:33 +0100 Subject: [PATCH 30/42] Update libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt Co-authored-by: Benoit Lubek --- .../kotlin/com/apollographql/apollo3/ast/gqldirective.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index 9cef31699cf..45a07771ed2 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -75,6 +75,7 @@ fun List.optionalValue(schema: Schema?): Boolean? { @ApolloInternal fun List.findNonnull(schema: Schema) = any { schema.originalDirectiveName(it.name) == Schema.NONNULL } +@ApolloInternal enum class CatchTo { RESULT, NULL, From 1a1ffe307cd6cade3b89e9d206ba7d706f036f11 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 11:49:18 +0100 Subject: [PATCH 31/42] Update libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt Co-authored-by: Benoit Lubek --- .../com/apollographql/apollo3/ast/internal/definitions.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 1aaf592434a..7f4bde78305 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -301,10 +301,8 @@ Indicates that the given position stops GraphQL errors to propagate up the tree. By default, the first GraphQL error stops the parsing and fails the whole response. Using `@catch` recovers from this error and allows the parsing to continue. -`@catch` can be used on the schema definition. In this case, it is the default for -every field that can return an error (nullable fields). -If no `@catch` is applied to the schema definition, errors are not -caught by default and the parsing stops at the first error. +`@catch` must also be applied to the schema definition to specify the default to +use for every field that can return an error (nullable fields). The `to` argument can be used to choose how to recover from errors. See `CatchTo` for more details. From e3d6fae30317d00346cb2036ff409d53dfc2972d Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 11:53:00 +0100 Subject: [PATCH 32/42] nooe -> semanticNonNull --- .../apollographql/apollo3/ast/gqldirective.kt | 4 +-- .../compiler/ir/IrOperationsBuilder.kt | 28 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt index 45a07771ed2..c280bf7332a 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldirective.kt @@ -148,7 +148,7 @@ fun List.findCatches(schema: Schema): List { } @ApolloInternal -fun GQLFieldDefinition.findNooeLevels(schema: Schema): List { +fun GQLFieldDefinition.findSemanticNonNulls(schema: Schema): List { return directives.filter { schema.originalDirectiveName(it.name) == Schema.SEMANTIC_NON_NULL }.map { @@ -157,7 +157,7 @@ fun GQLFieldDefinition.findNooeLevels(schema: Schema): List { } @ApolloInternal -fun GQLTypeDefinition.findNooeLevels(fieldName: String, schema: Schema): List { +fun GQLTypeDefinition.findSemanticNonNulls(fieldName: String, schema: Schema): List { return directives.filter { schema.originalDirectiveName(it.name) == Schema.SEMANTIC_NON_NULL && it.getArgument("field", schema)?.toStringOrNull() == fieldName diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 2eb28a6f0c0..8873a41b081 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -37,8 +37,8 @@ import com.apollographql.apollo3.ast.fieldDefinitions import com.apollographql.apollo3.ast.findCatches import com.apollographql.apollo3.ast.findDeprecationReason import com.apollographql.apollo3.ast.findNonnull -import com.apollographql.apollo3.ast.findNooeLevels import com.apollographql.apollo3.ast.findOptInFeature +import com.apollographql.apollo3.ast.findSemanticNonNulls import com.apollographql.apollo3.ast.isFieldNonNull import com.apollographql.apollo3.ast.optionalValue import com.apollographql.apollo3.ast.pretty @@ -483,7 +483,7 @@ internal class IrOperationsBuilder( val type: GQLType, val deprecationReason: String?, val optInFeature: String?, - val nooes: List, + val semanticNonNulls: List, val catches: List, val forceOptional: Boolean, @@ -507,29 +507,29 @@ internal class IrOperationsBuilder( "cannot find field definition for field '${gqlField.responseName()}' of type '${parentTypeDefinition.name}'" } - var nooeLevels = fieldDefinition.findNooeLevels(schema) + var semanticNonNulls = fieldDefinition.findSemanticNonNulls(schema) - parentTypeDefinition.findNooeLevels(gqlField.name, schema).let { + parentTypeDefinition.findSemanticNonNulls(gqlField.name, schema).let { if (it.isNotEmpty()) { - check(nooeLevels.isEmpty()) { + check(semanticNonNulls.isEmpty()) { "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @semanticNonNull) in the schema." } - nooeLevels = it + semanticNonNulls = it } } if (parentTypeDefinition.isFieldNonNull(gqlField.name, schema)) { - check(nooeLevels.isEmpty()) { + check(semanticNonNulls.isEmpty()) { "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @semanticNonNull) in the schema." } - nooeLevels = listOf(0) + semanticNonNulls = listOf(0) } if (gqlField.directives.findNonnull(schema)) { - check(nooeLevels.isEmpty()) { + check(semanticNonNulls.isEmpty()) { "${gqlField.sourceLocation}: field '${gqlField.responseName()}' already has nullability annotations (@nonnull, @semanticNonNull) in the schema." } - nooeLevels = listOf(0) + semanticNonNulls = listOf(0) } CollectedField( @@ -541,7 +541,7 @@ internal class IrOperationsBuilder( description = fieldDefinition.description, deprecationReason = fieldDefinition.directives.findDeprecationReason(), optInFeature = fieldDefinition.directives.findOptInFeature(schema), - nooes = nooeLevels, + semanticNonNulls = semanticNonNulls, forceOptional = gqlField.directives.optionalValue(schema) == true, parentType = fieldWithParent.parentType, catches = gqlField.directives.findCatches(schema) @@ -614,7 +614,7 @@ internal class IrOperationsBuilder( .type .toIr() // Apply the schema transformations - .nooe(first.nooes, 0) + .semanticNonNull(first.semanticNonNulls, 0) .let { /** * We map @optional fields to nullable fields. This probably needs to be revisited in light of @catch @@ -676,12 +676,12 @@ internal class IrOperationsBuilder( } companion object { - private fun IrType.nooe(semanticNonNullLevels: List, level: Int): IrType { + private fun IrType.semanticNonNull(semanticNonNullLevels: List, level: Int): IrType { val isNonNull = semanticNonNullLevels.any { it == null || it == level } return when (this) { is IrNamedType -> this - is IrListType -> copy(ofType = ofType.nooe(semanticNonNullLevels, level + 1)) + is IrListType -> copy(ofType = ofType.semanticNonNull(semanticNonNullLevels, level + 1)) }.let { if (isNonNull) { it.nullable(false) From e92a2a67f59c339ec458281a133e9cc57d0d1796 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 11:53:34 +0100 Subject: [PATCH 33/42] fix bad copy paste --- .../apollo3/ast/internal/ExecutableValidationScope.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt index 82bedbcbb43..3b28bd6e219 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/ExecutableValidationScope.kt @@ -193,7 +193,6 @@ internal class ExecutableValidationScope( type = type.type } is GQLNonNullType -> { - dimension++ type = type.type } else -> return dimension From da4a0ad15ed3aeafbe45831578f111b5b4791b36 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:03:16 +0100 Subject: [PATCH 34/42] update apiDump --- libraries/apollo-api/api/apollo-api.api | 4 ++-- libraries/apollo-ast/api/apollo-ast.api | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index f6c8275999f..e66c8b85a5f 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -22,15 +22,15 @@ public final class com/apollographql/apollo3/api/Adapters { public static final field NullableStringAdapter Lcom/apollographql/apollo3/api/NullableAdapter; public static final field StringAdapter Lcom/apollographql/apollo3/api/Adapter; public static final field UploadAdapter Lcom/apollographql/apollo3/api/Adapter; + public static final fun -catchToNull (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToNullAdapter; + public static final fun -catchToResult (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToResultAdapter; public static final fun -errorAware (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ErrorAwareAdapter; public static final fun -list (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ListAdapter; public static final fun -nullable (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/NullableAdapter; public static final fun -obj (Lcom/apollographql/apollo3/api/Adapter;Z)Lcom/apollographql/apollo3/api/ObjectAdapter; public static synthetic fun -obj$default (Lcom/apollographql/apollo3/api/Adapter;ZILjava/lang/Object;)Lcom/apollographql/apollo3/api/ObjectAdapter; public static final fun -optional (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; - public static final fun -orNull (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToNullAdapter; public static final fun -present (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; - public static final fun -result (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToResultAdapter; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;)Ljava/lang/String; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/String; public static final fun -toJson (Lcom/apollographql/apollo3/api/Adapter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/String;)Ljava/lang/String; diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index f29a765c146..7f9ffca94bf 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -34,15 +34,6 @@ public final class com/apollographql/apollo3/ast/ApolloParser { public static synthetic fun toGQLValue$default (Ljava/lang/String;Lcom/apollographql/apollo3/ast/ParserOptions;ILjava/lang/Object;)Lcom/apollographql/apollo3/ast/GQLValue; } -public final class com/apollographql/apollo3/ast/CatchTo : java/lang/Enum { - public static final field NULL Lcom/apollographql/apollo3/ast/CatchTo; - public static final field RESULT Lcom/apollographql/apollo3/ast/CatchTo; - public static final field THROW Lcom/apollographql/apollo3/ast/CatchTo; - public static fun getEntries ()Lkotlin/enums/EnumEntries; - public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo3/ast/CatchTo; - public static fun values ()[Lcom/apollographql/apollo3/ast/CatchTo; -} - public final class com/apollographql/apollo3/ast/ConditionalFragment : com/apollographql/apollo3/ast/ApolloIssue { public fun (Ljava/lang/String;Lcom/apollographql/apollo3/ast/SourceLocation;)V public fun getMessage ()Ljava/lang/String; From a5f4d7428d23df5439ca78868017aad843a16d53 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:05:20 +0100 Subject: [PATCH 35/42] hide some more symbol --- libraries/apollo-api/api/apollo-api.api | 26 +++---------------- .../com/apollographql/apollo3/api/Adapters.kt | 12 ++++----- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index e66c8b85a5f..f1d5640fab4 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -22,9 +22,9 @@ public final class com/apollographql/apollo3/api/Adapters { public static final field NullableStringAdapter Lcom/apollographql/apollo3/api/NullableAdapter; public static final field StringAdapter Lcom/apollographql/apollo3/api/Adapter; public static final field UploadAdapter Lcom/apollographql/apollo3/api/Adapter; - public static final fun -catchToNull (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToNullAdapter; - public static final fun -catchToResult (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/CatchToResultAdapter; - public static final fun -errorAware (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ErrorAwareAdapter; + public static final fun -catchToNull (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/Adapter; + public static final fun -catchToResult (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/Adapter; + public static final fun -errorAware (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/Adapter; public static final fun -list (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ListAdapter; public static final fun -nullable (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/NullableAdapter; public static final fun -obj (Lcom/apollographql/apollo3/api/Adapter;Z)Lcom/apollographql/apollo3/api/ObjectAdapter; @@ -261,20 +261,6 @@ public abstract interface class com/apollographql/apollo3/api/BuilderScope { public abstract fun getCustomScalarAdapters ()Lcom/apollographql/apollo3/api/CustomScalarAdapters; } -public final class com/apollographql/apollo3/api/CatchToNullAdapter : com/apollographql/apollo3/api/Adapter { - public fun (Lcom/apollographql/apollo3/api/Adapter;)V - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - -public final class com/apollographql/apollo3/api/CatchToResultAdapter : com/apollographql/apollo3/api/Adapter { - public fun (Lcom/apollographql/apollo3/api/Adapter;)V - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lcom/apollographql/apollo3/api/FieldResult; - public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Lcom/apollographql/apollo3/api/FieldResult;)V - public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - public final class com/apollographql/apollo3/api/CompiledArgument { public synthetic fun (Ljava/lang/String;Lcom/apollographql/apollo3/api/Optional;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getName ()Ljava/lang/String; @@ -511,12 +497,6 @@ public final class com/apollographql/apollo3/api/Error$Location { public fun toString ()Ljava/lang/String; } -public final class com/apollographql/apollo3/api/ErrorAwareAdapter : com/apollographql/apollo3/api/Adapter { - public fun (Lcom/apollographql/apollo3/api/Adapter;)V - public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Ljava/lang/Object; - public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/lang/Object;)V -} - public abstract interface class com/apollographql/apollo3/api/Executable { public abstract fun adapter ()Lcom/apollographql/apollo3/api/Adapter; public abstract fun getIgnoreErrors ()Z diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index 9dd9415500e..6fd0db274d9 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -381,7 +381,7 @@ class ObjectAdapter( } } -class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter> { +private class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): FieldResult { return try { FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) @@ -398,7 +398,7 @@ class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter< } } -class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Adapter { +private class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Adapter { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { if (reader.peek() == JsonReader.Token.NULL) { val error = customScalarAdapters.firstErrorStartingWith(reader.getPath()) @@ -416,7 +416,7 @@ class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Adapter } } -class CatchToNullAdapter(private val wrappedAdapter: Adapter) : Adapter<@JvmSuppressWildcards T?> { +private class CatchToNullAdapter(private val wrappedAdapter: Adapter) : Adapter<@JvmSuppressWildcards T?> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T? { return try { wrappedAdapter.fromJson(reader, customScalarAdapters) @@ -445,10 +445,10 @@ fun Adapter.list() = ListAdapter(this) fun Adapter.obj(buffered: Boolean = false) = ObjectAdapter(this, buffered) @JvmName("-catchToResult") -fun Adapter.catchToResult() = CatchToResultAdapter(this) +fun Adapter.catchToResult(): Adapter> = CatchToResultAdapter(this) @JvmName("-errorAware") -fun Adapter.errorAware() = ErrorAwareAdapter(this) +fun Adapter.errorAware(): Adapter = ErrorAwareAdapter(this) @JvmName("-catchToNull") -fun Adapter.catchToNull() = CatchToNullAdapter(this) \ No newline at end of file +fun Adapter.catchToNull(): Adapter = CatchToNullAdapter(this) \ No newline at end of file From adf97ffd1ccb1401cdcb232d2efaecf8ab3948b1 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:07:47 +0100 Subject: [PATCH 36/42] allow to catch non-ApolloGraphQLException --- .../kotlin/com/apollographql/apollo3/api/Adapters.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index 6fd0db274d9..f003425b701 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.json.MapJsonWriter import com.apollographql.apollo3.api.json.buildJsonString import com.apollographql.apollo3.api.json.readAny import com.apollographql.apollo3.api.json.writeAny +import com.apollographql.apollo3.exception.ApolloException import com.apollographql.apollo3.exception.ApolloGraphQLException import kotlin.jvm.JvmField import kotlin.jvm.JvmName @@ -385,8 +386,8 @@ private class CatchToResultAdapter(private val wrappedAdapter: Adapter) : override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): FieldResult { return try { FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) - } catch (e: ApolloGraphQLException) { - FieldResult.Failure(ApolloGraphQLException(e.error)) + } catch (e: ApolloException) { + FieldResult.Failure(e) } } @@ -420,7 +421,7 @@ private class CatchToNullAdapter(private val wrappedAdapter: Adapter) : Ad override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T? { return try { wrappedAdapter.fromJson(reader, customScalarAdapters) - } catch (e: ApolloGraphQLException) { + } catch (e: ApolloException) { null } } From 5f803f21b02b897c985fd728c6dc3ff454e0b6f3 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:12:26 +0100 Subject: [PATCH 37/42] comment + reorder code --- .../com/apollographql/apollo3/api/Adapters.kt | 34 +++++++++---------- .../apollo3/api/CustomScalarAdapters.kt | 1 + 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index f003425b701..6aaa6608068 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -382,23 +382,6 @@ class ObjectAdapter( } } -private class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter> { - override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): FieldResult { - return try { - FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) - } catch (e: ApolloException) { - FieldResult.Failure(e) - } - } - - override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: FieldResult) { - when (value) { - is FieldResult.Success -> wrappedAdapter.toJson(writer, customScalarAdapters, value.valueOrThrow()) - else -> Unit // ignore errors - } - } -} - private class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Adapter { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { if (reader.peek() == JsonReader.Token.NULL) { @@ -417,6 +400,23 @@ private class ErrorAwareAdapter(private val wrappedAdapter: Adapter) : Ada } } +private class CatchToResultAdapter(private val wrappedAdapter: Adapter) : Adapter> { + override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): FieldResult { + return try { + FieldResult.Success(wrappedAdapter.fromJson(reader, customScalarAdapters)) + } catch (e: ApolloException) { + FieldResult.Failure(e) + } + } + + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: FieldResult) { + when (value) { + is FieldResult.Success -> wrappedAdapter.toJson(writer, customScalarAdapters, value.valueOrThrow()) + else -> Unit // ignore errors + } + } +} + private class CatchToNullAdapter(private val wrappedAdapter: Adapter) : Adapter<@JvmSuppressWildcards T?> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T? { return try { diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt index b699b3dc92a..b2e42b50301 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CustomScalarAdapters.kt @@ -111,6 +111,7 @@ class CustomScalarAdapters private constructor( } private fun List.startsWith(responsePath: List): Boolean { + // start at 1 to drop the `data.` for (i in 1.until(responsePath.size)) { if (i - 1 >= this.size) { return false From 01fb5e50415061bf0360b21f4770326c07ef8b97 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:14:19 +0100 Subject: [PATCH 38/42] valueOrNull -> getOrNull for consistency --- libraries/apollo-api/api/apollo-api.api | 4 ++-- .../com/apollographql/apollo3/api/Adapters.kt | 2 +- .../apollographql/apollo3/api/FieldResult.kt | 4 ++-- .../src/test/kotlin/test/CatchNullTest.kt | 10 +++++----- .../src/test/kotlin/test/CatchResultTest.kt | 20 +++++++++---------- tests/catch/src/test/kotlin/test/CatchTest.kt | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index f1d5640fab4..d7fa9c75356 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -597,10 +597,10 @@ public final class com/apollographql/apollo3/api/FieldResult$Success : com/apoll public final class com/apollographql/apollo3/api/FieldResultKt { public static final fun exceptionOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Exception; public static final fun getOrElse (Lcom/apollographql/apollo3/api/FieldResult;Ljava/lang/Object;)Ljava/lang/Object; + public static final fun getOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; + public static final fun getOrThrow (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; public static final fun graphQLErrorOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Lcom/apollographql/apollo3/api/Error; public static final fun isSuccess (Lcom/apollographql/apollo3/api/FieldResult;)Z - public static final fun valueOrNull (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; - public static final fun valueOrThrow (Lcom/apollographql/apollo3/api/FieldResult;)Ljava/lang/Object; } public final class com/apollographql/apollo3/api/FileUpload { diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt index 6aaa6608068..9813775b440 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Adapters.kt @@ -411,7 +411,7 @@ private class CatchToResultAdapter(private val wrappedAdapter: Adapter) : override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: FieldResult) { when (value) { - is FieldResult.Success -> wrappedAdapter.toJson(writer, customScalarAdapters, value.valueOrThrow()) + is FieldResult.Success -> wrappedAdapter.toJson(writer, customScalarAdapters, value.getOrThrow()) else -> Unit // ignore errors } } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt index cf4c0519a85..e46772bae48 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/FieldResult.kt @@ -11,11 +11,11 @@ sealed interface FieldResult { val FieldResult.isSuccess: Boolean get() = this is FieldResult.Success fun FieldResult.getOrElse(fallback: V): V = if (this is FieldResult.Success) value else fallback -fun FieldResult.valueOrNull(): V? = if (this is FieldResult.Success) value else null +fun FieldResult.getOrNull(): V? = if (this is FieldResult.Success) value else null fun FieldResult.exceptionOrNull(): Exception? = if (this is FieldResult.Failure) exception else null fun FieldResult.graphQLErrorOrNull(): Error? = (exceptionOrNull() as? ApolloGraphQLException)?.error -fun FieldResult.valueOrThrow(): V { +fun FieldResult.getOrThrow(): V { return when (this) { is FieldResult.Success -> value is FieldResult.Failure -> throw DefaultApolloException("Field error", exception) diff --git a/tests/catch/src/test/kotlin/test/CatchNullTest.kt b/tests/catch/src/test/kotlin/test/CatchNullTest.kt index 5249b41b4b9..9f64d98a19a 100644 --- a/tests/catch/src/test/kotlin/test/CatchNullTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchNullTest.kt @@ -1,7 +1,7 @@ package test -import com.apollographql.apollo3.api.valueOrNull -import com.apollographql.apollo3.api.valueOrThrow +import com.apollographql.apollo3.api.getOrNull +import com.apollographql.apollo3.api.getOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException import `null`.PriceNullQuery import `null`.ProductIgnoreErrorsQuery @@ -31,7 +31,7 @@ class CatchNullTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertNull(response.data?.user?.valueOrNull()?.name) + assertNull(response.data?.user?.getOrNull()?.name) } @Test @@ -52,7 +52,7 @@ class CatchNullTest { fun userResultOnUserSuccess() { val response = UserResultQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user.valueOrThrow().name) + assertEquals("Pancakes", response.data!!.user.getOrThrow().name) } @Test @@ -83,7 +83,7 @@ class CatchNullTest { fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertNull(null, response.data?.product?.valueOrNull()?.price) + assertNull(null, response.data?.product?.getOrNull()?.price) } @Test diff --git a/tests/catch/src/test/kotlin/test/CatchResultTest.kt b/tests/catch/src/test/kotlin/test/CatchResultTest.kt index 055dbe78daf..14d7231b5bc 100644 --- a/tests/catch/src/test/kotlin/test/CatchResultTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchResultTest.kt @@ -1,8 +1,8 @@ package test import com.apollographql.apollo3.api.graphQLErrorOrNull -import com.apollographql.apollo3.api.valueOrNull -import com.apollographql.apollo3.api.valueOrThrow +import com.apollographql.apollo3.api.getOrNull +import com.apollographql.apollo3.api.getOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException import result.PriceNullQuery import result.ProductIgnoreErrorsQuery @@ -31,7 +31,7 @@ class CatchResultTest { fun userResultOnUserNameError() { val response = UserResultQuery().parseResponse(userNameError) - assertEquals("cannot resolve name", response.data?.user?.valueOrNull()?.name?.graphQLErrorOrNull()?.message) + assertEquals("cannot resolve name", response.data?.user?.getOrNull()?.name?.graphQLErrorOrNull()?.message) } @Test @@ -45,21 +45,21 @@ class CatchResultTest { fun userOnUserSuccess() { val response = UserQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user.valueOrNull()?.name?.valueOrNull()) + assertEquals("Pancakes", response.data!!.user.getOrNull()?.name?.getOrNull()) } @Test fun userResultOnUserSuccess() { val response = UserResultQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user.valueOrThrow().name.valueOrNull()) + assertEquals("Pancakes", response.data!!.user.getOrThrow().name.getOrNull()) } @Test fun userNullOnUserSuccess() { val response = UserNullQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user!!.name.valueOrNull()) + assertEquals("Pancakes", response.data!!.user!!.name.getOrNull()) } @Test @@ -75,7 +75,7 @@ class CatchResultTest { fun productResultOnProductPriceError() { val response = ProductResultQuery().parseResponse(productPriceError) - assertEquals("cannot resolve price", response.data?.product?.valueOrNull()?.price?.graphQLErrorOrNull()?.message) + assertEquals("cannot resolve price", response.data?.product?.getOrNull()?.price?.graphQLErrorOrNull()?.message) } @Test @@ -91,7 +91,7 @@ class CatchResultTest { val response = ProductIgnoreErrorsQuery().parseResponse(productPriceError) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull()?.price?.valueOrNull()) + assertNull(response.data?.product?.getOrNull()?.price?.getOrNull()) assertEquals("cannot resolve price", response.errors?.single()?.message) } @@ -100,7 +100,7 @@ class CatchResultTest { val response = PriceNullQuery().parseResponse(productPriceError) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull()?.price) + assertNull(response.data?.product?.getOrNull()?.price) assertEquals("cannot resolve price", response.errors?.single()?.message) } @@ -109,7 +109,7 @@ class CatchResultTest { val response = PriceNullQuery().parseResponse(productPriceNull) assertNotNull(response.data?.product) - assertNull(response.data?.product?.valueOrNull()?.price) + assertNull(response.data?.product?.getOrNull()?.price) assertNull(response.errors) } } diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchTest.kt index 7eda9675fa9..68e4840af5a 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -8,7 +8,7 @@ import com.apollographql.apollo3.api.graphQLErrorOrNull import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse -import com.apollographql.apollo3.api.valueOrThrow +import com.apollographql.apollo3.api.getOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException import default.PriceNullQuery import default.ProductIgnoreErrorsQuery @@ -60,7 +60,7 @@ class CatchTest { fun userResultOnUserSuccess() { val response = UserResultQuery().parseResponse(userSuccess) - assertEquals("Pancakes", response.data!!.user.valueOrThrow().name) + assertEquals("Pancakes", response.data!!.user.getOrThrow().name) } @Test From 3d5e6cfbabbf697746cdfdef65daa795d4899206 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:16:15 +0100 Subject: [PATCH 39/42] API visibility --- libraries/apollo-ast/api/apollo-ast.api | 4 ---- .../commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt | 3 ++- .../com/apollographql/apollo3/ast/internal/definitions.kt | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index 7f9ffca94bf..c9cfae34670 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -1054,10 +1054,6 @@ public final class com/apollographql/apollo3/ast/VariableUsage { public final fun isOneOfInputField ()Z } -public final class com/apollographql/apollo3/ast/internal/DefinitionsKt { - public static final fun getNullabilityDefinitionsStr ()Ljava/lang/String; -} - public final class com/apollographql/apollo3/ast/internal/SchemaValidationScopeKt { } diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt index 314ec3830a7..169a59d8995 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/Schema.kt @@ -204,8 +204,9 @@ class Schema internal constructor( const val NONNULL = "nonnull" const val OPTIONAL = "optional" const val REQUIRES_OPT_IN = "requiresOptIn" - const val CATCH = "catch" + @ApolloExperimental + const val CATCH = "catch" @ApolloExperimental const val SEMANTIC_NON_NULL = "semanticNonNull" @ApolloExperimental diff --git a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt index 7f4bde78305..a19448bbbd7 100644 --- a/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt +++ b/libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt @@ -256,7 +256,7 @@ internal val linkDefinitionsStr = """ ) repeatable on SCHEMA """.trimIndent() -val nullabilityDefinitionsStr = """ +internal val nullabilityDefinitionsStr = """ ""${'"'} Indicates that a field is only null if there is a matching error in the `errors` array. In all other cases, the field is non-null. From a28b6067ad910765193f8281fd6f1475731a8263 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:29:08 +0100 Subject: [PATCH 40/42] simplify code and does not generate errorAware() adapter wrappers for non-null types --- .../compiler/codegen/kotlin/KotlinCodeGen.kt | 14 +++++------- .../compiler/codegen/kotlin/KotlinResolver.kt | 22 +++++++------------ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt index 59215cdfaa5..0bf375d71b8 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinCodeGen.kt @@ -183,7 +183,7 @@ internal object KotlinCodeGen { val generateInputBuilders = kotlinCodegenOptions.generateInputBuilders val upstreamResolver = resolverInfos.fold(null as KotlinResolver?) { acc, resolverInfo -> - KotlinResolver(resolverInfo.entries, acc, scalarMapping, requiresOptInAnnotation, hooks, commonCodegenOptions.codegenSchema.schema.errorAware) + KotlinResolver(resolverInfo.entries, acc, scalarMapping, requiresOptInAnnotation, hooks) } val irSchema = commonCodegenOptions.irSchema @@ -205,8 +205,7 @@ internal object KotlinCodeGen { next = upstreamResolver, scalarMapping = scalarMapping, requiresOptInAnnotation = requiresOptInAnnotation, - hooks = hooks, - errorAware = commonCodegenOptions.codegenSchema.schema.errorAware + hooks = hooks ), targetLanguageVersion = targetLanguageVersion, ) @@ -341,8 +340,7 @@ internal object KotlinCodeGen { next = null, scalarMapping = codegenSchema.scalarMapping, requiresOptInAnnotation = null, - hooks = ApolloCompilerKotlinHooks.Identity, - errorAware = codegenSchema.schema.errorAware + hooks = ApolloCompilerKotlinHooks.Identity ), targetLanguageVersion = TargetLanguage.KOTLIN_1_9, ) @@ -397,8 +395,7 @@ internal object KotlinCodeGen { next = null, scalarMapping = codegenSchema.scalarMapping, requiresOptInAnnotation = null, - hooks = ApolloCompilerKotlinHooks.Identity, - errorAware = codegenSchema.schema.errorAware + hooks = ApolloCompilerKotlinHooks.Identity ) val context = KotlinContext( generateMethods = emptyList(), @@ -409,8 +406,7 @@ internal object KotlinCodeGen { next = upstreamResolver, scalarMapping = codegenSchema.scalarMapping, requiresOptInAnnotation = null, - hooks = ApolloCompilerKotlinHooks.Identity, - errorAware = codegenSchema.schema.errorAware + hooks = ApolloCompilerKotlinHooks.Identity ), targetLanguageVersion = TargetLanguage.KOTLIN_1_9, ) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt index 2290c043339..04ffe70ffa4 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/kotlin/KotlinResolver.kt @@ -27,6 +27,7 @@ import com.apollographql.apollo3.compiler.ir.IrScalarType2 import com.apollographql.apollo3.compiler.ir.IrType import com.apollographql.apollo3.compiler.ir.IrType2 import com.apollographql.apollo3.compiler.ir.catchTo +import com.apollographql.apollo3.compiler.ir.maybeError import com.apollographql.apollo3.compiler.ir.nullable import com.apollographql.apollo3.compiler.ir.optional import com.squareup.kotlinpoet.ClassName @@ -43,7 +44,6 @@ internal class KotlinResolver( private val scalarMapping: Map, private val requiresOptInAnnotation: String?, private val hooks: ApolloCompilerKotlinHooks, - private val errorAware: Boolean, ) { fun resolve(key: ResolverKey): ClassName? = hooks.overrideResolvedType(key, classNames[key] ?: next?.resolve(key)) @@ -79,17 +79,13 @@ internal class KotlinResolver( classNames.put(ResolverKey(kind, id), ClassName(memberName.packageName, memberName.simpleName)) } - private fun IrType.removeCatchTo(): IrType { - return catchTo(IrCatchTo.NoCatch) - } - internal fun resolveIrType(type: IrType, jsExport: Boolean, isInterface: Boolean = false): TypeName { return when { type.optional -> { KotlinSymbols.Optional.parameterizedBy(resolveIrType(type.optional(false), jsExport, isInterface)) } type.catchTo != IrCatchTo.NoCatch -> { - resolveIrType(type.removeCatchTo(), jsExport, isInterface).let { + resolveIrType(type.catchTo(IrCatchTo.NoCatch), jsExport, isInterface).let { when (type.catchTo) { IrCatchTo.Null -> it.copy(nullable = true) IrCatchTo.Result -> KotlinSymbols.FieldResult.parameterizedBy(it) @@ -199,17 +195,15 @@ internal class KotlinResolver( is IrCompositeType2 -> null } } + internal fun adapterInitializer(type: IrType, requiresBuffering: Boolean, jsExport: Boolean, runtimeAdapterPrefix: String): CodeBlock { - return adapterInitializerInternal(type, requiresBuffering, jsExport, runtimeAdapterPrefix, errorAware) - } - internal fun adapterInitializerInternal(type: IrType, requiresBuffering: Boolean, jsExport: Boolean, runtimeAdapterPrefix: String, errorAware: Boolean): CodeBlock { return when { type.optional -> { val presentFun = MemberName("com.apollographql.apollo3.api", "present") - CodeBlock.of("%L.%M()", adapterInitializerInternal(type.optional(false), requiresBuffering, jsExport, runtimeAdapterPrefix, errorAware), presentFun) + CodeBlock.of("%L.%M()", adapterInitializer(type.optional(false), requiresBuffering, jsExport, runtimeAdapterPrefix), presentFun) } type.catchTo != IrCatchTo.NoCatch -> { - adapterInitializerInternal(type.removeCatchTo(), requiresBuffering, jsExport, runtimeAdapterPrefix, errorAware).let { + adapterInitializer(type.catchTo(IrCatchTo.NoCatch), requiresBuffering, jsExport, runtimeAdapterPrefix).let { val member = when (type.catchTo) { IrCatchTo.Null -> KotlinSymbols.catchToNull IrCatchTo.Result -> KotlinSymbols.catchToResult @@ -218,8 +212,8 @@ internal class KotlinResolver( CodeBlock.of("%L.%M()", it, member) } } - errorAware -> { - adapterInitializerInternal(type.removeCatchTo(), requiresBuffering, jsExport, runtimeAdapterPrefix, false).let { + type.maybeError -> { + adapterInitializer(type.maybeError(false), requiresBuffering, jsExport, runtimeAdapterPrefix).let { CodeBlock.of("%L.%M()", it, KotlinSymbols.errorAware) } } @@ -238,7 +232,7 @@ internal class KotlinResolver( else -> { val nullableFun = MemberName("com.apollographql.apollo3.api", "nullable") - CodeBlock.of("%L.%M()", adapterInitializerInternal(type.nullable(false), requiresBuffering, jsExport, runtimeAdapterPrefix, false), nullableFun) + CodeBlock.of("%L.%M()", adapterInitializer(type.nullable(false), requiresBuffering, jsExport, runtimeAdapterPrefix), nullableFun) } } } From c0f50486b5c834e04442f55167378e28cbddcbef Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 12:32:16 +0100 Subject: [PATCH 41/42] add an quick test --- tests/catch/src/main/graphql/null/operations.graphql | 5 +++++ tests/catch/src/main/graphql/shared/schema.graphqls | 1 + 2 files changed, 6 insertions(+) diff --git a/tests/catch/src/main/graphql/null/operations.graphql b/tests/catch/src/main/graphql/null/operations.graphql index db046cee5bc..baa65abd371 100644 --- a/tests/catch/src/main/graphql/null/operations.graphql +++ b/tests/catch/src/main/graphql/null/operations.graphql @@ -3,3 +3,8 @@ query ProductThrow { price @catch(to: THROW) } } + +query NullAndNonNull { + nonNull + nullable +} diff --git a/tests/catch/src/main/graphql/shared/schema.graphqls b/tests/catch/src/main/graphql/shared/schema.graphqls index bd1f42af6b8..0c6d8ec7665 100644 --- a/tests/catch/src/main/graphql/shared/schema.graphqls +++ b/tests/catch/src/main/graphql/shared/schema.graphqls @@ -2,6 +2,7 @@ extend schema @link(url: "https://specs.apollo.dev/nullability/v0.1", import: [" type Query { nullable: Int + nonNull: Int! semanticNonNull: Int @semanticNonNull deep: [[[Int]]] @semanticNonNull user: User @semanticNonNull From f69d3c5126edfd6b91f0dd6a38504070ca2982d1 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 1 Dec 2023 13:59:50 +0100 Subject: [PATCH 42/42] fix tests --- .../compiler/ir/IrOperationsBuilder.kt | 3 +-- .../apollo3/compiler/ir/IrType.kt | 27 ++++++++++--------- tests/catch/build.gradle.kts | 4 +-- .../test/{CatchTest.kt => CatchThrowTest.kt} | 19 +++++++------ 4 files changed, 26 insertions(+), 27 deletions(-) rename tests/catch/src/test/kotlin/test/{CatchTest.kt => CatchThrowTest.kt} (93%) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt index 8873a41b081..c56b5166ee1 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrOperationsBuilder.kt @@ -612,8 +612,7 @@ internal class IrOperationsBuilder( val irType = first .type - .toIr() - // Apply the schema transformations + .toIr(schema) .semanticNonNull(first.semanticNonNulls, 0) .let { /** diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt index 0eab503b743..0913900970e 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ir/IrType.kt @@ -43,12 +43,6 @@ import kotlinx.serialization.Serializable */ @Serializable sealed interface IrType { - /** - * This type may by an error - * true if the type is nullable in the server schema - */ - val maybeError: Boolean - /** * This type is nullable in Kotlin */ @@ -64,6 +58,13 @@ sealed interface IrType { */ val catchTo: IrCatchTo + /** + * This type may be an error + * true if the type is nullable in the server schema. + * Used to generate error aware adapters + */ + val maybeError: Boolean + fun copyWith( maybeError: Boolean = this.maybeError, nullable: Boolean = this.nullable, @@ -208,31 +209,31 @@ internal fun IrType.replacePlaceholder(newPath: String): IrType { internal fun GQLType.toIr(schema: Schema): IrType { return when (this) { is GQLNonNullType -> type.toIr(schema).copyWith(nullable = false, maybeError = false) - is GQLListType -> IrListType(ofType = type.toIr(schema), nullable = true, maybeError = true) + is GQLListType -> IrListType(ofType = type.toIr(schema), nullable = true, maybeError = schema.errorAware) is GQLNamedType -> { when (schema.typeDefinition(name)) { is GQLScalarTypeDefinition -> { - IrScalarType(name, nullable = true, maybeError = true) + IrScalarType(name, nullable = true, maybeError = schema.errorAware) } is GQLEnumTypeDefinition -> { - IrEnumType(name, nullable = true, maybeError = true) + IrEnumType(name, nullable = true, maybeError = schema.errorAware) } is GQLInputObjectTypeDefinition -> { - IrInputObjectType(name, nullable = true, maybeError = true) + IrInputObjectType(name, nullable = true, maybeError = schema.errorAware) } is GQLObjectTypeDefinition -> { - IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = true) + IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = schema.errorAware) } is GQLInterfaceTypeDefinition -> { - IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = true) + IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = schema.errorAware) } is GQLUnionTypeDefinition -> { - IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = true) + IrModelType(MODEL_UNKNOWN, nullable = true, maybeError = schema.errorAware) } } } diff --git a/tests/catch/build.gradle.kts b/tests/catch/build.gradle.kts index b26bd13e8a1..4a556a57d7d 100644 --- a/tests/catch/build.gradle.kts +++ b/tests/catch/build.gradle.kts @@ -14,10 +14,10 @@ dependencies { } apollo { - service("default") { + service("throw") { srcDir("src/main/graphql/shared") srcDir("src/main/graphql/throw") - packageName.set("default") + packageName.set("throw") } service("null") { srcDir("src/main/graphql/shared") diff --git a/tests/catch/src/test/kotlin/test/CatchTest.kt b/tests/catch/src/test/kotlin/test/CatchThrowTest.kt similarity index 93% rename from tests/catch/src/test/kotlin/test/CatchTest.kt rename to tests/catch/src/test/kotlin/test/CatchThrowTest.kt index 68e4840af5a..f1ab34dc453 100644 --- a/tests/catch/src/test/kotlin/test/CatchTest.kt +++ b/tests/catch/src/test/kotlin/test/CatchThrowTest.kt @@ -3,21 +3,20 @@ package test import com.apollographql.apollo3.api.ApolloResponse import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.Query -import com.apollographql.apollo3.api.exceptionOrNull import com.apollographql.apollo3.api.graphQLErrorOrNull import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.parseResponse import com.apollographql.apollo3.api.getOrThrow import com.apollographql.apollo3.exception.ApolloGraphQLException -import default.PriceNullQuery -import default.ProductIgnoreErrorsQuery -import default.ProductNullQuery -import default.ProductQuery -import default.ProductResultQuery -import default.UserNullQuery -import default.UserQuery -import default.UserResultQuery +import `throw`.PriceNullQuery +import `throw`.ProductIgnoreErrorsQuery +import `throw`.ProductNullQuery +import `throw`.ProductQuery +import `throw`.ProductResultQuery +import `throw`.UserNullQuery +import `throw`.UserQuery +import `throw`.UserResultQuery import okio.Buffer import org.intellij.lang.annotations.Language import kotlin.test.Test @@ -26,7 +25,7 @@ import kotlin.test.assertIs import kotlin.test.assertNotNull import kotlin.test.assertNull -class CatchTest { +class CatchThrowTest { @Test fun userOnUserNameError() { val response = UserQuery().parseResponse(userNameError)