diff --git a/libraries/apollo-api/api/apollo-api.api b/libraries/apollo-api/api/apollo-api.api index decbf1509df..46c8c4d2d29 100644 --- a/libraries/apollo-api/api/apollo-api.api +++ b/libraries/apollo-api/api/apollo-api.api @@ -33,6 +33,7 @@ public final class com/apollographql/apollo3/api/Adapters { public static final fun -obj (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/ObjectAdapter; public static final fun -optional (Lcom/apollographql/apollo3/api/Adapter;)Lcom/apollographql/apollo3/api/PresentAdapter; 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/CompositeAdapterContext;)Lcom/apollographql/apollo3/api/ResultAdapter; 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; @@ -397,7 +398,7 @@ public final class com/apollographql/apollo3/api/CompositeAdapterContext { public final field customScalarAdapters Lcom/apollographql/apollo3/api/CustomScalarAdapters; public final field deferredFragmentIdentifiers Ljava/util/Set; public final field falseVariables Ljava/util/Set; - public synthetic fun (Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;Ljava/util/Set;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Lcom/apollographql/apollo3/api/CustomScalarAdapters;Ljava/util/Set;Ljava/util/Set;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V } public final class com/apollographql/apollo3/api/CompositeAdapterContext$Builder { @@ -405,6 +406,7 @@ public final class com/apollographql/apollo3/api/CompositeAdapterContext$Builder public final fun build ()Lcom/apollographql/apollo3/api/CompositeAdapterContext; public final fun customScalarAdapters (Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lcom/apollographql/apollo3/api/CompositeAdapterContext$Builder; public final fun deferredFragmentIdentifiers (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CompositeAdapterContext$Builder; + public final fun errors (Ljava/util/List;)Lcom/apollographql/apollo3/api/CompositeAdapterContext$Builder; public final fun falseVariables (Ljava/util/Set;)Lcom/apollographql/apollo3/api/CompositeAdapterContext$Builder; } @@ -419,6 +421,7 @@ public final class com/apollographql/apollo3/api/CompositeAdaptersKt { public static final fun -obj (Lcom/apollographql/apollo3/api/CompositeAdapter;Z)Lcom/apollographql/apollo3/api/ObjectCompositeAdapter; public static synthetic fun -obj$default (Lcom/apollographql/apollo3/api/CompositeAdapter;ZILjava/lang/Object;)Lcom/apollographql/apollo3/api/ObjectCompositeAdapter; public static final fun -present (Lcom/apollographql/apollo3/api/CompositeAdapter;)Lcom/apollographql/apollo3/api/PresentCompositeAdapter; + public static final fun -result (Lcom/apollographql/apollo3/api/CompositeAdapter;)Lcom/apollographql/apollo3/api/ResultCompositeAdapter; public static final fun -toJson (Lcom/apollographql/apollo3/api/CompositeAdapter;Ljava/lang/Object;)Ljava/lang/String; public static final fun -toJson (Lcom/apollographql/apollo3/api/CompositeAdapter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)Ljava/lang/String; public static final fun -toJson (Lcom/apollographql/apollo3/api/CompositeAdapter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CompositeAdapterContext;Ljava/lang/String;)Ljava/lang/String; @@ -884,6 +887,44 @@ public abstract interface class com/apollographql/apollo3/api/Query : com/apollo public abstract interface class com/apollographql/apollo3/api/Query$Data : com/apollographql/apollo3/api/Operation$Data { } +public abstract interface class com/apollographql/apollo3/api/Result { + public fun errorsOrNull ()Ljava/util/List; + public fun getOrNull ()Ljava/lang/Object; + public fun getOrThrow ()Ljava/lang/Object; +} + +public final class com/apollographql/apollo3/api/Result$Data : com/apollographql/apollo3/api/Result { + public fun (Ljava/lang/Object;)V + public final fun getValue ()Ljava/lang/Object; +} + +public final class com/apollographql/apollo3/api/Result$Error : com/apollographql/apollo3/api/Result { + public fun (Ljava/util/List;)V + public final fun getErrors ()Ljava/util/List; +} + +public final class com/apollographql/apollo3/api/ResultAdapter : com/apollographql/apollo3/api/Adapter { + public fun (Lcom/apollographql/apollo3/api/Adapter;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)V + public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CustomScalarAdapters;)Lcom/apollographql/apollo3/api/Result; + 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/Result;)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/ResultCompositeAdapter : com/apollographql/apollo3/api/CompositeAdapter { + public fun (Lcom/apollographql/apollo3/api/CompositeAdapter;)V + public fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)Lcom/apollographql/apollo3/api/Result; + public synthetic fun fromJson (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)Ljava/lang/Object; + public fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Lcom/apollographql/apollo3/api/Result;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)V + public synthetic fun toJson (Lcom/apollographql/apollo3/api/json/JsonWriter;Ljava/lang/Object;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)V +} + +public final class com/apollographql/apollo3/api/ResultKt { + public static final fun getOrElse (Lcom/apollographql/apollo3/api/Result;Ljava/lang/Object;)Ljava/lang/Object; + public static final fun missingField (Lcom/apollographql/apollo3/api/json/JsonReader;Ljava/lang/String;)Ljava/lang/Object; + public static final fun missingFieldResult (Lcom/apollographql/apollo3/api/json/JsonReader;Lcom/apollographql/apollo3/api/CompositeAdapterContext;)Lcom/apollographql/apollo3/api/Result; +} + public final class com/apollographql/apollo3/api/ScalarType : com/apollographql/apollo3/api/CompiledNamedType { public fun (Ljava/lang/String;)V } @@ -1314,6 +1355,10 @@ public final class com/apollographql/apollo3/exception/MissingValueException : c public fun ()V } +public final class com/apollographql/apollo3/exception/NoDataAndNoErrorsException : com/apollographql/apollo3/exception/ApolloException { + public fun (Ljava/lang/Throwable;)V +} + public final class com/apollographql/apollo3/exception/NoDataException : com/apollographql/apollo3/exception/ApolloException { public fun (Ljava/lang/Throwable;)V } 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 8253fc18127..ba94a86f78e 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 @@ -68,6 +68,25 @@ class NullableAdapter(private val wrappedAdapter: Adapter) : Adapter } } +class ResultAdapter(private val wrappedAdapter: Adapter, private val adapterContext: CompositeAdapterContext) : Adapter> { + override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): Result { + if (reader.peek() == JsonReader.Token.NULL) { + val errors = adapterContext.errorsForPath(reader.getPath()) + if (errors.isNotEmpty()) { + reader.skipValue() + return Result.Error(errors) + } + } + return Result.Data(wrappedAdapter.fromJson(reader, customScalarAdapters)) + } + + override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: Result) { + // We do not support serializing errors + wrappedAdapter.toJson(writer, customScalarAdapters, value.getOrThrow()) + } +} + + @Deprecated("Use PresentAdapter instead") class OptionalAdapter(private val wrappedAdapter: Adapter) : Adapter> { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): Optional.Present { @@ -121,7 +140,7 @@ class ApolloOptionalAdapter(private val wrappedAdapter: Adapter) : Adapter @JvmName("-obj") fun Adapter.obj() = ObjectAdapter(this) -class ObjectAdapter(private val wrappedAdapter: Adapter): Adapter { +class ObjectAdapter(private val wrappedAdapter: Adapter) : Adapter { override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { throw IllegalStateException("Input type used in output position") } @@ -302,6 +321,9 @@ fun Adapter.nullable() = NullableAdapter(this) @JvmName("-list") fun Adapter.list() = ListAdapter(this) +@JvmName("-result") +fun Adapter.result(adapterContext: CompositeAdapterContext) = ResultAdapter(this, adapterContext) + /** * 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. @@ -310,7 +332,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()) { @@ -324,7 +350,7 @@ inline fun Adapter.array() = object : Adapter> { wrappedAdapter: Adapter, writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, - value: Array + value: Array, ) { writer.beginArray() value.forEach { diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloResponse.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloResponse.kt index 29bf25a1625..31b774d2e67 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloResponse.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloResponse.kt @@ -3,6 +3,7 @@ package com.apollographql.apollo3.api import com.apollographql.apollo3.exception.ApolloException import com.apollographql.apollo3.exception.ApolloGraphQLException import com.apollographql.apollo3.exception.DefaultApolloException +import com.apollographql.apollo3.exception.NoDataAndNoErrorsException import com.apollographql.apollo3.exception.NoDataException import com.benasher44.uuid.Uuid import kotlin.jvm.JvmField @@ -80,8 +81,7 @@ private constructor( ) { /** - * An [ApolloException] if a complete GraphQL response wasn't received, an instance of [ApolloGraphQLException] if GraphQL - * errors were return or another instance of [ApolloException] if a network, parsing, caching or other error happened. + * An [ApolloException] if a network, parsing, caching or other error happened. * * For example, `exception` is non-null if there is a network failure or cache miss. * @@ -90,8 +90,7 @@ private constructor( @JvmField val exception: ApolloException? = when { exception != null -> exception - !errors.isNullOrEmpty() -> ApolloGraphQLException(errors) - data == null -> DefaultApolloException("No data and no error was returned") + data == null -> NoDataAndNoErrorsException(exception) else -> null } diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapter.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapter.kt index bda416f58b1..f7cd0363dfa 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapter.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapter.kt @@ -1,5 +1,6 @@ package com.apollographql.apollo3.api +import com.apollographql.apollo3.annotations.ApolloExperimental import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import okio.IOException @@ -32,11 +33,19 @@ class CompositeAdapterContext private constructor( @JvmField val deferredFragmentIdentifiers: Set?, + + private var errors: List, ) { + + + @ApolloExperimental + fun errorsForPath(path: List) = errorsForPath(path, errors) + class Builder { private var customScalarAdapters: CustomScalarAdapters? = null private var falseVariables: Set? = null private var deferredFragmentIdentifiers: Set? = null + private var errors: List? = null fun customScalarAdapters(customScalarAdapters: CustomScalarAdapters) = apply { this.customScalarAdapters = customScalarAdapters @@ -45,15 +54,21 @@ class CompositeAdapterContext private constructor( fun falseVariables(falseVariables: Set?) = apply { this.falseVariables = falseVariables } + fun deferredFragmentIdentifiers(deferredFragmentIdentifiers: Set?) = apply { this.deferredFragmentIdentifiers = deferredFragmentIdentifiers } + fun errors(errors: List) = apply { + this.errors = errors + } + fun build(): CompositeAdapterContext { return CompositeAdapterContext( customScalarAdapters ?: CustomScalarAdapters.Empty, falseVariables ?: emptySet(), - deferredFragmentIdentifiers + deferredFragmentIdentifiers, + errors ?: emptyList() ) } @@ -67,3 +82,22 @@ fun CompositeAdapter.toJson(writer: JsonWriter, customScalarAdapters: Cus fun CompositeAdapter.fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T { return fromJson(reader, CompositeAdapterContext.Builder().customScalarAdapters(customScalarAdapters).build()) } + +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 +} + +private fun errorsForPath(responsePath: List, errors: List): List { + // XXX: optimize + return errors.filter { + it.path?.startsWith(responsePath) ?: false + } +} \ No newline at end of file diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapters.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapters.kt index f8ff97835b9..7a7014a51b8 100644 --- a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapters.kt +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/CompositeAdapters.kt @@ -6,6 +6,7 @@ import com.apollographql.apollo3.api.json.MapJsonReader.Companion.buffer import com.apollographql.apollo3.api.json.MapJsonWriter import com.apollographql.apollo3.api.json.buildJsonString import com.apollographql.apollo3.api.json.writeAny +import com.apollographql.apollo3.exception.DefaultApolloException import kotlin.jvm.JvmName import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmSuppressWildcards @@ -55,6 +56,27 @@ class NullableCompositeAdapter(private val wrappedAdapter: CompositeAda } } +class ResultCompositeAdapter(private val wrappedAdapter: CompositeAdapter): CompositeAdapter> { + override fun fromJson(reader: JsonReader, adapterContext: CompositeAdapterContext): Result { + try { + return Result.Data(wrappedAdapter.fromJson(reader, adapterContext)) + } catch (e: Exception) { + val errors = adapterContext.errorsForPath(reader.getPath()) + if (errors.isNotEmpty()) { + reader.skipValue() + return Result.Error(errors) + } + + throw DefaultApolloException("no error found for @catch field at '${reader.getPath()}'") + } + } + + override fun toJson(writer: JsonWriter, value: Result, adapterContext: CompositeAdapterContext) { + // We do not support serializing errors + wrappedAdapter.toJson(writer, value.getOrThrow(), adapterContext) + } +} + class PresentCompositeAdapter(private val wrappedAdapter: CompositeAdapter) : CompositeAdapter> { override fun fromJson(reader: JsonReader, adapterContext: CompositeAdapterContext): Optional.Present { return Optional.Present(wrappedAdapter.fromJson(reader, adapterContext)) @@ -132,6 +154,9 @@ class ObjectCompositeAdapter( } } +@JvmName("-result") +fun CompositeAdapter.result() = ResultCompositeAdapter(this) + @JvmName("-nullable") fun CompositeAdapter.nullable() = NullableCompositeAdapter(this) @@ -145,6 +170,7 @@ fun CompositeAdapter.obj(buffered: Boolean = false) = ObjectCompositeAdap fun CompositeAdapter.present() = PresentCompositeAdapter(this) + @JvmName("-toJson") @JvmOverloads fun CompositeAdapter.toJsonString( 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 b1a5c20587e..18b02f1a9e3 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,16 +72,33 @@ fun Executable.parseData( customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, falseVariables: Set? = null, deferredFragmentIds: Set? = null, +): D? { + return parseData( + jsonReader = jsonReader, + customScalarAdapters = customScalarAdapters, + falseVariables = falseVariables, + deferredFragmentIds = deferredFragmentIds, + errors = emptyList() + ) +} + +@ApolloInternal +fun Executable.parseData( + jsonReader: JsonReader, + customScalarAdapters: CustomScalarAdapters, + falseVariables: Set?, + deferredFragmentIds: Set?, + errors: List, ): D? { val adapterContext = CompositeAdapterContext.Builder() .customScalarAdapters(customScalarAdapters) .falseVariables(falseVariables) .deferredFragmentIdentifiers(deferredFragmentIds) + .errors(errors) .build() return adapter().nullable().fromJson(jsonReader, adapterContext) } - fun Executable.composeData( jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters, diff --git a/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Result.kt b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Result.kt new file mode 100644 index 00000000000..590aa5caa12 --- /dev/null +++ b/libraries/apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/Result.kt @@ -0,0 +1,36 @@ +package com.apollographql.apollo3.api + +import com.apollographql.apollo3.api.json.JsonReader +import com.apollographql.apollo3.exception.ApolloGraphQLException +import com.apollographql.apollo3.exception.DefaultApolloException + +sealed interface Result { + fun getOrNull(): V? = (this as? Data)?.value + fun getOrThrow(): V { + return when(this) { + is Data -> value + is Error -> throw ApolloGraphQLException(errors) + } + } + + fun errorsOrNull(): List? = (this as? Error)?.errors + + class Data(val value: V): Result + class Error(val errors: List) : Result +} + + +fun Result.getOrElse(fallback: V): V = (this as? Result.Data)?.value ?: fallback + +fun missingFieldResult(jsonReader: JsonReader, adapterContext: CompositeAdapterContext): Result { + val errors = adapterContext.errorsForPath(jsonReader.getPath()) + if (errors.isEmpty()) { + throw DefaultApolloException("No field returned at ${jsonReader.getPath()}") + } + + return Result.Error(errors) +} + +fun missingField(jsonReader: JsonReader, name: String): V { + throw DefaultApolloException("Field '$name' is missing at path ${jsonReader.getPath()}") +} \ No newline at end of file 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..05e0ccb0a7f 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 ?: emptyList()) } "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 fb4db23b908..045270622d7 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 @@ -24,6 +24,11 @@ class DefaultApolloException(message: String? = null, cause: Throwable? = null): */ class NoDataException(cause: Throwable?): ApolloException("No data was found", cause) +/** + * No data and no error found. + */ +class NoDataAndNoErrorsException(cause: Throwable?): ApolloException("No data and no error found", cause) + /** * A network error happened: socket closed, DNS issue, TLS problem, etc... * diff --git a/libraries/apollo-ast/api/apollo-ast.api b/libraries/apollo-ast/api/apollo-ast.api index f4c96971a9a..5bd7f593a4c 100644 --- a/libraries/apollo-ast/api/apollo-ast.api +++ b/libraries/apollo-ast/api/apollo-ast.api @@ -931,12 +931,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; 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..b3925980dbf 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 @@ -193,6 +193,8 @@ class Schema internal constructor( const val FIELD_POLICY = "fieldPolicy" const val NONNULL = "nonnull" const val OPTIONAL = "optional" + const val CATCH = "catch" + const val NULL_ONLY_ON_ERROR = "nullOnlyOnError" const val REQUIRES_OPT_IN = "requiresOptIn" 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 9676f62b61c..3b34b080394 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 @@ -70,5 +70,34 @@ fun List.optionalValue(schema: Schema?): Boolean? { return argument == null || argument.name == "if" && (argument.value as GQLBooleanValue).value } +@ApolloInternal +fun List.findCatchLevels(schema: Schema): List { + return filter { + schema.originalDirectiveName(it.name) == Schema.CATCH + }.map { + val argument = it.arguments.firstOrNull { it.name == "level" } + if (argument == null) { + null + } else { + (argument.value as? GQLIntValue)?.value ?: error("bad @catch directive") + } + } +} + +@ApolloInternal +fun List.findNullOnlyOnErrorLevels(schema: Schema): List { + return filter { + schema.originalDirectiveName(it.name) == Schema.NULL_ONLY_ON_ERROR + }.map { + val argument = it.arguments.firstOrNull { it.name == "level" } + if (argument == null) { + null + } else { + (argument.value as? GQLIntValue)?.value ?: error("bad @nullOnlyOnError directive") + } + } +} + + @ApolloInternal fun List.findNonnull(schema: Schema) = any { schema.originalDirectiveName(it.name) == Schema.NONNULL } diff --git a/libraries/apollo-compiler/api/apollo-compiler.api b/libraries/apollo-compiler/api/apollo-compiler.api index 9d3a26b2a88..6b0134615e4 100644 --- a/libraries/apollo-compiler/api/apollo-compiler.api +++ b/libraries/apollo-compiler/api/apollo-compiler.api @@ -612,6 +612,34 @@ public final class com/apollographql/apollo3/compiler/ir/IrOptionalType$Companio public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class com/apollographql/apollo3/compiler/ir/IrResultType : com/apollographql/apollo3/compiler/ir/IrType { + public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrResultType$Companion; + public fun (Lcom/apollographql/apollo3/compiler/ir/IrType;)V + public final fun component1 ()Lcom/apollographql/apollo3/compiler/ir/IrType; + public final fun copy (Lcom/apollographql/apollo3/compiler/ir/IrType;)Lcom/apollographql/apollo3/compiler/ir/IrResultType; + public static synthetic fun copy$default (Lcom/apollographql/apollo3/compiler/ir/IrResultType;Lcom/apollographql/apollo3/compiler/ir/IrType;ILjava/lang/Object;)Lcom/apollographql/apollo3/compiler/ir/IrResultType; + public fun equals (Ljava/lang/Object;)Z + public final fun getOfType ()Lcom/apollographql/apollo3/compiler/ir/IrType; + public fun hashCode ()I + public fun rawType ()Lcom/apollographql/apollo3/compiler/ir/IrNamedType; + public fun toString ()Ljava/lang/String; +} + +public final class com/apollographql/apollo3/compiler/ir/IrResultType$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Lcom/apollographql/apollo3/compiler/ir/IrResultType$$serializer; + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/apollographql/apollo3/compiler/ir/IrResultType; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/apollographql/apollo3/compiler/ir/IrResultType;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/apollographql/apollo3/compiler/ir/IrResultType$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class com/apollographql/apollo3/compiler/ir/IrScalarType : com/apollographql/apollo3/compiler/ir/IrNamedType, com/apollographql/apollo3/compiler/ir/IrType { public static final field Companion Lcom/apollographql/apollo3/compiler/ir/IrScalarType$Companion; public fun (Ljava/lang/String;)V diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ApolloCompiler.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ApolloCompiler.kt index 0ccde0f7358..eaef53d381f 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ApolloCompiler.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ApolloCompiler.kt @@ -244,7 +244,8 @@ object ApolloCompiler { decapitalizeFields = options.decapitalizeFields, alwaysGenerateTypesMatching = options.alwaysGenerateTypesMatching, generateDataBuilders = options.codegenSchema.generateDataBuilders, - fragmentVariableUsages = validationResult.fragmentVariableUsages + fragmentVariableUsages = validationResult.fragmentVariableUsages, + enableCatchAndNullOnlyOnError = options.enableCatchAndNullOnlyOnError ).build() } @@ -473,6 +474,7 @@ object ApolloCompiler { fieldsOnDisjointTypesMustMerge = fieldsOnDisjointTypesMustMerge, generateOptionalOperationVariables = generateOptionalOperationVariables, alwaysGenerateTypesMatching = alwaysGenerateTypesMatching, + enableCatchAndNullOnlyOnError = false ) val irOperations = buildIrOperations(irOptions) diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/Options.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/Options.kt index b3018546285..63637c5ea5b 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/Options.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/Options.kt @@ -203,6 +203,8 @@ class IrOptions( * For input types, this will recursively add all input fields types/enums. */ val alwaysGenerateTypesMatching: Set, + + val enableCatchAndNullOnlyOnError: Boolean ) @ApolloExperimental 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 af357588cdd..73427b11c87 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 @@ -23,6 +23,7 @@ internal object ClassNames { val Input = ResolverClassName(apolloApiPackageName, "Input") val CustomScalarAdaptersBuilder = ResolverClassName(apolloApiPackageName, "CustomScalarAdapters", "Builder") val Optional = ResolverClassName(apolloApiPackageName, "Optional") + val Result = ResolverClassName(apolloApiPackageName, "Result") val Absent = ResolverClassName(apolloApiPackageName, "Optional", "Absent") val Present = ResolverClassName(apolloApiPackageName, "Optional", "Present") val Adapter = ResolverClassName(apolloApiPackageName, "Adapter") 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 16eca5cff78..c6849ea865e 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 @@ -25,6 +25,7 @@ import com.apollographql.apollo3.compiler.ir.IrNonNullType import com.apollographql.apollo3.compiler.ir.IrNonNullType2 import com.apollographql.apollo3.compiler.ir.IrObjectType import com.apollographql.apollo3.compiler.ir.IrOptionalType +import com.apollographql.apollo3.compiler.ir.IrResultType import com.apollographql.apollo3.compiler.ir.IrScalarType import com.apollographql.apollo3.compiler.ir.IrScalarType2 import com.apollographql.apollo3.compiler.ir.IrType @@ -137,6 +138,7 @@ internal class JavaResolver( is IrModelType -> resolveAndAssert(ResolverKeyKind.Model, type.path) is IrScalarType -> resolveIrScalarType(type, asPrimitiveType = false) is IrNamedType -> resolveAndAssert(ResolverKeyKind.SchemaType, type.name) + is IrResultType -> error("Java codegen doesn't support @catch yet") }.let { if (wrapNullableFieldsInOptional) it.wrapInOptional() else it.addNullableAnnotation() } } @@ -263,6 +265,7 @@ internal class JavaResolver( } is IrObjectType -> error("IrObjectType cannot be adapted") + is IrResultType -> error("Java codegen does not support @catch") } } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/adapter/AdapterCommon.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/adapter/AdapterCommon.kt index 2c905c0ef3e..2b3a9ba5849 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/adapter/AdapterCommon.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/codegen/java/adapter/AdapterCommon.kt @@ -34,6 +34,7 @@ import com.apollographql.apollo3.compiler.ir.IrModelType import com.apollographql.apollo3.compiler.ir.IrNonNullType import com.apollographql.apollo3.compiler.ir.IrOptionalType import com.apollographql.apollo3.compiler.ir.IrProperty +import com.apollographql.apollo3.compiler.ir.IrResultType import com.apollographql.apollo3.compiler.ir.IrType import com.apollographql.apollo3.compiler.ir.firstElementOfType import com.apollographql.apollo3.compiler.ir.isComposite 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 c0fa5326ec7..38353a3bb64 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 @@ -23,6 +23,7 @@ import com.apollographql.apollo3.compiler.ir.IrNonNullType import com.apollographql.apollo3.compiler.ir.IrNonNullType2 import com.apollographql.apollo3.compiler.ir.IrObjectType import com.apollographql.apollo3.compiler.ir.IrOptionalType +import com.apollographql.apollo3.compiler.ir.IrResultType import com.apollographql.apollo3.compiler.ir.IrScalarType import com.apollographql.apollo3.compiler.ir.IrScalarType2 import com.apollographql.apollo3.compiler.ir.IrType @@ -76,7 +77,12 @@ internal class KotlinResolver( classNames.put(ResolverKey(kind, id), ClassName(memberName.packageName, memberName.simpleName)) } - internal fun resolveIrType(type: IrType, jsExport: Boolean, isInterface: Boolean = false, override: (IrType) -> TypeName? = { null }): TypeName { + internal fun resolveIrType( + type: IrType, + jsExport: Boolean, + isInterface: Boolean = false, + override: (IrType) -> TypeName? = { null }, + ): TypeName { if (type is IrNonNullType) { return resolveIrType(type.ofType, jsExport, isInterface, override = override).copy(nullable = false) } @@ -87,6 +93,7 @@ internal class KotlinResolver( return when (type) { is IrOptionalType -> KotlinSymbols.Optional.parameterizedBy(resolveIrType(type.ofType, jsExport, isInterface, override = override)) + is IrResultType -> KotlinSymbols.Result.parameterizedBy(resolveIrType(type.ofType, jsExport, isInterface, override = override)) is IrListType -> toListType(resolveIrType(type.ofType, jsExport, isInterface, override), jsExport, isInterface) is IrScalarType -> resolveIrScalarType(type) is IrModelType -> resolveAndAssert(ResolverKeyKind.Model, type.path) @@ -212,7 +219,12 @@ internal class KotlinResolver( return CodeBlock.of("%T.$type", resolveAndAssert(ResolverKeyKind.SchemaType, name)) } - private fun nonNullableAdapterInitializer(type: IrType, requiresBuffering: Boolean, jsExport: Boolean, runtimeAdapterPrefix: String): CodeBlock { + private fun nonNullableAdapterInitializer( + type: IrType, + requiresBuffering: Boolean, + jsExport: Boolean, + runtimeAdapterPrefix: String, + ): CodeBlock { return when (type) { is IrNonNullType -> error("") is IrListType -> { @@ -244,6 +256,19 @@ internal class KotlinResolver( CodeBlock.of("%L.%M()", adapterInitializer(type.ofType, requiresBuffering, jsExport, runtimeAdapterPrefix), presentFun) } + is IrResultType -> { + val param = when (type.ofType.rawType()) { + is IrModelType, is IrInputObjectType -> { + "" + } + + else -> { + "adapterContext" + } + } + CodeBlock.of("%L.%M($param)", adapterInitializer(type.ofType, requiresBuffering, jsExport, runtimeAdapterPrefix), KotlinSymbols.resultAdapter) + } + 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 d9c8409fbfe..f1c55953c1e 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 @@ -32,6 +32,7 @@ internal object KotlinSymbols { val CustomScalarAdapters = ClassNames.CustomScalarAdapters.toKotlinPoetClassName() val CustomScalarAdaptersBuilder = ClassNames.CustomScalarAdaptersBuilder.toKotlinPoetClassName() val Optional = ClassNames.Optional.toKotlinPoetClassName() + val Result = ClassNames.Result.toKotlinPoetClassName() val Absent = ClassNames.Absent.toKotlinPoetClassName() val Present = ClassNames.Present.toKotlinPoetClassName() val Adapter = ClassNames.Adapter.toKotlinPoetClassName() @@ -112,6 +113,10 @@ internal object KotlinSymbols { val ApolloExperimental = ClassName(ClassNames.apolloAnnotationsPackageName, "ApolloExperimental") val JsExport = ClassName("kotlin.js", "JsExport") + + val missingFieldResult = MemberName(apolloApiPackageName, "missingFieldResult") + val missingField = MemberName(apolloApiPackageName, "missingField") + val resultAdapter = MemberName(apolloApiPackageName, "result") } internal fun ResolverClassName.toKotlinPoetClassName(): ClassName = ClassName(packageName, simpleNames) 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 580105a23de..ef7c8f2a44c 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 @@ -23,12 +23,12 @@ import com.apollographql.apollo3.compiler.ir.BooleanExpression import com.apollographql.apollo3.compiler.ir.IrModel import com.apollographql.apollo3.compiler.ir.IrModelType import com.apollographql.apollo3.compiler.ir.IrNonNullType -import com.apollographql.apollo3.compiler.ir.IrOptionalType import com.apollographql.apollo3.compiler.ir.IrProperty import com.apollographql.apollo3.compiler.ir.IrType import com.apollographql.apollo3.compiler.ir.firstElementOfType import com.apollographql.apollo3.compiler.ir.isComposite import com.apollographql.apollo3.compiler.ir.isOptional +import com.apollographql.apollo3.compiler.ir.isResult import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.MemberName @@ -49,14 +49,13 @@ internal fun readFromResponseCodeBlock( val prefix = regularProperties.map { property -> val variableInitializer = when { useTypenameFromArgument && property.info.responseName == "__typename" -> CodeBlock.of(typename) - (property.info.type is IrNonNullType && property.info.type.ofType is IrOptionalType) -> CodeBlock.of("%T", KotlinSymbols.Absent) else -> CodeBlock.of("null") } CodeBlock.of( "var·%N:·%T·=·%L", context.layout.variableName(property.info.responseName), - context.resolver.resolveIrType(property.info.type, context.jsExport).copy(nullable = !property.info.type.isOptional()), + context.resolver.resolveIrType(property.info.type, context.jsExport).copy(nullable = true), variableInitializer ) }.joinToCode(separator = "\n", suffix = "\n") @@ -174,15 +173,17 @@ internal fun readFromResponseCodeBlock( .addStatement("return·%T(", context.resolver.resolveModel(model.id)) .indent() .add(model.properties.map { property -> - val maybeAssertNotNull = if ( - property.info.type is IrNonNullType - && !property.info.type.isOptional() - && !checkedProperties.contains(property.info.responseName) - ) { - "!!" - } else { - "" + + val maybeAssertNotNull = when { + // Type is nullable, no need to assert + property.info.type !is IrNonNullType -> CodeBlock.of("") + property.info.type.isOptional() -> CodeBlock.of("·?:·%T", KotlinSymbols.Absent) + property.info.type.isResult() -> CodeBlock.of("·?:·%M(reader,·adapterContext)", KotlinSymbols.missingFieldResult) + // Type is non-null but was already checked by the code above + checkedProperties.contains(property.info.responseName) -> CodeBlock.of("") + else -> CodeBlock.of("·?:·%M(reader,·%S)", KotlinSymbols.missingField, property.info.responseName) } + CodeBlock.of( "%N·=·%N%L", context.layout.propertyName(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 fa23e663465..afd169dd1cd 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,8 +34,10 @@ import com.apollographql.apollo3.ast.VariableUsage import com.apollographql.apollo3.ast.coerceInSchemaContextOrThrow import com.apollographql.apollo3.ast.definitionFromScope import com.apollographql.apollo3.ast.fieldDefinitions +import com.apollographql.apollo3.ast.findCatchLevels import com.apollographql.apollo3.ast.findDeprecationReason import com.apollographql.apollo3.ast.findNonnull +import com.apollographql.apollo3.ast.findNullOnlyOnErrorLevels import com.apollographql.apollo3.ast.findOptInFeature import com.apollographql.apollo3.ast.isFieldNonNull import com.apollographql.apollo3.ast.optionalValue @@ -62,6 +64,7 @@ internal class IrOperationsBuilder( private val alwaysGenerateTypesMatching: Set, private val generateDataBuilders: Boolean, private val fragmentVariableUsages: Map>, + private val enableCatchAndNullOnlyOnError: Boolean, ) : FieldMerger { private val usedFields = mutableMapOf>() private val responseBasedBuilder = ResponseBasedModelGroupBuilder( @@ -101,7 +104,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 @@ -195,15 +198,16 @@ internal class IrOperationsBuilder( * } * } */ - 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. @@ -217,6 +221,7 @@ internal class IrOperationsBuilder( typesToVisit.add(fieldType.name) usedFields.putType(fieldType.name) } + is GQLEnumTypeDefinition -> { typesToVisit.add(fieldType.name) usedFields.putType(fieldType.name) @@ -473,11 +478,13 @@ internal class IrOperationsBuilder( val description: String?, val type: GQLType, + val nullOnlyOnErrorLevels: List, val nullability: GQLNullability?, val deprecationReason: String?, val optInFeature: String?, val forceNonNull: Boolean, val forceOptional: Boolean, + val catchLevels: List, /** * Merged field will merge their conditions and selectionSets @@ -507,12 +514,26 @@ internal class IrOperationsBuilder( selections = gqlField.selections, type = fieldDefinition.type, nullability = gqlField.nullability, + nullOnlyOnErrorLevels = fieldDefinition.directives.findNullOnlyOnErrorLevels(schema).also { + if (!enableCatchAndNullOnlyOnError) { + check(it.isEmpty()) { + "@catch and @nullOnlyOnError are experimental features, you need to opt-in with enableCatchAndNullOnlyOnError.set(true)" + } + } + }, description = fieldDefinition.description, deprecationReason = fieldDefinition.directives.findDeprecationReason(), optInFeature = fieldDefinition.directives.findOptInFeature(schema), forceNonNull = forceNonNull, forceOptional = gqlField.directives.optionalValue(schema) == true, parentType = fieldWithParent.parentType, + catchLevels = gqlField.directives.findCatchLevels(schema).also { + if (!enableCatchAndNullOnlyOnError) { + check(it.isEmpty()) { + "@catch and @nullOnlyOnError are experimental features, you need to opt-in with enableCatchAndNullOnlyOnError.set(true)" + } + } + }, ) }.groupBy { it.responseName @@ -582,7 +603,14 @@ internal class IrOperationsBuilder( */ usedFields.putType(first.type.rawType().name) - var irType = first.type.withNullability(first.nullability).toIr() + var irType = first + .type + .withNullability(first.nullability) + .toIr() + .nooe(first.nullOnlyOnErrorLevels, 0) + .catch(first.catchLevels, 0) + + if (forceNonNull) { irType = irType.makeNonNull() } else if (forceOptional) { @@ -698,6 +726,48 @@ internal class IrOperationsBuilder( } } +private fun IrType.nooe2(nullOnlyOnErrorLevels: List, level: Int): IrType { + return when (this) { + is IrNamedType -> this + is IrListType -> IrListType(ofType.nooe(nullOnlyOnErrorLevels, level + 1)) + is IrNonNullType -> error("") + is IrOptionalType -> error("") + is IrResultType -> error("") + } +} + +private fun IrType.nooe(nullOnlyOnErrorLevels: List, level: Int): IrType { + val shouldWrap = nullOnlyOnErrorLevels.any { it == null || it == level } + + if (this is IrNonNullType) { + return IrNonNullType(ofType.nooe2(nullOnlyOnErrorLevels, level)) + } else if (!shouldWrap) { + return this.nooe2(nullOnlyOnErrorLevels, level) + } else { + return IrNonNullType(this.nooe2(nullOnlyOnErrorLevels, level)) + } +} + +private fun IrType.catch2(catchLevels: List, level: Int): IrType { + return when (this) { + is IrNamedType -> this + is IrListType -> IrListType(ofType.catch(catchLevels, level + 1)) + is IrNonNullType -> IrNonNullType(ofType.catch2(catchLevels, level)) + is IrOptionalType -> error("") + is IrResultType -> error("") + } +} + +private fun IrType.catch(catchLevels: List, level: Int): IrType { + val shouldWrap = catchLevels.any { it == null || it == level } + + return if (shouldWrap) { + IrNonNullType(IrResultType(this.catch2(catchLevels, level))) + } else { + this.catch2(catchLevels, level) + } +} + internal fun GQLValue.toIrValue(): IrValue { return when (this) { is GQLIntValue -> IrIntValue(value = value) 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 d2e05058b09..f6202efd45a 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 @@ -36,6 +36,12 @@ data class IrOptionalType(val ofType: IrType) : IrType { override fun rawType() = ofType.rawType() } +@Serializable +@SerialName("result") +data class IrResultType(val ofType: IrType) : IrType { + override fun rawType() = ofType.rawType() +} + @Serializable @SerialName("list") data class IrListType(val ofType: IrType) : IrType { @@ -105,6 +111,8 @@ internal const val MODEL_FRAGMENT_INTERFACE = "fragmentInterface" internal const val MODEL_UNKNOWN = "?" internal fun IrType.makeOptional(): IrType = IrNonNullType(IrOptionalType(this)) +internal fun IrType.makeResult(): IrType = IrNonNullType(IrResultType(this)) + internal fun IrType.makeNullable(): IrType = if (this is IrNonNullType) { this.ofType.makeNullable() } else { @@ -118,6 +126,7 @@ internal fun IrType.makeNonNull(): IrType = if (this is IrNonNullType) { } internal fun IrType.isOptional() = (this is IrNonNullType) && (this.ofType is IrOptionalType) +internal fun IrType.isResult() = (this is IrNonNullType) && (this.ofType is IrResultType) internal fun IrType.makeNonOptional(): IrType { return ((this as? IrNonNullType)?.ofType as? IrOptionalType)?.ofType ?: error("${Identifier.type} is not an optional type") @@ -129,6 +138,7 @@ internal fun IrType.replacePlaceholder(newPath: String): IrType { is IrNonNullType -> IrNonNullType(ofType = ofType.replacePlaceholder(newPath)) is IrListType -> IrListType(ofType = ofType.replacePlaceholder(newPath)) is IrModelType -> copy(path = newPath) + is IrResultType -> copy(ofType = ofType.replacePlaceholder(newPath)) else -> error("Not a compound type?") } } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/adapter/TestQuery_ResponseAdapter.kt.expected index b6ebe03673f..344f02bcae9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/arguments_hardcoded/kotlin/responseBased/arguments_hardcoded/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.arguments_hardcoded.TestQuery @@ -39,7 +40,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data( reviews = _reviews, - testNullableArguments = _testNullableArguments!! + testNullableArguments = _testNullableArguments ?: missingField(reader, "testNullableArguments") ) } @@ -72,7 +73,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Review( - stars = _stars!!, + stars = _stars ?: missingField(reader, "stars"), commentary = _commentary ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/adapter/TestQuery_ResponseAdapter.kt.expected index 863de8b7dd3..25c76df563b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/big_query/kotlin/responseBased/big_query/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.big_query.TestQuery @@ -61,7 +62,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Character( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected index 09959f8d161..3053bcb669a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/operationBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.capitalized_fields.TestQuery @@ -69,7 +70,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Horse( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), Donkey = _Donkey, onHorse = _onHorse ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected index a29b58b6523..8505c80aa1c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/capitalized_fields/kotlin/responseBased/capitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.capitalized_fields.TestQuery @@ -67,7 +68,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Horse( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), Donkey = _Donkey, Cow = _Cow ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/adapter/TestQuery_ResponseAdapter.kt.expected index 9c3d2d5e3db..128cf204797 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/companion/kotlin/operationBased/companion/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.`companion`.TestQuery @@ -63,7 +64,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Companion_( - foo = _foo!! + foo = _foo ?: missingField(reader, "foo") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/adapter/TestQuery_ResponseAdapter.kt.expected index b0dbbe66565..d399ba7dc67 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/custom_scalar_type/kotlin/responseBased/custom_scalar_type/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.custom_scalar_type.TestQuery @@ -80,13 +81,13 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - id = _id!!, - name = _name!!, - birthDate = _birthDate!!, - appearanceDates = _appearanceDates!!, - fieldWithUnsupportedType = _fieldWithUnsupportedType!!, - profileLink = _profileLink!!, - links = _links!! + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate"), + appearanceDates = _appearanceDates ?: missingField(reader, "appearanceDates"), + fieldWithUnsupportedType = _fieldWithUnsupportedType ?: missingField(reader, "fieldWithUnsupportedType"), + profileLink = _profileLink ?: missingField(reader, "profileLink"), + links = _links ?: missingField(reader, "links") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected index a27b6becbd8..56c0457b19e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.data_builders.AnimalQuery @@ -36,7 +37,7 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data( - animal = _animal!! + animal = _animal ?: missingField(reader, "animal") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected index da6a0d14edb..7d1f2ea56cb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.data_builders.CharacterQuery @@ -36,7 +37,7 @@ public object CharacterQuery_ResponseAdapter { } return CharacterQuery.Data( - character = _character!! + character = _character ?: missingField(reader, "character") ) } @@ -87,8 +88,8 @@ public object CharacterQuery_ResponseAdapter { return CharacterQuery.Data.Character( __typename = __typename, - id = _id!!, - name = _name!!, + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), humanFragment = _humanFragment, droidFragment = _droidFragment ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected index e262560c590..bb347a11373 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.data_builders.NodeQuery @@ -36,7 +37,7 @@ public object NodeQuery_ResponseAdapter { } return NodeQuery.Data( - node = _node!! + node = _node ?: missingField(reader, "node") ) } @@ -85,7 +86,7 @@ public object NodeQuery_ResponseAdapter { return NodeQuery.Data.Node( __typename = __typename, - id = _id!!, + id = _id ?: missingField(reader, "id"), humanFragment = _humanFragment, droidFragment = _droidFragment ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected index c8ba1803801..121a99f06a5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object CatFragmentImpl_ResponseAdapter { } return com.example.data_builders.fragment.CatFragment( - meow = _meow!! + meow = _meow ?: missingField(reader, "meow") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected index 4fa19f2738d..a396372ff92 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DogFragmentImpl_ResponseAdapter { } return com.example.data_builders.fragment.DogFragment( - woof = _woof!! + woof = _woof ?: missingField(reader, "woof") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected index 741c5faad65..d461e261900 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DroidFragmentImpl_ResponseAdapter { } return com.example.data_builders.fragment.DroidFragment( - primaryFunction = _primaryFunction!! + primaryFunction = _primaryFunction ?: missingField(reader, "primaryFunction") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected index 6cb4b6b7f8f..307cb508b5c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/operationBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object HumanFragmentImpl_ResponseAdapter { } return com.example.data_builders.fragment.HumanFragment( - homePlanet = _homePlanet!! + homePlanet = _homePlanet ?: missingField(reader, "homePlanet") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected index 5d3bde9cd65..e745183c9ae 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/AnimalQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.data_builders.AnimalQuery import kotlin.String @@ -34,7 +35,7 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data( - animal = _animal!! + animal = _animal ?: missingField(reader, "animal") ) } @@ -94,8 +95,8 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data.CatAnimal( - __typename = __typename!!, - meow = _meow!! + __typename = __typename ?: missingField(reader, "__typename"), + meow = _meow ?: missingField(reader, "meow") ) } @@ -132,8 +133,8 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data.DogAnimal( - __typename = __typename!!, - woof = _woof!! + __typename = __typename ?: missingField(reader, "__typename"), + woof = _woof ?: missingField(reader, "woof") ) } @@ -168,7 +169,7 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data.OtherAnimal( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected index c4087f00ef8..ce3da580234 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/CharacterQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.data_builders.CharacterQuery import kotlin.String @@ -34,7 +35,7 @@ public object CharacterQuery_ResponseAdapter { } return CharacterQuery.Data( - character = _character!! + character = _character ?: missingField(reader, "character") ) } @@ -101,10 +102,10 @@ public object CharacterQuery_ResponseAdapter { } return CharacterQuery.Data.HumanCharacter( - __typename = __typename!!, - id = _id!!, - name = _name!!, - homePlanet = _homePlanet!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), + homePlanet = _homePlanet ?: missingField(reader, "homePlanet") ) } @@ -152,10 +153,10 @@ public object CharacterQuery_ResponseAdapter { } return CharacterQuery.Data.DroidCharacter( - __typename = __typename!!, - id = _id!!, - name = _name!!, - primaryFunction = _primaryFunction!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), + primaryFunction = _primaryFunction ?: missingField(reader, "primaryFunction") ) } @@ -200,9 +201,9 @@ public object CharacterQuery_ResponseAdapter { } return CharacterQuery.Data.OtherCharacter( - __typename = __typename!!, - id = _id!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected index a8f5e798d4d..f81a8530a6b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/adapter/NodeQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.data_builders.NodeQuery import kotlin.String @@ -34,7 +35,7 @@ public object NodeQuery_ResponseAdapter { } return NodeQuery.Data( - node = _node!! + node = _node ?: missingField(reader, "node") ) } @@ -96,9 +97,9 @@ public object NodeQuery_ResponseAdapter { } return NodeQuery.Data.HumanNode( - __typename = __typename!!, - id = _id!!, - homePlanet = _homePlanet!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + homePlanet = _homePlanet ?: missingField(reader, "homePlanet") ) } @@ -140,9 +141,9 @@ public object NodeQuery_ResponseAdapter { } return NodeQuery.Data.DroidNode( - __typename = __typename!!, - id = _id!!, - primaryFunction = _primaryFunction!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + primaryFunction = _primaryFunction ?: missingField(reader, "primaryFunction") ) } @@ -182,8 +183,8 @@ public object NodeQuery_ResponseAdapter { } return NodeQuery.Data.OtherNode( - __typename = __typename!!, - id = _id!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected index ced0f5867ab..c68e46a71ba 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/CatFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object CatFragmentImpl_ResponseAdapter { } return CatFragmentImpl.Data( - meow = _meow!! + meow = _meow ?: missingField(reader, "meow") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected index a4feaa29364..01deb6981d8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DogFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DogFragmentImpl_ResponseAdapter { } return DogFragmentImpl.Data( - woof = _woof!! + woof = _woof ?: missingField(reader, "woof") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected index 02e2607e1fd..ee72276e067 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/DroidFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DroidFragmentImpl_ResponseAdapter { } return DroidFragmentImpl.Data( - primaryFunction = _primaryFunction!! + primaryFunction = _primaryFunction ?: missingField(reader, "primaryFunction") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected index 4ca71f5778f..7baa4fcdfd1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/data_builders/kotlin/responseBased/data_builders/fragment/HumanFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object HumanFragmentImpl_ResponseAdapter { } return HumanFragmentImpl.Data( - homePlanet = _homePlanet!! + homePlanet = _homePlanet ?: missingField(reader, "homePlanet") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected index 182329387ff..b29af665193 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/operationBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.decapitalized_fields.TestQuery @@ -72,7 +73,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Horse( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), donkey = _Donkey, onHorse = _onHorse, horseFragment = _horseFragment diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected index 3a9bbe7a197..fc7b12724a8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/decapitalized_fields/kotlin/responseBased/decapitalized_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.decapitalized_fields.TestQuery @@ -66,7 +67,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Horse( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), donkey = _Donkey, cow = _Cow ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected index ae9277ab22f..93259e9705a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.deprecated_merged_field.CatQuery @@ -65,7 +66,7 @@ public object CatQuery_ResponseAdapter { adapterContext) return CatQuery.Data.Cat( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), animalFragment = _animalFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected index 17f9c2547ff..958e08c5983 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/operationBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.possibleTypes import kotlin.String import kotlin.Suppress @@ -93,7 +94,7 @@ public object AnimalFragmentImpl_ResponseAdapter { } return com.example.deprecated_merged_field.fragment.AnimalFragment.OnCat( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -123,7 +124,7 @@ public object AnimalFragmentImpl_ResponseAdapter { } return com.example.deprecated_merged_field.fragment.AnimalFragment.OnDog( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected index fed2736429c..983d14dba82 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/adapter/CatQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.deprecated_merged_field.CatQuery @@ -90,7 +91,7 @@ public object CatQuery_ResponseAdapter { } return CatQuery.Data.OtherCat( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -124,8 +125,8 @@ public object CatQuery_ResponseAdapter { } return CatQuery.Data.OtherAnimalCat( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected index 113dd5036cd..2cdf6ba97e6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecated_merged_field/kotlin/responseBased/deprecated_merged_field/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -64,8 +65,8 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.CatData( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -102,8 +103,8 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.DogData( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -139,7 +140,7 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.OtherData( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/adapter/TestQuery_ResponseAdapter.kt.expected index 7296ed46172..41f1cb5f8b3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/deprecation/kotlin/responseBased/deprecation/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.deprecation.TestQuery @@ -68,9 +69,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - name = _name!!, - deprecated = _deprecated!!, - deprecatedBool = _deprecatedBool!! + name = _name ?: missingField(reader, "name"), + deprecated = _deprecated ?: missingField(reader, "deprecated"), + deprecatedBool = _deprecatedBool ?: missingField(reader, "deprecatedBool") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/adapter/TestQuery_ResponseAdapter.kt.expected index 60c290c4b22..4a8815aefe8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fieldset_with_multiple_super/kotlin/responseBased/fieldset_with_multiple_super/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fieldset_with_multiple_super.TestQuery @@ -106,7 +107,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.ABC( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA1 = _fieldA1, fieldB1 = _fieldB1, fieldB2 = _fieldB2, @@ -154,7 +155,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherC( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -188,7 +189,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherAC( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA1 = _fieldA1 ) } @@ -226,7 +227,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherBC( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldB2 = _fieldB2 ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected index b84fffa28eb..b379483eea5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.and import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.not import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj @@ -113,7 +114,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero( __typename = __typename, - id = _id!!, + id = _id ?: missingField(reader, "id"), heroDetails = _heroDetails, humanDetails = _humanDetails, droidDetails = _droidDetails, 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_ResponseAdapter.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_ResponseAdapter.kt.expected index da482359d8d..f3c9a46c821 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/HeroDetailsImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -31,7 +32,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.fragment_spread_with_include_directive.fragment.HeroDetails( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index c30b652ac56..4240751b69a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_include_directive/kotlin/operationBased/fragment_spread_with_include_directive/fragment/OtherDroidDetailsImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,7 +33,7 @@ public object OtherDroidDetailsImpl_ResponseAdapter { } return com.example.fragment_spread_with_include_directive.fragment.OtherDroidDetails( - id = _id!! + id = _id ?: missingField(reader, "id") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected index da7fc23467f..2a2f379e923 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_spread_with_nested_fields.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Hero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), heroDetails = _heroDetails ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 16389e3c35c..64bbfbf7cd5 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/operationBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Int @@ -38,8 +39,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.fragment_spread_with_nested_fields.fragment.HeroDetails( - name = _name!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -138,7 +139,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.fragment_spread_with_nested_fields.fragment.HeroDetails.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected index 6257b6348d0..ca14bc47804 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_spread_with_nested_fields.TestQuery @@ -68,9 +69,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -166,7 +167,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 5203edbbeaa..971c5bc64e7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_spread_with_nested_fields/kotlin/responseBased/fragment_spread_with_nested_fields/fragment/HeroDetailsImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Int @@ -37,8 +38,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data( - name = _name!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -131,7 +132,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected index b8d7bd6db98..78e0f871adf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.Any import kotlin.String import kotlin.collections.List @@ -35,8 +36,8 @@ public object CharacterDetailsImpl_ResponseAdapter { } return com.example.fragment_used_twice.fragment.CharacterDetails( - name = _name!!, - birthDate = _birthDate!! + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index 7ab9ae954ba..0afb4c22218 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -37,8 +38,8 @@ public object HeroDetailsImpl_ResponseAdapter { adapterContext) return com.example.fragment_used_twice.fragment.HeroDetails( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), characterDetails = _characterDetails ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index 9f0ef8397f1..ba9a2a2750d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/operationBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -37,8 +38,8 @@ public object HumanDetailsImpl_ResponseAdapter { adapterContext) return com.example.fragment_used_twice.fragment.HumanDetails( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), characterDetails = _characterDetails ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/adapter/TestQuery_ResponseAdapter.kt.expected index f41daa3f4e1..883d570e340 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_used_twice.TestQuery @@ -96,9 +97,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, - birthDate = _birthDate!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } @@ -140,9 +141,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!!, - birthDate = _birthDate!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected index 7280134dd45..aae935de9ff 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/CharacterDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.Any import kotlin.String import kotlin.collections.List @@ -34,8 +35,8 @@ public object CharacterDetailsImpl_ResponseAdapter { } return CharacterDetailsImpl.Data( - name = _name!!, - birthDate = _birthDate!! + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index f5fa2f4b918..60522ac8c23 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.Any import kotlin.String import kotlin.collections.List @@ -36,9 +37,9 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data( - __typename = __typename!!, - name = _name!!, - birthDate = _birthDate!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index 8797fe0e963..cf0be56a016 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_used_twice/kotlin/responseBased/fragment_used_twice/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import kotlin.Any import kotlin.String import kotlin.Suppress @@ -65,9 +66,9 @@ public object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.CharacterData( - __typename = __typename!!, - name = _name!!, - birthDate = _birthDate!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } @@ -107,8 +108,8 @@ public object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.OtherData( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 72c2e2fa836..bd8b46a946d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_with_inline_fragment.TestQuery @@ -72,9 +73,9 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Hero( - __typename = __typename!!, - name = _name!!, - appearsIn = _appearsIn!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn"), heroDetails = _heroDetails ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected index 47cc8d1cc6f..540b83b967b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -34,7 +35,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return com.example.fragment_with_inline_fragment.fragment.DroidDetails( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index e1143cb4337..8ccc1ea318f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -61,8 +62,8 @@ public object HeroDetailsImpl_ResponseAdapter { return com.example.fragment_with_inline_fragment.fragment.HeroDetails( __typename = __typename, - name = _name!!, - friendsConnection = _friendsConnection!!, + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection"), onDroid = _onDroid, humanDetails = _humanDetails ) @@ -176,7 +177,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.fragment_with_inline_fragment.fragment.HeroDetails.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -212,7 +213,7 @@ public object HeroDetailsImpl_ResponseAdapter { adapterContext) return com.example.fragment_with_inline_fragment.fragment.HeroDetails.OnDroid( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), droidDetails = _droidDetails ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index 1ec2cd880f8..f522579b7a3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/operationBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -31,7 +32,7 @@ public object HumanDetailsImpl_ResponseAdapter { } return com.example.fragment_with_inline_fragment.fragment.HumanDetails( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 6639aecff60..45d531add18 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_with_inline_fragment.TestQuery @@ -106,10 +107,10 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!!, - appearsIn = _appearsIn!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } @@ -211,7 +212,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -255,11 +256,11 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, - friendsConnection = _friendsConnection!!, - appearsIn = _appearsIn!! + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } @@ -364,7 +365,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -406,10 +407,10 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!!, - appearsIn = _appearsIn!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } @@ -511,7 +512,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected index c1b67e46425..f19ff0f9209 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -33,7 +34,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return DroidDetailsImpl.Data( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index 11b91a58f04..9047e0565c4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Int @@ -72,9 +73,9 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.HumanData( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -172,7 +173,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.HumanData.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -214,10 +215,10 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.DroidData( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, - friendsConnection = _friendsConnection!! + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -318,7 +319,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.DroidData.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -357,9 +358,9 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.OtherData( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -457,7 +458,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.OtherData.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index e9db1a0b84a..59a61037ef4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_inline_fragment/kotlin/responseBased/fragment_with_inline_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.Data( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected index 9ba062b78c9..fb86fa565ad 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/operationBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_with_multiple_fieldsets.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.I( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), iFragment = _iFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected index 198f2c6efc8..849e1e2f182 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragment_with_multiple_fieldsets.TestQuery @@ -93,7 +94,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.AI( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA = _fieldA ) } @@ -129,7 +130,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherI( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl_ResponseAdapter.kt.expected index 2c23f22597d..5f946e0ef40 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragment_with_multiple_fieldsets/kotlin/responseBased/fragment_with_multiple_fieldsets/fragment/IFragmentImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -62,7 +63,7 @@ public object IFragmentImpl_ResponseAdapter { } return IFragmentImpl.AData( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA = _fieldA ) } @@ -98,7 +99,7 @@ public object IFragmentImpl_ResponseAdapter { } return IFragmentImpl.OtherData( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected index 65d8964901d..2dcce8632eb 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/operationBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -31,7 +32,7 @@ public object DroidDetails1Impl_ResponseAdapter { } return com.example.fragments_same_type_condition.fragment.DroidDetails1( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected index eb1ba8f735f..d8af29ba962 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragments_same_type_condition.TestQuery @@ -95,8 +96,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -135,7 +136,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected index a38d58a91b7..e99919f027c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_same_type_condition/kotlin/responseBased/fragments_same_type_condition/fragment/DroidDetails1Impl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DroidDetails1Impl_ResponseAdapter { } return DroidDetails1Impl.Data( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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/adapter/InlineMultipleWithDeferAndInclude_ResponseAdapter.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/adapter/InlineMultipleWithDeferAndInclude_ResponseAdapter.kt.expected index 2a83b2ea388..43f354d5f11 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/adapter/InlineMultipleWithDeferAndInclude_ResponseAdapter.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/adapter/InlineMultipleWithDeferAndInclude_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.label +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.not import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj @@ -179,7 +180,7 @@ public object InlineMultipleWithDeferAndInclude_ResponseAdapter { } return InlineMultipleWithDeferAndInclude.Data.Hero.OnDroidIfCond1( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -209,7 +210,7 @@ public object InlineMultipleWithDeferAndInclude_ResponseAdapter { } return InlineMultipleWithDeferAndInclude.Data.Hero.OnDroidIfNotCond2( - id = _id!! + id = _id ?: missingField(reader, "id") ) } @@ -239,7 +240,7 @@ public object InlineMultipleWithDeferAndInclude_ResponseAdapter { } return InlineMultipleWithDeferAndInclude.Data.Hero.OnDroidDeferE_first( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -269,7 +270,7 @@ public object InlineMultipleWithDeferAndInclude_ResponseAdapter { } return InlineMultipleWithDeferAndInclude.Data.Hero.OnDroidDeferE_second( - id = _id!! + id = _id ?: missingField(reader, "id") ) } @@ -299,7 +300,7 @@ public object InlineMultipleWithDeferAndInclude_ResponseAdapter { } return InlineMultipleWithDeferAndInclude.Data.Hero.OnDroidDeferE_third( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -329,7 +330,7 @@ public object InlineMultipleWithDeferAndInclude_ResponseAdapter { } return InlineMultipleWithDeferAndInclude.Data.Hero.OnDroidDeferE_fourth( - id = _id!! + id = _id ?: missingField(reader, "id") ) } 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/adapter/InlineMultipleWithDeferWithIf_ResponseAdapter.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/adapter/InlineMultipleWithDeferWithIf_ResponseAdapter.kt.expected index 6a0bbde15f3..3e747671623 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/adapter/InlineMultipleWithDeferWithIf_ResponseAdapter.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/adapter/InlineMultipleWithDeferWithIf_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.label +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.not import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj @@ -85,7 +86,7 @@ public object InlineMultipleWithDeferWithIf_ResponseAdapter { } return InlineMultipleWithDeferWithIf.Data.Hero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onCharacter = _onCharacter, onCharacterDeferF_second = _onCharacterDeferF_second, onCharacterDeferF_third = _onCharacterDeferF_third @@ -130,7 +131,7 @@ public object InlineMultipleWithDeferWithIf_ResponseAdapter { } return InlineMultipleWithDeferWithIf.Data.Hero.OnCharacter( - id = _id!! + id = _id ?: missingField(reader, "id") ) } @@ -160,7 +161,7 @@ public object InlineMultipleWithDeferWithIf_ResponseAdapter { } return InlineMultipleWithDeferWithIf.Data.Hero.OnCharacterDeferF_second( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -190,7 +191,7 @@ public object InlineMultipleWithDeferWithIf_ResponseAdapter { } return InlineMultipleWithDeferWithIf.Data.Hero.OnCharacterDeferF_third( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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/adapter/InlineMultipleWithDefer_ResponseAdapter.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/adapter/InlineMultipleWithDefer_ResponseAdapter.kt.expected index 40bc03637ad..eb4f3cb2301 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/adapter/InlineMultipleWithDefer_ResponseAdapter.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/adapter/InlineMultipleWithDefer_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.label +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -125,7 +126,7 @@ public object InlineMultipleWithDefer_ResponseAdapter { } return InlineMultipleWithDefer.Data.Hero.OnDroidDeferD_first( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -155,7 +156,7 @@ public object InlineMultipleWithDefer_ResponseAdapter { } return InlineMultipleWithDefer.Data.Hero.OnDroidDeferD_second( - id = _id!! + id = _id ?: missingField(reader, "id") ) } 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/adapter/InlineSingleWithDefer_ResponseAdapter.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/adapter/InlineSingleWithDefer_ResponseAdapter.kt.expected index ce7d78d465e..27950680b9b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_defer_and_include_directives/kotlin/operationBased/fragments_with_defer_and_include_directives/adapter/InlineSingleWithDefer_ResponseAdapter.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/adapter/InlineSingleWithDefer_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.label +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -111,7 +112,7 @@ public object InlineSingleWithDefer_ResponseAdapter { } return InlineSingleWithDefer.Data.Hero.OnDroid( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index e0b240bfb60..ab5ce63da29 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,7 +33,7 @@ public object CharacterDetails2Impl_ResponseAdapter { } return com.example.fragments_with_defer_and_include_directives.fragment.CharacterDetails2( - id = _id!! + id = _id ?: missingField(reader, "id") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 1d820273717..0e2dc1f2691 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CompositeAdapterContext import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.Any import kotlin.String import kotlin.collections.List @@ -33,7 +34,7 @@ public object CharacterDetails3Impl_ResponseAdapter { } return com.example.fragments_with_defer_and_include_directives.fragment.CharacterDetails3( - birthDate = _birthDate!! + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index cbecad9596c..fbbbbc0f47b 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,7 +33,7 @@ public object CharacterDetailsImpl_ResponseAdapter { } return com.example.fragments_with_defer_and_include_directives.fragment.CharacterDetails( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index a7eb04cbb03..7e2ab2cb731 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,7 +33,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return com.example.fragments_with_defer_and_include_directives.fragment.DroidDetails( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected index d1f3247b451..deb064a6d8a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -34,7 +35,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return com.example.fragments_with_type_condition.fragment.DroidDetails( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index d769326a8dc..75aa2bf3c41 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/operationBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableDoubleAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.Double import kotlin.String import kotlin.collections.List @@ -35,7 +36,7 @@ public object HumanDetailsImpl_ResponseAdapter { } return com.example.fragments_with_type_condition.fragment.HumanDetails( - name = _name!!, + name = _name ?: missingField(reader, "name"), height = _height ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected index 4aeb0861045..bc13d495b8f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.fragments_with_type_condition.TestQuery @@ -106,8 +107,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanR2( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -150,8 +151,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidR2( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -190,7 +191,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherR2( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -253,8 +254,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanLuke( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -297,8 +298,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidLuke( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -337,7 +338,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherLuke( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected index 82df612bc19..a0a501f38e8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -33,7 +34,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return DroidDetailsImpl.Data( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index 5ef0c7df14f..1c48742c314 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/fragments_with_type_condition/kotlin/responseBased/fragments_with_type_condition/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableDoubleAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.Double import kotlin.String import kotlin.collections.List @@ -34,7 +35,7 @@ public object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.Data( - name = _name!!, + name = _name ?: missingField(reader, "name"), height = _height ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/adapter/HeroDetails_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/adapter/HeroDetails_ResponseAdapter.kt.expected index ac82e3df4f1..fe818aba240 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/adapter/HeroDetails_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details/kotlin/responseBased/hero_details/adapter/HeroDetails_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.hero_details.HeroDetails @@ -70,9 +71,9 @@ public object HeroDetails_ResponseAdapter { } return HeroDetails.Data.Hero( - type = _type!!, - name = _name!!, - friendsConnection = _friendsConnection!! + type = _type ?: missingField(reader, "type"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -169,7 +170,7 @@ public object HeroDetails_ResponseAdapter { } return HeroDetails.Data.Hero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/adapter/HeroDetailsQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/adapter/HeroDetailsQuery_ResponseAdapter.kt.expected index a387be859c1..e31476a3e1f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/adapter/HeroDetailsQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_details_semantic_naming/kotlin/responseBased/hero_details_semantic_naming/adapter/HeroDetailsQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.hero_details_semantic_naming.HeroDetailsQuery @@ -66,8 +67,8 @@ public object HeroDetailsQuery_ResponseAdapter { } return HeroDetailsQuery.Data.Hero( - name = _name!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -162,7 +163,7 @@ public object HeroDetailsQuery_ResponseAdapter { } return HeroDetailsQuery.Data.Hero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected index fc75d99c76c..4f78aa71540 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/operationBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -82,8 +83,8 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero( __typename = __typename, - name = _name!!, - birthDate = _birthDate!!, + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate"), onDroid = _onDroid ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected index 6174fa66d10..16e8cbdfe74 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name/kotlin/responseBased/hero_name/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.hero_name.TestQuery @@ -100,9 +101,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, - birthDate = _birthDate!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate"), primaryFunction = _primaryFunction ) } @@ -148,9 +149,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!!, - birthDate = _birthDate!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + birthDate = _birthDate ?: missingField(reader, "birthDate") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/adapter/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/adapter/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName_ResponseAdapter.kt.expected index 1ef30d32eb5..d4e6202ca4c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/adapter/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_name_query_long_name/kotlin/responseBased/hero_name_query_long_name/adapter/TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.hero_name_query_long_name.TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName @@ -69,7 +70,7 @@ public object } return TestQueryWithAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName.Data.HeroAVeryAVeryAVeryAVeryAVeryAVeryAV( - nameAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName = _nameAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName!! + nameAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName = _nameAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName ?: missingField(reader, "nameAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryAVeryLongName") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/adapter/TestQuery_ResponseAdapter.kt.expected index 8f18ae35393..8658266fea6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/hero_with_review/kotlin/responseBased/hero_with_review/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.hero_with_review.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CreateReview( - stars = _stars!!, + stars = _stars ?: missingField(reader, "stars"), commentary = _commentary ) } 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/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected index 054560a4093..67a0238e32e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/operationBased/inline_fragment_for_non_optional_field/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.inline_fragment_for_non_optional_field.TestQuery @@ -36,7 +37,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - nonOptionalHero = _nonOptionalHero!! + nonOptionalHero = _nonOptionalHero ?: missingField(reader, "nonOptionalHero") ) } @@ -78,7 +79,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.NonOptionalHero( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman ) } 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/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected index e8fb9955539..0f769a46d75 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_for_non_optional_field/kotlin/responseBased/inline_fragment_for_non_optional_field/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.inline_fragment_for_non_optional_field.TestQuery import kotlin.Double @@ -36,7 +37,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - nonOptionalHero = _nonOptionalHero!! + nonOptionalHero = _nonOptionalHero ?: missingField(reader, "nonOptionalHero") ) } @@ -97,8 +98,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanNonOptionalHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -139,8 +140,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherNonOptionalHero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 7677ad1c2f8..d5ed950620a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/operationBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -131,7 +132,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Search.OnCharacter( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman, onDroid = _onDroid ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index fe6851ec851..3156bbcb353 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_inside_inline_fragment/kotlin/responseBased/inline_fragment_inside_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.inline_fragment_inside_inline_fragment.TestQuery @@ -101,8 +102,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterHumanSearch( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), homePlanet = _homePlanet ) } @@ -145,8 +146,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterDroidSearch( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -185,7 +186,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherSearch( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected index 9632b3b5c0a..21a9d6ecfc2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/operationBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected @@ -16,6 +16,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.inline_fragment_intersection.TestOperation @@ -42,7 +43,7 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data( - random = _random!! + random = _random ?: missingField(reader, "random") ) } @@ -144,8 +145,8 @@ public object TestOperation_ResponseAdapter { return TestOperation.Data.Random.OnBeing( __typename = __typename, - name = _name!!, - friends = _friends!!, + name = _name ?: missingField(reader, "name"), + friends = _friends ?: missingField(reader, "friends"), onHuman = _onHuman ) } @@ -199,7 +200,7 @@ public object TestOperation_ResponseAdapter { return TestOperation.Data.Random.OnBeing.Friend( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onWookie = _onWookie ) } @@ -270,7 +271,7 @@ public object TestOperation_ResponseAdapter { return TestOperation.Data.Random.OnBeing.OnHuman( profilePictureUrl = _profilePictureUrl, - friends = _friends!! + friends = _friends ?: missingField(reader, "friends") ) } @@ -355,7 +356,7 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Random.OnBeing.OnHuman.Friend.OnWookie( - race = _race!! + race = _race ?: missingField(reader, "race") ) } @@ -389,8 +390,8 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Random.OnWookie( - race = _race!!, - friends = _friends!! + race = _race ?: missingField(reader, "race"), + friends = _friends ?: missingField(reader, "friends") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected index 0aaa5488c67..61cfcfdb6dd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_intersection/kotlin/responseBased/inline_fragment_intersection/adapter/TestOperation_ResponseAdapter.kt.expected @@ -16,6 +16,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.inline_fragment_intersection.TestOperation import com.example.inline_fragment_intersection.type.Race @@ -42,7 +43,7 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data( - random = _random!! + random = _random ?: missingField(reader, "random") ) } @@ -109,9 +110,9 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.BeingHumanRandom( - __typename = __typename!!, - name = _name!!, - friends = _friends!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friends = _friends ?: missingField(reader, "friends"), profilePictureUrl = _profilePictureUrl ) } @@ -187,11 +188,11 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.BeingHumanRandom.WookieFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), lifeExpectancy = _lifeExpectancy, isFamous = _isFamous, - race = _race!! + race = _race ?: missingField(reader, "race") ) } @@ -239,8 +240,8 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.BeingHumanRandom.OtherFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), isFamous = _isFamous ) } @@ -286,10 +287,10 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.BeingWookieRandom( - __typename = __typename!!, - name = _name!!, - friends = _friends!!, - race = _race!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friends = _friends ?: missingField(reader, "friends"), + race = _race ?: missingField(reader, "race") ) } @@ -359,8 +360,8 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.BeingWookieRandom.WookieFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), lifeExpectancy = _lifeExpectancy ) } @@ -403,8 +404,8 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.BeingWookieRandom.OtherFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), lifeExpectancy = _lifeExpectancy ) } @@ -444,7 +445,7 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.OtherRandom( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected index f72a955a1d0..ed9bc69afe8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/operationBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.inline_fragment_merge_fields.TestQuery @@ -72,9 +73,9 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Hero( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection"), onCharacter = _onCharacter ) } @@ -168,7 +169,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -203,9 +204,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnCharacter( - name = _name!!, - profileLink = _profileLink!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + profileLink = _profileLink ?: missingField(reader, "profileLink"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -298,7 +299,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnCharacter.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected index 0e19c55c0be..2d6b30ec33b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_merge_fields/kotlin/responseBased/inline_fragment_merge_fields/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.inline_fragment_merge_fields.TestQuery @@ -71,10 +72,10 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!!, - profileLink = _profileLink!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection"), + profileLink = _profileLink ?: missingField(reader, "profileLink") ) } @@ -167,7 +168,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/adapter/TestQuery_ResponseAdapter.kt.expected index 57aebe0a49f..3f0db6c79cc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_simple/kotlin/responseBased/inline_fragment_simple/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.inline_fragment_simple.TestQuery @@ -94,7 +95,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), height = _height ) } @@ -130,7 +131,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected index 3dc3a1b3c92..f250444c740 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/operationBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -77,7 +78,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Foo( __typename = __typename, - foo = _foo!!, + foo = _foo ?: missingField(reader, "foo"), onBar = _onBar ) } @@ -114,7 +115,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Foo.OnBar( - bar = _bar!! + bar = _bar ?: missingField(reader, "bar") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected index 18595aa3376..9ae4cae0c3d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_type_coercion/kotlin/responseBased/inline_fragment_type_coercion/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.inline_fragment_type_coercion.TestQuery @@ -94,9 +95,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.BarFoo( - __typename = __typename!!, - foo = _foo!!, - bar = _bar!! + __typename = __typename ?: missingField(reader, "__typename"), + foo = _foo ?: missingField(reader, "foo"), + bar = _bar ?: missingField(reader, "bar") ) } @@ -136,8 +137,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherFoo( - __typename = __typename!!, - foo = _foo!! + __typename = __typename ?: missingField(reader, "__typename"), + foo = _foo ?: missingField(reader, "foo") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected index 743ce5bd69f..82c6f35bc1b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragment_with_include_directive/kotlin/operationBased/inline_fragment_with_include_directive/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.and import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.not import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj @@ -95,7 +96,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero( __typename = __typename, - id = _id!!, + id = _id ?: missingField(reader, "id"), onHuman = _onHuman, onDroid = _onDroid, onCharacter = _onCharacter @@ -146,7 +147,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnHuman( - name = _name!!, + name = _name ?: missingField(reader, "name"), homePlanet = _homePlanet ) } @@ -181,7 +182,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnDroid( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -214,7 +215,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnCharacter( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected index 29e5d8faeb7..dfeec6b2c75 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/operationBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -90,7 +91,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman, onDroid = _onDroid ) @@ -167,7 +168,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnHuman.Friend( - appearsIn = _appearsIn!! + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } @@ -232,7 +233,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnDroid.Friend( - id = _id!! + id = _id ?: missingField(reader, "id") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected index d287ba02a44..4c4a9286638 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/inline_fragments_with_friends/kotlin/responseBased/inline_fragments_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.inline_fragments_with_friends.TestQuery @@ -105,8 +106,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height, friends = _friends ) @@ -145,7 +146,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero.Friend( - appearsIn = _appearsIn!! + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } @@ -186,8 +187,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, friends = _friends ) @@ -226,7 +227,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero.Friend( - id = _id!! + id = _id ?: missingField(reader, "id") ) } @@ -261,8 +262,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/adapter/TestQuery_ResponseAdapter.kt.expected index b5d67d69a3a..9064f120f99 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_type/kotlin/responseBased/input_object_type/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.input_object_type.TestQuery @@ -64,7 +65,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CreateReview( - stars = _stars!!, + stars = _stars ?: missingField(reader, "stars"), commentary = _commentary ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/adapter/TestQuery_ResponseAdapter.kt.expected index 11896c034e7..453796bd938 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/input_object_variable_and_argument/kotlin/responseBased/input_object_variable_and_argument/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableDoubleAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.input_object_variable_and_argument.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HeroWithReview( - name = _name!!, + name = _name ?: missingField(reader, "name"), height = _height ) } 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/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected index 492107170da..f28cf2e9052 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/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableDoubleAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.input_object_variable_and_argument_with_generated_methods.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HeroWithReview( - name = _name!!, + name = _name ?: missingField(reader, "name"), height = _height ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/adapter/TestQuery_ResponseAdapter.kt.expected index e4ce88cf029..c58204b3d97 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_always_nested/kotlin/responseBased/interface_always_nested/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.interface_always_nested.TestQuery @@ -98,7 +99,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.ABRoot( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA1 = _fieldA1, fieldB1 = _fieldB1 ) @@ -138,7 +139,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherRoot( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -172,7 +173,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherARoot( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA1 = _fieldA1 ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected index 5e469be16ca..098b04bb316 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/operationBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.interface_on_interface.GetHuman @@ -38,8 +39,8 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data( - human = _human!!, - node = _node!! + human = _human ?: missingField(reader, "human"), + node = _node ?: missingField(reader, "node") ) } @@ -74,9 +75,9 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data.Human( - id = _id!!, - name = _name!!, - height = _height!! + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), + height = _height ?: missingField(reader, "height") ) } @@ -156,7 +157,7 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data.Node.OnHuman( - height = _height!! + height = _height ?: missingField(reader, "height") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected index afba1874287..415e166010c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/interface_on_interface/kotlin/responseBased/interface_on_interface/adapter/GetHuman_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.interface_on_interface.GetHuman import kotlin.Double @@ -38,8 +39,8 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data( - human = _human!!, - node = _node!! + human = _human ?: missingField(reader, "human"), + node = _node ?: missingField(reader, "node") ) } @@ -74,9 +75,9 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data.Human( - id = _id!!, - name = _name!!, - height = _height!! + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), + height = _height ?: missingField(reader, "height") ) } @@ -140,8 +141,8 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data.HumanNode( - __typename = __typename!!, - height = _height!! + __typename = __typename ?: missingField(reader, "__typename"), + height = _height ?: missingField(reader, "height") ) } @@ -176,7 +177,7 @@ public object GetHuman_ResponseAdapter { } return GetHuman.Data.OtherNode( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/adapter/TestQuery_ResponseAdapter.kt.expected index 26ce19d290b..300ba5ec090 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/introspection_query/kotlin/responseBased/introspection_query/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.introspection_query.TestQuery import com.example.introspection_query.type.__TypeKind @@ -37,8 +38,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - __schema = ___schema!!, - __type = ___type!! + __schema = ___schema ?: missingField(reader, "__schema"), + __type = ___type ?: missingField(reader, "__type") ) } @@ -71,8 +72,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.__Schema( - queryType = _queryType!!, - types = _types!! + queryType = _queryType ?: missingField(reader, "queryType"), + types = _types ?: missingField(reader, "types") ) } @@ -165,7 +166,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.__Type( name = _name, - kind = _kind!! + kind = _kind ?: missingField(reader, "kind") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/adapter/LoginBarber_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/adapter/LoginBarber_ResponseAdapter.kt.expected index 904ea726692..71e9ac91911 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/adapter/LoginBarber_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java8annotation/kotlin/responseBased/java8annotation/adapter/LoginBarber_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.java8annotation.LoginBarber import kotlin.String @@ -32,7 +33,7 @@ public object LoginBarber_ResponseAdapter { } return LoginBarber.Data( - login = _login!! + login = _login ?: missingField(reader, "login") ) } @@ -60,7 +61,7 @@ public object LoginBarber_ResponseAdapter { } return LoginBarber.Data.Login( - response = _response!! + response = _response ?: missingField(reader, "response") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/adapter/MyQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/adapter/MyQuery_ResponseAdapter.kt.expected index 6ba60e3478e..d3f08dc78d4 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/adapter/MyQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_android_annotations/kotlin/responseBased/java_android_annotations/adapter/MyQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_android_annotations.MyQuery @@ -51,9 +52,9 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!!, + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType"), nullableListOfNullableString = _nullableListOfNullableString, nullableListOfNonNullableString = _nullableListOfNonNullableString ) @@ -103,7 +104,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -138,7 +139,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/adapter/MyQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/adapter/MyQuery_ResponseAdapter.kt.expected index 65f78249fbb..fdad6dca26f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/adapter/MyQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_apollo_optionals/kotlin/responseBased/java_apollo_optionals/adapter/MyQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_apollo_optionals.MyQuery @@ -51,9 +52,9 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!!, + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType"), nullableListOfNullableString = _nullableListOfNullableString, nullableListOfNonNullableString = _nullableListOfNonNullableString ) @@ -103,7 +104,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -138,7 +139,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/adapter/MyQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/adapter/MyQuery_ResponseAdapter.kt.expected index 1e4eb974722..a268487b920 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/adapter/MyQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_guava_optionals/kotlin/responseBased/java_guava_optionals/adapter/MyQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_guava_optionals.MyQuery @@ -51,9 +52,9 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!!, + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType"), nullableListOfNullableString = _nullableListOfNullableString, nullableListOfNonNullableString = _nullableListOfNonNullableString ) @@ -103,7 +104,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -138,7 +139,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/adapter/MyQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/adapter/MyQuery_ResponseAdapter.kt.expected index 715b1f262c2..eaf129324d2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/adapter/MyQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_java_optionals/kotlin/responseBased/java_java_optionals/adapter/MyQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_java_optionals.MyQuery @@ -51,9 +52,9 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!!, + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType"), nullableListOfNullableString = _nullableListOfNullableString, nullableListOfNonNullableString = _nullableListOfNonNullableString ) @@ -103,7 +104,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -138,7 +139,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/adapter/MyQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/adapter/MyQuery_ResponseAdapter.kt.expected index 44eb5045f41..417f8bd3214 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/adapter/MyQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_jetbrains_annotations/kotlin/responseBased/java_jetbrains_annotations/adapter/MyQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_jetbrains_annotations.MyQuery @@ -51,9 +52,9 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!!, + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType"), nullableListOfNullableString = _nullableListOfNullableString, nullableListOfNonNullableString = _nullableListOfNonNullableString ) @@ -103,7 +104,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -138,7 +139,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/adapter/MyQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/adapter/MyQuery_ResponseAdapter.kt.expected index 71fb7dbcd6e..22e71ee6e4a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/adapter/MyQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_jsr305_annotations/kotlin/responseBased/java_jsr305_annotations/adapter/MyQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_jsr305_annotations.MyQuery @@ -51,9 +52,9 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!!, + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType"), nullableListOfNullableString = _nullableListOfNullableString, nullableListOfNonNullableString = _nullableListOfNonNullableString ) @@ -103,7 +104,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -138,7 +139,7 @@ public object MyQuery_ResponseAdapter { return MyQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/adapter/JavaPrimitiveQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/adapter/JavaPrimitiveQuery_ResponseAdapter.kt.expected index ddf38e4eb5b..688cb308bff 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/adapter/JavaPrimitiveQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/java_primitive_types/kotlin/responseBased/java_primitive_types/adapter/JavaPrimitiveQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.NullableIntAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.java_primitive_types.JavaPrimitiveQuery @@ -43,9 +44,9 @@ public object JavaPrimitiveQuery_ResponseAdapter { return JavaPrimitiveQuery.Data( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!!, + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt"), nullableMyType = _nullableMyType, - nonNullableMyType = _nonNullableMyType!! + nonNullableMyType = _nonNullableMyType ?: missingField(reader, "nonNullableMyType") ) } @@ -85,7 +86,7 @@ public object JavaPrimitiveQuery_ResponseAdapter { return JavaPrimitiveQuery.Data.NullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } @@ -120,7 +121,7 @@ public object JavaPrimitiveQuery_ResponseAdapter { return JavaPrimitiveQuery.Data.NonNullableMyType( nullableInt = _nullableInt, - nonNullableInt = _nonNullableInt!! + nonNullableInt = _nonNullableInt ?: missingField(reader, "nonNullableInt") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/measurements b/libraries/apollo-compiler/src/test/graphql/com/example/measurements index 18bbaa622a2..e6e4e6d8145 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/measurements +++ b/libraries/apollo-compiler/src/test/graphql/com/example/measurements @@ -2,243 +2,243 @@ // If you updated the codegen and test fixtures, you should commit this file too. Test: Total LOC: -aggregate-all 194857 -aggregate-kotlin-responseBased 61996 -aggregate-kotlin-operationBased 40603 +aggregate-all 195062 +aggregate-kotlin-responseBased 62116 +aggregate-kotlin-operationBased 40688 aggregate-kotlin-compat 0 aggregate-java-operationBased 92258 java-operationBased-fragments_with_defer_and_include_directives 5552 -kotlin-operationBased-fragments_with_defer_and_include_directives 3459 +kotlin-operationBased-fragments_with_defer_and_include_directives 3467 java-operationBased-data_builders 2933 -kotlin-responseBased-fragment_with_inline_fragment 2404 +kotlin-responseBased-fragment_with_inline_fragment 2408 java-operationBased-mutation_create_review 2379 -kotlin-responseBased-data_builders 2271 +kotlin-responseBased-data_builders 2278 java-operationBased-fragment_with_inline_fragment 2227 -kotlin-operationBased-data_builders 1922 +kotlin-operationBased-data_builders 1929 java-operationBased-nested_named_fragments 1868 java-operationBased-union_inline_fragments 1633 java-operationBased-fragment_spread_with_include_directive 1625 java-operationBased-unique_type_name 1623 -kotlin-responseBased-nested_named_fragments 1601 +kotlin-responseBased-nested_named_fragments 1604 java-operationBased-inline_fragment_intersection 1599 java-operationBased-input_object_type 1596 java-operationBased-mutation_create_review_semantic_naming 1579 java-operationBased-root_query_fragment_with_nested_fragments 1565 java-operationBased-named_fragment_delegate 1466 java-operationBased-simple_fragment 1465 -kotlin-responseBased-mutation_create_review 1386 +kotlin-responseBased-mutation_create_review 1387 java-operationBased-named_fragment_with_variables 1367 -kotlin-responseBased-named_fragment_delegate 1346 -kotlin-responseBased-unique_type_name 1327 +kotlin-responseBased-named_fragment_delegate 1349 +kotlin-responseBased-unique_type_name 1329 java-operationBased-nested_conditional_inline 1297 java-operationBased-fragment_used_twice 1278 -kotlin-operationBased-fragment_with_inline_fragment 1268 +kotlin-operationBased-fragment_with_inline_fragment 1272 java-operationBased-multiple_fragments 1265 java-operationBased-nested_field_with_multiple_fieldsets 1255 -kotlin-responseBased-root_query_fragment_with_nested_fragments 1251 -kotlin-responseBased-input_object_type 1238 -kotlin-operationBased-nested_named_fragments 1231 +kotlin-responseBased-root_query_fragment_with_nested_fragments 1255 +kotlin-responseBased-input_object_type 1239 +kotlin-operationBased-nested_named_fragments 1234 java-operationBased-two_heroes_with_friends 1212 +kotlin-responseBased-inline_fragment_intersection 1209 java-operationBased-inline_fragment_merge_fields 1209 -kotlin-responseBased-inline_fragment_intersection 1208 +kotlin-responseBased-simple_fragment 1164 java-operationBased-named_fragment_inside_inline_fragment 1162 -kotlin-responseBased-simple_fragment 1161 java-operationBased-fragments_with_type_condition 1157 -kotlin-responseBased-fragment_used_twice 1134 +kotlin-responseBased-fragment_used_twice 1138 java-operationBased-target_name 1134 -kotlin-operationBased-inline_fragment_intersection 1121 -kotlin-operationBased-union_inline_fragments 1118 -kotlin-responseBased-union_inline_fragments 1112 +kotlin-operationBased-inline_fragment_intersection 1122 +kotlin-operationBased-union_inline_fragments 1119 +kotlin-responseBased-union_inline_fragments 1113 java-operationBased-root_query_inline_fragment 1096 +kotlin-operationBased-fragment_spread_with_include_directive 1091 java-operationBased-java_jetbrains_annotations 1091 -kotlin-operationBased-fragment_spread_with_include_directive 1088 +kotlin-operationBased-unique_type_name 1089 java-operationBased-java_android_annotations 1088 java-operationBased-java_jsr305_annotations 1088 -kotlin-operationBased-unique_type_name 1087 -kotlin-responseBased-fragments_with_type_condition 1080 +kotlin-responseBased-fragments_with_type_condition 1083 java-operationBased-java_guava_optionals 1072 java-operationBased-java_java_optionals 1072 java-operationBased-java_apollo_optionals 1071 -kotlin-responseBased-multiple_fragments 1054 +kotlin-responseBased-multiple_fragments 1056 java-operationBased-simple_fragment_with_inline_fragments 1046 java-operationBased-inline_fragments_with_friends 1038 -kotlin-operationBased-root_query_fragment_with_nested_fragments 1033 +kotlin-operationBased-root_query_fragment_with_nested_fragments 1037 +kotlin-responseBased-simple_fragment_with_inline_fragments 1031 java-operationBased-fragment_spread_with_nested_fields 1030 -kotlin-responseBased-simple_fragment_with_inline_fragments 1029 -kotlin-responseBased-nested_conditional_inline 1028 +kotlin-responseBased-nested_conditional_inline 1029 java-operationBased-operationbased2_ex8 1026 -kotlin-responseBased-named_fragment_with_variables 1020 +kotlin-responseBased-named_fragment_with_variables 1023 java-operationBased-java_primitive_types 1015 -kotlin-operationBased-simple_fragment 1011 -kotlin-operationBased-named_fragment_delegate 991 +kotlin-operationBased-simple_fragment 1012 +kotlin-operationBased-named_fragment_delegate 993 java-operationBased-decapitalized_fields 975 java-operationBased-fragments_same_type_condition 951 java-operationBased-simple_union 949 -kotlin-responseBased-operationbased2_ex8 943 +kotlin-responseBased-operationbased2_ex8 945 java-operationBased-deprecated_merged_field 929 java-operationBased-hero_details 919 java-operationBased-not_all_combinations_are_needed 919 java-operationBased-fieldset_with_multiple_super 901 java-operationBased-simple_inline_fragment 901 java-operationBased-inline_fragment_with_include_directive 898 -kotlin-operationBased-nested_conditional_inline 896 +kotlin-operationBased-nested_conditional_inline 897 java-operationBased-introspection_query 890 -kotlin-responseBased-mutation_create_review_semantic_naming 880 -kotlin-operationBased-fragment_used_twice 874 -kotlin-operationBased-named_fragment_with_variables 872 +kotlin-responseBased-mutation_create_review_semantic_naming 881 +kotlin-operationBased-fragment_used_twice 877 +kotlin-operationBased-named_fragment_with_variables 875 java-operationBased-test_inline 865 java-operationBased-union_fragment 863 -kotlin-responseBased-fragment_spread_with_nested_fields 857 +kotlin-responseBased-fragment_spread_with_nested_fields 859 java-operationBased-inline_fragment_inside_inline_fragment 854 -kotlin-operationBased-multiple_fragments 834 -kotlin-responseBased-nested_field_with_multiple_fieldsets 830 +kotlin-operationBased-multiple_fragments 835 +kotlin-responseBased-nested_field_with_multiple_fieldsets 831 java-operationBased-named_fragment_without_implementation 822 -kotlin-operationBased-fragments_with_type_condition 812 +kotlin-operationBased-fragments_with_type_condition 814 kotlin-operationBased-nested_field_with_multiple_fieldsets 803 +kotlin-operationBased-named_fragment_inside_inline_fragment 790 java-operationBased-fragment_with_multiple_fieldsets 787 -kotlin-operationBased-named_fragment_inside_inline_fragment 787 java-operationBased-hero_details_semantic_naming 783 +kotlin-operationBased-inline_fragment_merge_fields 782 java-operationBased-operationbased2_ex7 782 -kotlin-operationBased-inline_fragment_merge_fields 781 -kotlin-responseBased-two_heroes_with_friends 780 -kotlin-responseBased-target_name 776 +kotlin-responseBased-two_heroes_with_friends 781 +kotlin-responseBased-target_name 777 java-operationBased-suppressed_warnings 775 -kotlin-responseBased-inline_fragments_with_friends 770 -kotlin-responseBased-deprecated_merged_field 767 -kotlin-responseBased-named_fragment_inside_inline_fragment 767 -kotlin-operationBased-root_query_inline_fragment 767 +kotlin-responseBased-inline_fragments_with_friends 771 +kotlin-responseBased-named_fragment_inside_inline_fragment 770 +kotlin-responseBased-deprecated_merged_field 769 +kotlin-operationBased-root_query_inline_fragment 768 java-operationBased-path_vs_flat_accessors 762 -kotlin-responseBased-simple_union 749 +kotlin-responseBased-simple_union 752 kotlin-operationBased-target_name 749 -kotlin-responseBased-root_query_inline_fragment 743 +kotlin-responseBased-root_query_inline_fragment 744 java-operationBased-reserved_keywords 741 java-operationBased-typename_always_first 738 -kotlin-responseBased-fragments_same_type_condition 721 -kotlin-operationBased-inline_fragments_with_friends 719 +kotlin-responseBased-fragments_same_type_condition 723 +kotlin-operationBased-inline_fragments_with_friends 720 java-operationBased-interface_on_interface 714 java-operationBased-root_query_fragment 701 -kotlin-operationBased-simple_fragment_with_inline_fragments 699 +kotlin-operationBased-simple_fragment_with_inline_fragments 701 java-operationBased-input_object_variable_and_argument 698 java-operationBased-input_object_variable_and_argument_with_generated_methods 698 -kotlin-operationBased-fragment_spread_with_nested_fields 686 +kotlin-operationBased-fragment_spread_with_nested_fields 688 +kotlin-operationBased-operationbased2_ex8 672 java-operationBased-monomorphic 671 -kotlin-operationBased-operationbased2_ex8 670 java-operationBased-interface_always_nested 669 -kotlin-operationBased-fragments_same_type_condition 651 +kotlin-operationBased-fragments_same_type_condition 652 java-operationBased-capitalized_fields 650 -kotlin-operationBased-simple_union 648 +kotlin-operationBased-simple_union 650 +kotlin-responseBased-fragment_with_multiple_fieldsets 647 java-operationBased-recursive_selection 647 -kotlin-responseBased-fragment_with_multiple_fieldsets 645 -kotlin-responseBased-union_fragment 645 -kotlin-responseBased-test_inline 642 +kotlin-responseBased-union_fragment 647 +kotlin-responseBased-test_inline 643 java-operationBased-hero_with_review 640 java-operationBased-deprecation 637 -kotlin-operationBased-decapitalized_fields 634 -kotlin-responseBased-named_fragment_without_implementation 633 -kotlin-operationBased-deprecated_merged_field 628 -kotlin-responseBased-hero_details 628 -kotlin-responseBased-input_object_variable_and_argument_with_generated_methods 625 -kotlin-operationBased-not_all_combinations_are_needed 623 +kotlin-operationBased-decapitalized_fields 635 +kotlin-responseBased-named_fragment_without_implementation 634 +kotlin-operationBased-deprecated_merged_field 630 +kotlin-responseBased-hero_details 629 +kotlin-responseBased-input_object_variable_and_argument_with_generated_methods 626 +kotlin-operationBased-not_all_combinations_are_needed 624 java-operationBased-field_with_include_directive 621 java-operationBased-hero_name_query_long_name 621 -kotlin-operationBased-union_fragment 617 -kotlin-operationBased-inline_fragment_inside_inline_fragment 616 +kotlin-operationBased-union_fragment 619 +kotlin-operationBased-inline_fragment_inside_inline_fragment 617 java-operationBased-custom_scalar_type 615 java-operationBased-variable_default_value 613 -kotlin-responseBased-inline_fragment_inside_inline_fragment 611 -kotlin-responseBased-inline_fragment_merge_fields 611 -kotlin-operationBased-inline_fragment_with_include_directive 611 +kotlin-responseBased-inline_fragment_inside_inline_fragment 612 +kotlin-responseBased-inline_fragment_merge_fields 612 +kotlin-operationBased-inline_fragment_with_include_directive 612 java-operationBased-hero_name 610 kotlin-operationBased-fieldset_with_multiple_super 609 -kotlin-operationBased-simple_inline_fragment 602 -kotlin-responseBased-operationbased2_ex7 601 -kotlin-operationBased-named_fragment_without_implementation 600 -kotlin-responseBased-not_all_combinations_are_needed 597 -kotlin-responseBased-decapitalized_fields 595 -kotlin-responseBased-fieldset_with_multiple_super 595 +kotlin-operationBased-simple_inline_fragment 603 +kotlin-responseBased-operationbased2_ex7 602 +kotlin-operationBased-named_fragment_without_implementation 601 +kotlin-responseBased-not_all_combinations_are_needed 598 +kotlin-responseBased-decapitalized_fields 596 +kotlin-responseBased-fieldset_with_multiple_super 596 +kotlin-responseBased-simple_inline_fragment 596 java-operationBased-java8annotation 595 -kotlin-responseBased-simple_inline_fragment 595 -kotlin-responseBased-java_android_annotations 593 -kotlin-responseBased-java_apollo_optionals 593 -kotlin-responseBased-java_guava_optionals 593 -kotlin-responseBased-java_java_optionals 593 -kotlin-responseBased-java_jetbrains_annotations 593 -kotlin-responseBased-java_jsr305_annotations 593 +kotlin-responseBased-java_android_annotations 594 +kotlin-responseBased-java_apollo_optionals 594 +kotlin-responseBased-java_guava_optionals 594 +kotlin-responseBased-java_java_optionals 594 +kotlin-responseBased-java_jetbrains_annotations 594 +kotlin-responseBased-java_jsr305_annotations 594 +kotlin-responseBased-introspection_query 592 java-operationBased-optional 592 -kotlin-responseBased-introspection_query 591 java-operationBased-enum_field 581 java-operationBased-inline_fragment_for_non_optional_field 579 java-operationBased-inline_fragment_type_coercion 573 -kotlin-responseBased-reserved_keywords 569 -kotlin-operationBased-test_inline 569 +kotlin-responseBased-reserved_keywords 570 +kotlin-operationBased-test_inline 570 java-operationBased-two_heroes_unique 568 java-operationBased-list_field_clash 561 +kotlin-responseBased-java_primitive_types 558 java-operationBased-inline_fragment_simple 557 -kotlin-responseBased-java_primitive_types 557 -kotlin-responseBased-path_vs_flat_accessors 546 -kotlin-operationBased-reserved_keywords 542 -kotlin-responseBased-input_object_variable_and_argument 536 -kotlin-responseBased-hero_details_semantic_naming 532 -kotlin-operationBased-fragment_with_multiple_fieldsets 531 -kotlin-responseBased-root_query_fragment 528 -kotlin-responseBased-typename_always_first 525 -kotlin-operationBased-operationbased2_ex7 522 +kotlin-responseBased-path_vs_flat_accessors 547 +kotlin-operationBased-reserved_keywords 543 +kotlin-responseBased-input_object_variable_and_argument 537 +kotlin-responseBased-hero_details_semantic_naming 533 +kotlin-operationBased-fragment_with_multiple_fieldsets 532 +kotlin-responseBased-root_query_fragment 530 +kotlin-responseBased-typename_always_first 526 +kotlin-operationBased-operationbased2_ex7 523 +kotlin-responseBased-interface_on_interface 522 java-operationBased-starships 522 -kotlin-responseBased-interface_on_interface 521 -kotlin-responseBased-suppressed_warnings 517 +kotlin-responseBased-suppressed_warnings 518 kotlin-operationBased-path_vs_flat_accessors 516 -kotlin-operationBased-typename_always_first 514 +kotlin-operationBased-typename_always_first 515 java-operationBased-antlr_tokens 509 java-operationBased-subscriptions 505 -kotlin-responseBased-hero_with_review 501 -kotlin-responseBased-hero_name 498 -kotlin-operationBased-interface_on_interface 495 -kotlin-responseBased-hero_name_query_long_name 492 -kotlin-responseBased-interface_always_nested 490 +kotlin-responseBased-hero_with_review 502 +kotlin-responseBased-hero_name 499 +kotlin-operationBased-interface_on_interface 496 +kotlin-responseBased-hero_name_query_long_name 493 +kotlin-responseBased-interface_always_nested 491 java-operationBased-arguments_hardcoded 484 -kotlin-operationBased-root_query_fragment 479 -kotlin-responseBased-custom_scalar_type 477 +kotlin-operationBased-root_query_fragment 481 +kotlin-responseBased-custom_scalar_type 478 kotlin-operationBased-interface_always_nested 463 java-operationBased-merged_include 462 java-operationBased-operation_id_generator 462 -kotlin-responseBased-variable_default_value 461 -kotlin-responseBased-deprecation 459 -kotlin-operationBased-monomorphic 459 +kotlin-responseBased-variable_default_value 462 +kotlin-responseBased-deprecation 460 +kotlin-operationBased-monomorphic 460 +kotlin-responseBased-monomorphic 459 kotlin-responseBased-enum_field 458 -kotlin-responseBased-monomorphic 458 -kotlin-responseBased-inline_fragment_for_non_optional_field 455 +kotlin-responseBased-inline_fragment_for_non_optional_field 456 java-operationBased-enums_as_sealed 453 java-operationBased-case_sensitive_enum 450 -kotlin-responseBased-optional 446 +kotlin-responseBased-optional 447 java-operationBased-nonnull 443 -kotlin-operationBased-hero_name 441 -kotlin-operationBased-capitalized_fields 440 -kotlin-responseBased-inline_fragment_type_coercion 436 +kotlin-operationBased-hero_name 442 +kotlin-operationBased-capitalized_fields 441 +kotlin-responseBased-inline_fragment_type_coercion 437 java-operationBased-companion 435 kotlin-responseBased-field_with_include_directive 435 java-operationBased-object 430 -kotlin-responseBased-recursive_selection 427 -kotlin-responseBased-inline_fragment_simple 419 -kotlin-operationBased-inline_fragment_for_non_optional_field 412 +kotlin-responseBased-recursive_selection 428 +kotlin-responseBased-inline_fragment_simple 420 +kotlin-operationBased-inline_fragment_for_non_optional_field 413 kotlin-responseBased-list_field_clash 405 -kotlin-responseBased-capitalized_fields 402 -kotlin-operationBased-inline_fragment_type_coercion 401 -kotlin-responseBased-two_heroes_unique 397 +kotlin-responseBased-capitalized_fields 403 +kotlin-operationBased-inline_fragment_type_coercion 402 +kotlin-responseBased-two_heroes_unique 398 kotlin-operationBased-inline_fragment_simple 393 -kotlin-responseBased-starships 382 +kotlin-responseBased-starships 383 +kotlin-responseBased-java8annotation 382 kotlin-responseBased-antlr_tokens 381 -kotlin-responseBased-java8annotation 381 -kotlin-responseBased-arguments_hardcoded 369 -kotlin-responseBased-subscriptions 369 +kotlin-responseBased-arguments_hardcoded 370 +kotlin-responseBased-subscriptions 370 kotlin-responseBased-enums_as_sealed 352 kotlin-responseBased-case_sensitive_enum 333 -kotlin-responseBased-operation_id_generator 332 +kotlin-responseBased-operation_id_generator 333 java-operationBased-java_hashcode 331 -kotlin-responseBased-merged_include 330 -kotlin-responseBased-big_query 324 -kotlin-responseBased-nonnull 316 -kotlin-operationBased-companion 309 +kotlin-responseBased-merged_include 331 +kotlin-responseBased-big_query 325 +kotlin-responseBased-nonnull 317 +kotlin-operationBased-companion 310 kotlin-responseBased-object 308 kotlin-responseBased-java_hashcode 248 kotlin-responseBased-__schema 128 diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/adapter/TestQuery_ResponseAdapter.kt.expected index dd7bc22089e..b59a6bdcd9c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/merged_include/kotlin/responseBased/merged_include/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.merged_include.TestQuery @@ -63,8 +64,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - name = _name!!, - id = _id!! + name = _name ?: missingField(reader, "name"), + id = _id ?: missingField(reader, "id") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected index 2501b44fe1d..5815046da27 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/operationBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.monomorphic.TestQuery import kotlin.String @@ -32,7 +33,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - cat = _cat!! + cat = _cat ?: missingField(reader, "cat") ) } @@ -64,7 +65,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Cat( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onNode = _onNode ) } @@ -100,7 +101,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Cat.OnNode( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onAnimal = _onAnimal ) } @@ -132,7 +133,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Cat.OnNode.OnAnimal( - species = _species!! + species = _species ?: missingField(reader, "species") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected index 83380f7079c..5cdcdf5ae8d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/monomorphic/kotlin/responseBased/monomorphic/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.monomorphic.TestQuery import kotlin.String @@ -34,7 +35,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - cat = _cat!! + cat = _cat ?: missingField(reader, "cat") ) } @@ -91,8 +92,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.AnimalNodeCat( - __typename = __typename!!, - species = _species!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species") ) } @@ -127,7 +128,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherCat( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected index d5a8afc52c0..a0d77b7e2d8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/operationBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.multiple_fragments.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.A( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), aFragment = _aFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected index 697caecfad9..9464206ee5d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.multiple_fragments.TestQuery @@ -66,7 +67,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.A( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), node = _node ) } @@ -129,7 +130,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.A.ANodeNode( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), field1 = _field1, field2 = _field2 ) @@ -169,7 +170,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.A.OtherNode( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl_ResponseAdapter.kt.expected index 013d000447c..13983af6aff 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/multiple_fragments/kotlin/responseBased/multiple_fragments/fragment/AFragmentImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -94,7 +95,7 @@ public object AFragmentImpl_ResponseAdapter { } return AFragmentImpl.Data.ANodeNode( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), field1 = _field1, field2 = _field2 ) @@ -134,7 +135,7 @@ public object AFragmentImpl_ResponseAdapter { } return AFragmentImpl.Data.OtherNode( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/kotlin/responseBased/mutation_create_review/adapter/CreateReviewForEpisode_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/kotlin/responseBased/mutation_create_review/adapter/CreateReviewForEpisode_ResponseAdapter.kt.expected index a45ce2d9262..1e0bfb32620 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/kotlin/responseBased/mutation_create_review/adapter/CreateReviewForEpisode_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review/kotlin/responseBased/mutation_create_review/adapter/CreateReviewForEpisode_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.mutation_create_review.CreateReviewForEpisode @@ -78,7 +79,7 @@ internal object CreateReviewForEpisode_ResponseAdapter { } return CreateReviewForEpisode.Data.CreateReview( - stars = _stars!!, + stars = _stars ?: missingField(reader, "stars"), commentary = _commentary, listOfListOfString = _listOfListOfString, listOfListOfEnum = _listOfListOfEnum, @@ -132,7 +133,7 @@ internal object CreateReviewForEpisode_ResponseAdapter { } return CreateReviewForEpisode.Data.CreateReview.ListOfListOfObject( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/kotlin/responseBased/mutation_create_review_semantic_naming/adapter/CreateReviewForEpisodeMutation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/kotlin/responseBased/mutation_create_review_semantic_naming/adapter/CreateReviewForEpisodeMutation_ResponseAdapter.kt.expected index 6ceeef855fe..468163b9545 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/kotlin/responseBased/mutation_create_review_semantic_naming/adapter/CreateReviewForEpisodeMutation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/mutation_create_review_semantic_naming/kotlin/responseBased/mutation_create_review_semantic_naming/adapter/CreateReviewForEpisodeMutation_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.mutation_create_review_semantic_naming.CreateReviewForEpisodeMutation @@ -66,7 +67,7 @@ public object CreateReviewForEpisodeMutation_ResponseAdapter { } return CreateReviewForEpisodeMutation.Data.CreateReview( - stars = _stars!!, + stars = _stars ?: missingField(reader, "stars"), commentary = _commentary ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected index f259956b452..6a8800868e7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -39,7 +40,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return com.example.named_fragment_delegate.fragment.DroidDetails( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, friends = _friends ) @@ -76,7 +77,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return com.example.named_fragment_delegate.fragment.DroidDetails.Friend( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index 8f3d46a88a4..545ee9f72fd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/operationBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Any @@ -40,9 +41,9 @@ public object HumanDetailsImpl_ResponseAdapter { } return com.example.named_fragment_delegate.fragment.HumanDetails( - name = _name!!, - profileLink = _profileLink!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + profileLink = _profileLink ?: missingField(reader, "profileLink"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -138,7 +139,7 @@ public object HumanDetailsImpl_ResponseAdapter { } return com.example.named_fragment_delegate.fragment.HumanDetails.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/adapter/TestQuery_ResponseAdapter.kt.expected index 472c85263a5..0a3412852f9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.named_fragment_delegate.TestQuery @@ -104,8 +105,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, friends = _friends ) @@ -144,7 +145,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero.Friend( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -184,10 +185,10 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, - profileLink = _profileLink!!, - friendsConnection = _friendsConnection!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + profileLink = _profileLink ?: missingField(reader, "profileLink"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -282,7 +283,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -317,7 +318,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected index e8acb4072c4..49a3e0b0d1f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/DroidDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -38,7 +39,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return DroidDetailsImpl.Data( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, friends = _friends ) @@ -74,7 +75,7 @@ public object DroidDetailsImpl_ResponseAdapter { } return DroidDetailsImpl.Data.Friend( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index 91d408812de..7ab614ed413 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_delegate/kotlin/responseBased/named_fragment_delegate/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Any @@ -39,9 +40,9 @@ public object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.Data( - name = _name!!, - profileLink = _profileLink!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + profileLink = _profileLink ?: missingField(reader, "profileLink"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -131,7 +132,7 @@ public object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.Data.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected index 2e4929463c2..e7ce8f8608c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.named_fragment_inside_inline_fragment.GetHero @@ -65,7 +66,7 @@ public object GetHero_ResponseAdapter { adapterContext) return GetHero.Data.Hero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onCharacter = _onCharacter ) } @@ -105,7 +106,7 @@ public object GetHero_ResponseAdapter { adapterContext) return GetHero.Data.Hero.OnCharacter( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), characterName = _characterName, characterAppearsIn = _characterAppearsIn ) 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 13ae3fe7b70..a0d99d4c783 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.example.named_fragment_inside_inline_fragment.type.Episode import com.example.named_fragment_inside_inline_fragment.type.adapter.Episode_ResponseAdapter @@ -35,7 +36,7 @@ public object CharacterAppearsInImpl_ResponseAdapter { } return com.example.named_fragment_inside_inline_fragment.fragment.CharacterAppearsIn( - appearsIn = _appearsIn!! + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 1dded4f9ba6..31666b4789e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/operationBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -31,7 +32,7 @@ public object CharacterNameImpl_ResponseAdapter { } return com.example.named_fragment_inside_inline_fragment.fragment.CharacterName( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected index ab18876fd2f..77d910e51a3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/adapter/GetHero_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.named_fragment_inside_inline_fragment.GetHero @@ -68,9 +69,9 @@ public object GetHero_ResponseAdapter { } return GetHero.Data.Hero( - __typename = __typename!!, - name = _name!!, - appearsIn = _appearsIn!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index cd4cec31e3c..5d07c8bae65 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterAppearsInImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.example.named_fragment_inside_inline_fragment.type.Episode import com.example.named_fragment_inside_inline_fragment.type.adapter.Episode_ResponseAdapter @@ -33,7 +34,7 @@ public object CharacterAppearsInImpl_ResponseAdapter { } return CharacterAppearsInImpl.Data( - appearsIn = _appearsIn!! + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 8b29ba62b94..aad8b70c650 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_inside_inline_fragment/kotlin/responseBased/named_fragment_inside_inline_fragment/fragment/CharacterNameImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object CharacterNameImpl_ResponseAdapter { } return CharacterNameImpl.Data( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected index 2fdec853637..71f0d464546 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.example.named_fragment_with_variables.GetUser import kotlin.String import kotlin.collections.List @@ -35,7 +36,7 @@ public object GetUser_ResponseAdapter { adapterContext) return GetUser.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), queryFragment = _queryFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected index 6da943b0f7c..79fcba1a898 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -66,8 +67,8 @@ public object QueryFragmentImpl_ResponseAdapter { } return com.example.named_fragment_with_variables.fragment.QueryFragment.Organization( - id = _id!!, - user = _user!! + id = _id ?: missingField(reader, "id"), + user = _user ?: missingField(reader, "user") ) } @@ -104,7 +105,7 @@ public object QueryFragmentImpl_ResponseAdapter { adapterContext) return com.example.named_fragment_with_variables.fragment.QueryFragment.Organization.User( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), userFragment = _userFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected index d6d2bcbccee..1fac24b39bf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/operationBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -35,9 +36,9 @@ public object UserFragmentImpl_ResponseAdapter { } return com.example.named_fragment_with_variables.fragment.UserFragment( - firstName = _firstName!!, - lastName = _lastName!!, - avatar = _avatar!! + firstName = _firstName ?: missingField(reader, "firstName"), + lastName = _lastName ?: missingField(reader, "lastName"), + avatar = _avatar ?: missingField(reader, "avatar") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected index eb6eaa31b8a..60060563ca2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/adapter/GetUser_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.named_fragment_with_variables.GetUser @@ -36,7 +37,7 @@ public object GetUser_ResponseAdapter { } return GetUser.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), organization = _organization ) } @@ -70,8 +71,8 @@ public object GetUser_ResponseAdapter { } return GetUser.Data.Organization( - id = _id!!, - user = _user!! + id = _id ?: missingField(reader, "id"), + user = _user ?: missingField(reader, "user") ) } @@ -109,10 +110,10 @@ public object GetUser_ResponseAdapter { } return GetUser.Data.Organization.User( - __typename = __typename!!, - firstName = _firstName!!, - lastName = _lastName!!, - avatar = _avatar!! + __typename = __typename ?: missingField(reader, "__typename"), + firstName = _firstName ?: missingField(reader, "firstName"), + lastName = _lastName ?: missingField(reader, "lastName"), + avatar = _avatar ?: missingField(reader, "avatar") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected index d2e06696f1d..747cb3ce3e2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -63,8 +64,8 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data.Organization( - id = _id!!, - user = _user!! + id = _id ?: missingField(reader, "id"), + user = _user ?: missingField(reader, "user") ) } @@ -102,10 +103,10 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data.Organization.User( - __typename = __typename!!, - firstName = _firstName!!, - lastName = _lastName!!, - avatar = _avatar!! + __typename = __typename ?: missingField(reader, "__typename"), + firstName = _firstName ?: missingField(reader, "firstName"), + lastName = _lastName ?: missingField(reader, "lastName"), + avatar = _avatar ?: missingField(reader, "avatar") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected index 7e0a49c103b..a404c8eb299 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_with_variables/kotlin/responseBased/named_fragment_with_variables/fragment/UserFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -34,9 +35,9 @@ public object UserFragmentImpl_ResponseAdapter { } return UserFragmentImpl.Data( - firstName = _firstName!!, - lastName = _lastName!!, - avatar = _avatar!! + firstName = _firstName ?: missingField(reader, "firstName"), + lastName = _lastName ?: missingField(reader, "lastName"), + avatar = _avatar ?: missingField(reader, "avatar") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected index 70baa074641..9114c23c6ef 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/operationBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -86,7 +87,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), humanDetails = _humanDetails, droidDetails = _droidDetails ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected index 1427d3d3eca..318f0c97e4c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/named_fragment_without_implementation/kotlin/responseBased/named_fragment_without_implementation/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.named_fragment_without_implementation.TestQuery @@ -100,8 +101,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -144,8 +145,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -186,8 +187,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected index 7be95aa54ac..01976ce709a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/operationBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -87,7 +88,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman, onDroid = _onDroid ) @@ -173,7 +174,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero.OnHuman.Friend( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman ) } @@ -284,7 +285,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero.OnDroid.Friend( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected index e734b68e4b8..4eda41eae2a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_conditional_inline/kotlin/responseBased/nested_conditional_inline/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.nested_conditional_inline.TestQuery @@ -100,8 +101,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -169,8 +170,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero.HumanFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -211,8 +212,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero.OtherFriend( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -252,8 +253,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -321,8 +322,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero.HumanFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -363,8 +364,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero.OtherFriend( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -402,8 +403,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected index f4ff9ab024a..084285a064f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_field_with_multiple_fieldsets/kotlin/responseBased/nested_field_with_multiple_fieldsets/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.nested_field_with_multiple_fieldsets.TestQuery @@ -93,7 +94,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Impl1Iface1( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), iface2 = _iface2 ) } @@ -163,7 +164,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Impl1Iface1.Impl2Iface2( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), scalar1 = _scalar1, scalar2 = _scalar2, scalar3 = _scalar3, @@ -215,7 +216,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Impl1Iface1.OtherIface2( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), scalar1 = _scalar1, scalar3 = _scalar3 ) @@ -258,7 +259,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherIface1( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), iface2 = _iface2 ) } @@ -323,7 +324,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherIface1.Impl2Iface2( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), scalar1 = _scalar1, scalar2 = _scalar2 ) @@ -365,7 +366,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherIface1.OtherIface2( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), scalar1 = _scalar1 ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected index 08ce20f763f..c464c41686f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.nested_named_fragments.AllStarships @@ -126,7 +127,7 @@ public object AllStarships_ResponseAdapter { adapterContext) return com.example.nested_named_fragments.AllStarships.Data.AllStarships.Edge.Node( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), starshipFragment = _starshipFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected index 681b7387c07..837d3f22aca 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -73,7 +74,7 @@ public object PilotFragmentImpl_ResponseAdapter { adapterContext) return com.example.nested_named_fragments.fragment.PilotFragment.Homeworld( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), planetFragment = _planetFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected index 2ef5dcb0857..f4eafb4679d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/operationBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -39,7 +40,7 @@ public object StarshipFragmentImpl_ResponseAdapter { } return com.example.nested_named_fragments.fragment.StarshipFragment( - id = _id!!, + id = _id ?: missingField(reader, "id"), name = _name, pilotConnection = _pilotConnection ) @@ -141,7 +142,7 @@ public object StarshipFragmentImpl_ResponseAdapter { adapterContext) return com.example.nested_named_fragments.fragment.StarshipFragment.PilotConnection.Edge.Node( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), pilotFragment = _pilotFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected index cdf9360dcb0..e20fc88d25e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/adapter/AllStarships_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.nested_named_fragments.AllStarships @@ -130,8 +131,8 @@ public object AllStarships_ResponseAdapter { } return com.example.nested_named_fragments.AllStarships.Data.AllStarships.Edge.Node( - __typename = __typename!!, - id = _id!!, + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), name = _name, pilotConnection = _pilotConnection ) @@ -236,7 +237,7 @@ public object AllStarships_ResponseAdapter { } return com.example.nested_named_fragments.AllStarships.Data.AllStarships.Edge.Node.PilotConnection.Edge.Node( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), name = _name, homeworld = _homeworld ) @@ -277,7 +278,7 @@ public object AllStarships_ResponseAdapter { } return com.example.nested_named_fragments.AllStarships.Data.AllStarships.Edge.Node.PilotConnection.Edge.Node.Homeworld( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), name = _name ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected index ce001c525fc..8adfd2a7df0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/PilotFragmentImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -69,7 +70,7 @@ public object PilotFragmentImpl_ResponseAdapter { } return PilotFragmentImpl.Data.Homeworld( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), name = _name ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected index 1be0b576361..004f1763e37 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nested_named_fragments/kotlin/responseBased/nested_named_fragments/fragment/StarshipFragmentImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -38,7 +39,7 @@ public object StarshipFragmentImpl_ResponseAdapter { } return StarshipFragmentImpl.Data( - id = _id!!, + id = _id ?: missingField(reader, "id"), name = _name, pilotConnection = _pilotConnection ) @@ -135,7 +136,7 @@ public object StarshipFragmentImpl_ResponseAdapter { } return StarshipFragmentImpl.Data.PilotConnection.Edge.Node( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), name = _name, homeworld = _homeworld ) @@ -174,7 +175,7 @@ public object StarshipFragmentImpl_ResponseAdapter { } return StarshipFragmentImpl.Data.PilotConnection.Edge.Node.Homeworld( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), name = _name ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/adapter/TestQuery_ResponseAdapter.kt.expected index d412be8c5d1..bbbb63c9b92 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/nonnull/kotlin/responseBased/nonnull/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.nonnull.TestQuery import kotlin.String @@ -32,7 +33,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - hero = _hero!! + hero = _hero ?: missingField(reader, "hero") ) } @@ -60,7 +61,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected index 462c017997d..3487317d7cd 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/operationBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -164,7 +165,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Root.OnA.OnB( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), bFragment = _bFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected index 34a706479cf..c3bb310417e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/not_all_combinations_are_needed/kotlin/responseBased/not_all_combinations_are_needed/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.not_all_combinations_are_needed.TestQuery @@ -95,7 +96,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.ABRoot( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldA1 = _fieldA1, fieldB1 = _fieldB1 ) @@ -135,7 +136,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherRoot( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/adapter/TestQuery_ResponseAdapter.kt.expected index 33c2151a71f..7bf3caf3bdc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operation_id_generator/kotlin/responseBased/operation_id_generator/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.operation_id_generator.TestQuery @@ -63,8 +64,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - id = _id!!, - name = _name!! + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected index 5242a027abf..6ebac4da58d 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/operationBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -69,7 +70,7 @@ public object TestOperation_ResponseAdapter { adapterContext) return TestOperation.Data.Animal( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onAnimal = _onAnimal ) } @@ -122,7 +123,7 @@ public object TestOperation_ResponseAdapter { return TestOperation.Data.Animal.OnAnimal( __typename = __typename, - species = _species!!, + species = _species ?: missingField(reader, "species"), onWarmBlooded = _onWarmBlooded, onPet = _onPet ) @@ -166,7 +167,7 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Animal.OnAnimal.OnWarmBlooded( - temperature = _temperature!! + temperature = _temperature ?: missingField(reader, "temperature") ) } @@ -195,7 +196,7 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Animal.OnAnimal.OnPet( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected index d79462e2ef5..764bc70b9fe 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex7/kotlin/responseBased/operationbased2_ex7/adapter/TestOperation_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.operationbased2_ex7.TestOperation @@ -109,10 +110,10 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.PetWarmBloodedAnimal( - __typename = __typename!!, - species = _species!!, - temperature = _temperature!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + temperature = _temperature ?: missingField(reader, "temperature"), + name = _name ?: missingField(reader, "name") ) } @@ -155,8 +156,8 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.OtherAnimal( - __typename = __typename!!, - species = _species!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species") ) } @@ -195,9 +196,9 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.OtherWarmBloodedAnimal( - __typename = __typename!!, - species = _species!!, - temperature = _temperature!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + temperature = _temperature ?: missingField(reader, "temperature") ) } @@ -239,9 +240,9 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.OtherPetAnimal( - __typename = __typename!!, - species = _species!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected index c8188501efb..c2cb623a06c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.operationbased2_ex8.TestOperation @@ -65,7 +66,7 @@ public object TestOperation_ResponseAdapter { adapterContext) return TestOperation.Data.Animal( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), animalFragment = _animalFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected index 83f919bee85..ee55df4951f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/operationBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import kotlin.Int @@ -38,8 +39,8 @@ public object AnimalFragmentImpl_ResponseAdapter { } return com.example.operationbased2_ex8.fragment.AnimalFragment( - species = _species!!, - parent = _parent!! + species = _species ?: missingField(reader, "species"), + parent = _parent ?: missingField(reader, "parent") ) } @@ -92,7 +93,7 @@ public object AnimalFragmentImpl_ResponseAdapter { return com.example.operationbased2_ex8.fragment.AnimalFragment.Parent( __typename = __typename, - species = _species!!, + species = _species ?: missingField(reader, "species"), onLion = _onLion, onCat = _onCat ) @@ -136,7 +137,7 @@ public object AnimalFragmentImpl_ResponseAdapter { } return com.example.operationbased2_ex8.fragment.AnimalFragment.Parent.OnLion( - temperature = _temperature!! + temperature = _temperature ?: missingField(reader, "temperature") ) } @@ -166,7 +167,7 @@ public object AnimalFragmentImpl_ResponseAdapter { } return com.example.operationbased2_ex8.fragment.AnimalFragment.Parent.OnCat( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected index 4a42814c78b..7d45dbdde7b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/adapter/TestOperation_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.operationbased2_ex8.TestOperation @@ -69,9 +70,9 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Animal( - __typename = __typename!!, - species = _species!!, - parent = _parent!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + parent = _parent ?: missingField(reader, "parent") ) } @@ -142,9 +143,9 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Animal.LionParent( - __typename = __typename!!, - species = _species!!, - temperature = _temperature!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + temperature = _temperature ?: missingField(reader, "temperature") ) } @@ -186,9 +187,9 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Animal.CatParent( - __typename = __typename!!, - species = _species!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + name = _name ?: missingField(reader, "name") ) } @@ -228,8 +229,8 @@ public object TestOperation_ResponseAdapter { } return TestOperation.Data.Animal.OtherParent( - __typename = __typename!!, - species = _species!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected index 2c519865d9d..88dc2454618 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/operationbased2_ex8/kotlin/responseBased/operationbased2_ex8/fragment/AnimalFragmentImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import kotlin.Int import kotlin.String @@ -37,8 +38,8 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.Data( - species = _species!!, - parent = _parent!! + species = _species ?: missingField(reader, "species"), + parent = _parent ?: missingField(reader, "parent") ) } @@ -104,9 +105,9 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.Data.LionParent( - __typename = __typename!!, - species = _species!!, - temperature = _temperature!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + temperature = _temperature ?: missingField(reader, "temperature") ) } @@ -148,9 +149,9 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.Data.CatParent( - __typename = __typename!!, - species = _species!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species"), + name = _name ?: missingField(reader, "name") ) } @@ -190,8 +191,8 @@ public object AnimalFragmentImpl_ResponseAdapter { } return AnimalFragmentImpl.Data.OtherParent( - __typename = __typename!!, - species = _species!! + __typename = __typename ?: missingField(reader, "__typename"), + species = _species ?: missingField(reader, "species") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/adapter/TestQuery_ResponseAdapter.kt.expected index 633a8c6192c..21e3342a3da 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/optional/kotlin/responseBased/optional/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.optional.TestQuery @@ -66,7 +67,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - name = _name!!, + name = _name ?: missingField(reader, "name"), appearsIn = _appearsIn ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/adapter/TestQuery_ResponseAdapter.kt.expected index f1a3c73ef9e..00ad0376c32 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/path_vs_flat_accessors/kotlin/responseBased/path_vs_flat_accessors/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.path_vs_flat_accessors.TestQuery @@ -101,7 +102,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.ABRoot( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldB1 = _fieldB1, fieldB2 = _fieldB2 ) @@ -141,7 +142,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherRoot( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -173,7 +174,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherARoot( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -207,7 +208,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherBRoot( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), fieldB2 = _fieldB2 ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/adapter/TestQuery_ResponseAdapter.kt.expected index a035f88754f..0fc7ffd225c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/recursive_selection/kotlin/responseBased/recursive_selection/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.recursive_selection.TestQuery @@ -66,8 +67,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Tree( - name = _name!!, - children = _children!!, + name = _name ?: missingField(reader, "name"), + children = _children ?: missingField(reader, "children"), parent = _parent ) } @@ -102,7 +103,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Tree.Child( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -131,7 +132,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Tree.Parent( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected index d19204e91a1..858b54e0f77 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/operationBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -72,8 +73,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Yield( - `while` = _while!!, - it = _it!! + `while` = _while ?: missingField(reader, "while"), + it = _it ?: missingField(reader, "it") ) } @@ -150,7 +151,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Object.OnCharacter( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected index 34572c8e06d..e00c56ccedc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/reserved_keywords/kotlin/responseBased/reserved_keywords/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.reserved_keywords.TestQuery @@ -72,8 +73,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Yield( - `while` = _while!!, - it = _it!! + `while` = _while ?: missingField(reader, "while"), + it = _it ?: missingField(reader, "it") ) } @@ -135,8 +136,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterObject( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -171,7 +172,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherObject( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 9829b89b129..844a2bc0aaf 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.example.root_query_fragment.TestQuery import kotlin.String import kotlin.collections.List @@ -35,7 +36,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), queryFragment = _queryFragment ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected index a791c894a19..ca0b75853b8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/operationBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -35,7 +36,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return com.example.root_query_fragment.fragment.QueryFragment( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero ) } @@ -68,7 +69,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return com.example.root_query_fragment.fragment.QueryFragment.Hero( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 639711c107b..58e12d8e208 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.root_query_fragment.TestQuery @@ -35,7 +36,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero ) } @@ -67,7 +68,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected index 2c6da6db844..8a1c522e7f9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment/kotlin/responseBased/root_query_fragment/fragment/QueryFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -34,7 +35,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero ) } @@ -66,7 +67,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data.Hero( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected index 45f5d3d04c6..ce27fa92422 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/operationBased/root_query_fragment_with_nested_fragments/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.example.root_query_fragment_with_nested_fragments.TestQuery import kotlin.String import kotlin.collections.List @@ -35,7 +36,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), queryFragment = _queryFragment ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 37257a70afc..4439ec29c0b 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -35,7 +36,7 @@ public object DroidFragmentImpl_ResponseAdapter { } return com.example.root_query_fragment_with_nested_fragments.fragment.DroidFragment( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index d6cdd62a52f..3c6a8fde6eb 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,7 +33,7 @@ public object HeroFragmentImpl_ResponseAdapter { } return com.example.root_query_fragment_with_nested_fragments.fragment.HeroFragment( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 5a0a0d3da52..1f164e886a7 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -41,7 +42,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return com.example.root_query_fragment_with_nested_fragments.fragment.QueryFragment( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero, droid = _droid, human = _human @@ -87,7 +88,7 @@ public object QueryFragmentImpl_ResponseAdapter { adapterContext) return com.example.root_query_fragment_with_nested_fragments.fragment.QueryFragment.Hero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), heroFragment = _heroFragment ) } @@ -126,7 +127,7 @@ public object QueryFragmentImpl_ResponseAdapter { adapterContext) return com.example.root_query_fragment_with_nested_fragments.fragment.QueryFragment.Droid( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), droidFragment = _droidFragment ) } @@ -165,7 +166,7 @@ public object QueryFragmentImpl_ResponseAdapter { adapterContext) return com.example.root_query_fragment_with_nested_fragments.fragment.QueryFragment.Human( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onHuman = _onHuman ) } @@ -201,7 +202,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return com.example.root_query_fragment_with_nested_fragments.fragment.QueryFragment.Human.OnHuman( - name = _name!!, + name = _name ?: missingField(reader, "name"), homePlanet = _homePlanet ) } 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/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected index cc1b1e0bfe7..3ebb100a4ab 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_fragment_with_nested_fragments/kotlin/responseBased/root_query_fragment_with_nested_fragments/adapter/TestQuery_ResponseAdapter.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/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.root_query_fragment_with_nested_fragments.TestQuery @@ -40,7 +41,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero, droid = _droid, human = _human @@ -82,8 +83,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -119,8 +120,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Droid( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -160,8 +161,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Human( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), homePlanet = _homePlanet ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index a4cfc757d38..c6a738df2d4 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -33,7 +34,7 @@ public object DroidFragmentImpl_ResponseAdapter { } return DroidFragmentImpl.Data( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 6c058445706..68a9bdfded3 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object HeroFragmentImpl_ResponseAdapter { } return HeroFragmentImpl.Data( - name = _name!! + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index 308419a7d42..fb5f516c157 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_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.NullableStringAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.String @@ -39,7 +40,7 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero, droid = _droid, human = _human @@ -81,8 +82,8 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data.Hero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -118,8 +119,8 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data.Droid( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -159,8 +160,8 @@ public object QueryFragmentImpl_ResponseAdapter { } return QueryFragmentImpl.Data.Human( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), homePlanet = _homePlanet ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 7bab9d9eaba..a795544f528 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/operationBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -45,7 +46,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onQuery = _onQuery ) } @@ -81,7 +82,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OnQuery( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero, droid = _droid ) @@ -133,8 +134,8 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.OnQuery.Hero( __typename = __typename, - name = _name!!, - appearsIn = _appearsIn!!, + name = _name ?: missingField(reader, "name"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn"), onHuman = _onHuman ) } @@ -209,7 +210,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.OnQuery.Droid( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onDroid = _onDroid ) } @@ -243,7 +244,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OnQuery.Droid.OnDroid( - name = _name!!, + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index c36dab5c90b..0391d4e35be 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/root_query_inline_fragment/kotlin/responseBased/root_query_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.root_query_inline_fragment.TestQuery @@ -45,7 +46,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), hero = _hero, droid = _droid ) @@ -114,9 +115,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!!, - appearsIn = _appearsIn!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn"), height = _height ) } @@ -163,9 +164,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - name = _name!!, - appearsIn = _appearsIn!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn") ) } @@ -205,8 +206,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Droid( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index e21a3468238..15aa0a6192c 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/operationBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,8 +33,8 @@ internal object HumanDetailsImpl_ResponseAdapter { } return com.example.simple_fragment.fragment.HumanDetails( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 3620c051a49..34f6e85d3d7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.simple_fragment.TestQuery @@ -92,8 +93,8 @@ internal object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -128,7 +129,7 @@ internal object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index e480986cc9c..c8218160797 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.Suppress import kotlin.collections.List @@ -61,8 +62,8 @@ internal object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.HumanData( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -97,7 +98,7 @@ internal object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.OtherData( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected index e4dc0690040..759c09bcc88 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment/kotlin/responseBased/simple_fragment/fragment/HumanDetailsImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -32,8 +33,8 @@ internal object HumanDetailsImpl_ResponseAdapter { } return HumanDetailsImpl.Data( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected index fe57414e190..3bf3dd74f1b 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.simple_fragment_with_inline_fragments.TestQuery @@ -65,7 +66,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Hero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), heroDetails = _heroDetails ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index d0e17f73524..ef49c76b9ef 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/operationBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -41,7 +42,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.simple_fragment_with_inline_fragments.fragment.HeroDetails( - name = _name!!, + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -96,7 +97,7 @@ public object HeroDetailsImpl_ResponseAdapter { return com.example.simple_fragment_with_inline_fragments.fragment.HeroDetails.Friend( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), onHuman = _onHuman, onDroid = _onDroid ) diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected index 57df61a09a0..fe3a7959eab 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.simple_fragment_with_inline_fragments.TestQuery @@ -71,8 +72,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -141,8 +142,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.HumanFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -185,8 +186,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.DroidFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -227,8 +228,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OtherFriend( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } 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_ResponseAdapter.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_ResponseAdapter.kt.expected index d87ea68d83d..8b960c89ef9 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_fragment_with_inline_fragments/kotlin/responseBased/simple_fragment_with_inline_fragments/fragment/HeroDetailsImpl_ResponseAdapter.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_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Double @@ -40,7 +41,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data( - name = _name!!, + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -106,8 +107,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data.HumanFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -150,8 +151,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data.DroidFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -192,8 +193,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data.OtherFriend( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 37db65ae799..a523e9c0808 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/operationBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -138,8 +139,8 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Hero.OnCharacter( - __typename = __typename!!, - id = _id!!, + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), onCharacter = _onCharacter ) } @@ -174,7 +175,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnCharacter.OnCharacter( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 0de9b2f1a13..3a312cde6ce 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_inline_fragment/kotlin/responseBased/simple_inline_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.simple_inline_fragment.TestQuery @@ -102,9 +103,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, - id = _id!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), height = _height ) } @@ -153,9 +154,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - id = _id!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -201,9 +202,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!!, - id = _id!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected index c015884a378..479b1a3194a 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object CatFragmentImpl_ResponseAdapter { } return com.example.simple_union.fragment.CatFragment( - meow = _meow!! + meow = _meow ?: missingField(reader, "meow") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected index e1bea23b534..a8be753a125 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/operationBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DogFragmentImpl_ResponseAdapter { } return com.example.simple_union.fragment.DogFragment( - woof = _woof!! + woof = _woof ?: missingField(reader, "woof") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/adapter/AnimalQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/adapter/AnimalQuery_ResponseAdapter.kt.expected index 9b2165646df..3060f44a545 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/adapter/AnimalQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/adapter/AnimalQuery_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.simple_union.AnimalQuery @@ -95,8 +96,8 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data.CatAnimal( - __typename = __typename!!, - meow = _meow!! + __typename = __typename ?: missingField(reader, "__typename"), + meow = _meow ?: missingField(reader, "meow") ) } @@ -133,8 +134,8 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data.DogAnimal( - __typename = __typename!!, - woof = _woof!! + __typename = __typename ?: missingField(reader, "__typename"), + woof = _woof ?: missingField(reader, "woof") ) } @@ -169,7 +170,7 @@ public object AnimalQuery_ResponseAdapter { } return AnimalQuery.Data.OtherAnimal( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected index 5f2b4fbe872..2e403d113d2 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/CatFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object CatFragmentImpl_ResponseAdapter { } return CatFragmentImpl.Data( - meow = _meow!! + meow = _meow ?: missingField(reader, "meow") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected index c2b65fcd2af..9f032745994 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/simple_union/kotlin/responseBased/simple_union/fragment/DogFragmentImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object DogFragmentImpl_ResponseAdapter { } return DogFragmentImpl.Data( - woof = _woof!! + woof = _woof ?: missingField(reader, "woof") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/adapter/TestQuery_ResponseAdapter.kt.expected index 633fa4f027a..163ebd8c226 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/starships/kotlin/responseBased/starships/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.starships.TestQuery @@ -68,8 +69,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Starship( - id = _id!!, - name = _name!!, + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), coordinates = _coordinates ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/adapter/TestSubscription_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/adapter/TestSubscription_ResponseAdapter.kt.expected index bb2bbe6190d..98f87478451 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/adapter/TestSubscription_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/subscriptions/kotlin/responseBased/subscriptions/adapter/TestSubscription_ResponseAdapter.kt.expected @@ -12,6 +12,7 @@ import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.subscriptions.TestSubscription @@ -65,8 +66,8 @@ public object TestSubscription_ResponseAdapter { } return TestSubscription.Data.CommentAdded( - id = _id!!, - content = _content!! + id = _id ?: missingField(reader, "id"), + content = _content ?: missingField(reader, "content") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/adapter/CatQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/adapter/CatQuery_ResponseAdapter.kt.expected index 397eae823ff..b98581ee6d3 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/adapter/CatQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/suppressed_warnings/kotlin/responseBased/suppressed_warnings/adapter/CatQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.IntAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.suppressed_warnings.CatQuery @@ -71,7 +72,7 @@ public object CatQuery_ResponseAdapter { } return CatQuery.Data.Search( - mustaches = _mustaches!! + mustaches = _mustaches ?: missingField(reader, "mustaches") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/adapter/TestQuery_ResponseAdapter.kt.expected index dfc0db798cc..cf003b991e7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/target_name/kotlin/responseBased/target_name/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.target_name.TestQuery @@ -182,7 +183,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.ReservedObjectUnion( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), `field` = _field ) } @@ -218,7 +219,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherUnion( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected index c35af36ed74..9be41544981 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/operationBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes import com.example.test_inline.GetPage @@ -35,7 +36,7 @@ public object GetPage_ResponseAdapter { } return GetPage.Data( - collection = _collection!! + collection = _collection ?: missingField(reader, "collection") ) } @@ -77,7 +78,7 @@ public object GetPage_ResponseAdapter { return GetPage.Data.Collection( __typename = __typename, - items = _items!!, + items = _items ?: missingField(reader, "items"), onParticularCollection = _onParticularCollection ) } @@ -114,7 +115,7 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.Collection.Item( - title = _title!! + title = _title ?: missingField(reader, "title") ) } @@ -144,7 +145,7 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.Collection.OnParticularCollection( - items = _items!! + items = _items ?: missingField(reader, "items") ) } @@ -220,7 +221,7 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.Collection.OnParticularCollection.Item.OnParticularItem( - image = _image!! + image = _image ?: missingField(reader, "image") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected index 88297255d26..55c62506ce6 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/test_inline/kotlin/responseBased/test_inline/adapter/GetPage_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.obj import com.example.test_inline.GetPage import kotlin.String @@ -35,7 +36,7 @@ public object GetPage_ResponseAdapter { } return GetPage.Data( - collection = _collection!! + collection = _collection ?: missingField(reader, "collection") ) } @@ -93,8 +94,8 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.ParticularCollectionCollection( - __typename = __typename!!, - items = _items!! + __typename = __typename ?: missingField(reader, "__typename"), + items = _items ?: missingField(reader, "items") ) } @@ -158,9 +159,9 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.ParticularCollectionCollection.ParticularItemItem( - title = _title!!, - __typename = __typename!!, - image = _image!! + title = _title ?: missingField(reader, "title"), + __typename = __typename ?: missingField(reader, "__typename"), + image = _image ?: missingField(reader, "image") ) } @@ -200,8 +201,8 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.ParticularCollectionCollection.OtherItem( - title = _title!!, - __typename = __typename!! + title = _title ?: missingField(reader, "title"), + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -239,8 +240,8 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.OtherCollection( - __typename = __typename!!, - items = _items!! + __typename = __typename ?: missingField(reader, "__typename"), + items = _items ?: missingField(reader, "items") ) } @@ -271,7 +272,7 @@ public object GetPage_ResponseAdapter { } return GetPage.Data.OtherCollection.Item( - title = _title!! + title = _title ?: missingField(reader, "title") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/adapter/TestQuery_ResponseAdapter.kt.expected index 916aa2ae4a2..60bc60002b8 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_unique/kotlin/responseBased/two_heroes_unique/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.two_heroes_unique.TestQuery @@ -67,7 +68,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.R2( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -98,8 +99,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Luke( - id = _id!!, - name = _name!! + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected index a1430c39761..e64a57b0dbc 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/two_heroes_with_friends/kotlin/responseBased/two_heroes_with_friends/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.two_heroes_with_friends.TestQuery @@ -72,8 +73,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.R2( - name = _name!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -166,7 +167,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.R2.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -202,9 +203,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Luke( - id = _id!!, - name = _name!!, - friendsConnection = _friendsConnection!! + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -300,7 +301,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Luke.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected index 6e6922f0ec1..eab2c0a5d40 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/operationBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -41,7 +42,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data( hero = _hero, - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -133,7 +134,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data.Hero.OnHuman( height = _height, - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -169,8 +170,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero.OnDroid( - name = _name!!, - __typename = __typename!!, + name = _name ?: missingField(reader, "name"), + __typename = __typename ?: missingField(reader, "__typename"), primaryFunction = _primaryFunction ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected index ff8fc113a93..bb3e500f67f 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/typename_always_first/kotlin/responseBased/typename_always_first/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.typename_always_first.TestQuery @@ -41,7 +42,7 @@ public object TestQuery_ResponseAdapter { return TestQuery.Data( hero = _hero, - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } @@ -104,7 +105,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.HumanHero( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), height = _height ) } @@ -144,8 +145,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.DroidHero( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction ) } @@ -184,7 +185,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherHero( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index 6f6e96e1644..36b618d6ee0 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -123,7 +124,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Search.OnStarship( - id = _id!! + id = _id ?: missingField(reader, "id") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected index b96a5e5e6f9..d14336a1cc7 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/operationBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object StarshipImpl_ResponseAdapter { } return com.example.union_fragment.fragment.Starship( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected index fa8e5450fcc..6bee86ab469 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/adapter/TestQuery_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.union_fragment.TestQuery @@ -95,9 +96,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.StarshipSearch( - __typename = __typename!!, - id = _id!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name") ) } @@ -135,7 +136,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherSearch( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected index 8458cbe284b..c351184c9aa 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_fragment/kotlin/responseBased/union_fragment/fragment/StarshipImpl_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import kotlin.String import kotlin.collections.List @@ -30,7 +31,7 @@ public object StarshipImpl_ResponseAdapter { } return StarshipImpl.Data( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected index c0576c628fe..768735faa60 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/operationBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -129,8 +130,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Search.OnCharacter( - id = _id!!, - name = _name!!, + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -233,7 +234,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Search.OnCharacter.Friend.OnCharacter( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -303,7 +304,7 @@ public object TestQuery_ResponseAdapter { adapterContext) return TestQuery.Data.Search.OnCharacter.Friend.OnHuman.Friend( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), onCharacter = _onCharacter ) } @@ -337,7 +338,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Search.OnCharacter.Friend.OnHuman.Friend.OnCharacter( - firstAppearsIn = _firstAppearsIn!! + firstAppearsIn = _firstAppearsIn ?: missingField(reader, "firstAppearsIn") ) } @@ -407,7 +408,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Search.OnCharacter.Friend.OnDroid.Friend( - id = _id!! + id = _id ?: missingField(reader, "id") ) } @@ -439,7 +440,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Search.OnStarship( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected index 4a57ce78424..ca43c538241 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/union_inline_fragments/kotlin/responseBased/union_inline_fragments/adapter/TestQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.union_inline_fragments.TestQuery @@ -104,9 +105,9 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterSearch( - __typename = __typename!!, - id = _id!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + id = _id ?: missingField(reader, "id"), + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -184,8 +185,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterSearch.HumanFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), homePlanet = _homePlanet, friends = _friends ) @@ -227,8 +228,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterSearch.HumanFriend.Friend( - __typename = __typename!!, - firstAppearsIn = _firstAppearsIn!! + __typename = __typename ?: missingField(reader, "__typename"), + firstAppearsIn = _firstAppearsIn ?: missingField(reader, "firstAppearsIn") ) } @@ -271,8 +272,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterSearch.DroidFriend( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), primaryFunction = _primaryFunction, friends = _friends ) @@ -312,7 +313,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterSearch.DroidFriend.Friend( - id = _id!! + id = _id ?: missingField(reader, "id") ) } @@ -347,8 +348,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.CharacterSearch.OtherFriend( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -386,8 +387,8 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.StarshipSearch( - __typename = __typename!!, - name = _name!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name") ) } @@ -422,7 +423,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.OtherSearch( - __typename = __typename!! + __typename = __typename ?: missingField(reader, "__typename") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected index 0c0a0e48dc7..4fc8cee3159 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected @@ -14,6 +14,7 @@ import com.apollographql.apollo3.api.evaluate import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.apollographql.apollo3.api.possibleTypes @@ -85,7 +86,7 @@ public object HeroDetailQuery_ResponseAdapter { return com.example.unique_type_name.HeroDetailQuery.Data.HeroDetailQuery( __typename = __typename, - name = _name!!, + name = _name ?: missingField(reader, "name"), friends = _friends, onHuman = _onHuman ) @@ -128,7 +129,7 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.HeroDetailQuery.Friend( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -197,7 +198,7 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.HeroDetailQuery.OnHuman.Friend( - appearsIn = _appearsIn!!, + appearsIn = _appearsIn ?: missingField(reader, "appearsIn"), friends = _friends ) } @@ -237,7 +238,7 @@ public object HeroDetailQuery_ResponseAdapter { adapterContext) return com.example.unique_type_name.HeroDetailQuery.Data.HeroDetailQuery.OnHuman.Friend.Friend( - __typename = __typename!!, + __typename = __typename ?: missingField(reader, "__typename"), heroDetails = _heroDetails ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index f2882e8e28a..75bc7c7954e 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/operationBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Int @@ -37,8 +38,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.unique_type_name.fragment.HeroDetails( - name = _name!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -136,7 +137,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return com.example.unique_type_name.fragment.HeroDetails.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected index ebd98b2d343..ce806a98377 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/adapter/HeroDetailQuery_ResponseAdapter.kt.expected @@ -15,6 +15,7 @@ import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.json.readTypename import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.unique_type_name.HeroDetailQuery @@ -106,8 +107,8 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.HumanHeroDetailQuery( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), friends = _friends, height = _height ) @@ -152,8 +153,8 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.HumanHeroDetailQuery.Friend( - name = _name!!, - appearsIn = _appearsIn!!, + name = _name ?: missingField(reader, "name"), + appearsIn = _appearsIn ?: missingField(reader, "appearsIn"), friends = _friends ) } @@ -196,9 +197,9 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.HumanHeroDetailQuery.Friend.Friend( - __typename = __typename!!, - name = _name!!, - friendsConnection = _friendsConnection!! + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -300,7 +301,7 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.HumanHeroDetailQuery.Friend.Friend.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } @@ -341,8 +342,8 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.OtherHeroDetailQuery( - __typename = __typename!!, - name = _name!!, + __typename = __typename ?: missingField(reader, "__typename"), + name = _name ?: missingField(reader, "name"), friends = _friends ) } @@ -379,7 +380,7 @@ public object HeroDetailQuery_ResponseAdapter { } return com.example.unique_type_name.HeroDetailQuery.Data.OtherHeroDetailQuery.Friend( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected index 05f2cfbc64c..9c18a4c6356 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/unique_type_name/kotlin/responseBased/unique_type_name/fragment/HeroDetailsImpl_ResponseAdapter.kt.expected @@ -13,6 +13,7 @@ import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter import com.apollographql.apollo3.api.list +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import kotlin.Int @@ -37,8 +38,8 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data( - name = _name!!, - friendsConnection = _friendsConnection!! + name = _name ?: missingField(reader, "name"), + friendsConnection = _friendsConnection ?: missingField(reader, "friendsConnection") ) } @@ -131,7 +132,7 @@ public object HeroDetailsImpl_ResponseAdapter { } return HeroDetailsImpl.Data.FriendsConnection.Edge.Node( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/adapter/TestQuery_ResponseAdapter.kt.expected b/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/adapter/TestQuery_ResponseAdapter.kt.expected index cefec8a189e..5558fd4f5d1 100644 --- a/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/adapter/TestQuery_ResponseAdapter.kt.expected +++ b/libraries/apollo-compiler/src/test/graphql/com/example/variable_default_value/kotlin/responseBased/variable_default_value/adapter/TestQuery_ResponseAdapter.kt.expected @@ -11,6 +11,7 @@ import com.apollographql.apollo3.api.CustomScalarAdapters import com.apollographql.apollo3.api.StringAdapter import com.apollographql.apollo3.api.json.JsonReader import com.apollographql.apollo3.api.json.JsonWriter +import com.apollographql.apollo3.api.missingField import com.apollographql.apollo3.api.nullable import com.apollographql.apollo3.api.obj import com.example.variable_default_value.TestQuery @@ -61,7 +62,7 @@ public object TestQuery_ResponseAdapter { } return TestQuery.Data.Hero( - name = _name!! + name = _name ?: missingField(reader, "name") ) } diff --git a/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/MetadataTest.kt b/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/MetadataTest.kt index 56f21c28c0a..5c1ff506a81 100644 --- a/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/MetadataTest.kt +++ b/libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/MetadataTest.kt @@ -82,6 +82,7 @@ class MetadataTest { addTypename = defaultAddTypename, generateOptionalOperationVariables = defaultGenerateOptionalOperationVariables, alwaysGenerateTypesMatching = alwaysGenerateTypesMatching, + enableCatchAndNullOnlyOnError = false ) val irOperations = ApolloCompiler.buildIrOperations(irOptions) diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/Service.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/Service.kt index c9e9d8caaac..9fffada3469 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/Service.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/Service.kt @@ -634,6 +634,9 @@ interface Service { @ApolloExperimental val requiresOptInAnnotation: Property + @ApolloExperimental + val enableCatchAndNullOnlyOnError: Property + /** * Whether fields with different shape are disallowed to be merged in disjoint types. * diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateIrTask.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateIrTask.kt index 17758b3eb80..e0bb8627cb9 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateIrTask.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateIrTask.kt @@ -67,6 +67,10 @@ abstract class ApolloGenerateIrTask: DefaultTask() { @get:Input abstract val alwaysGenerateTypesMatching: SetProperty + @get:Input + @get:Optional + abstract val enableCatchAndNullOnlyOnError: Property + @get:OutputFile abstract val outputFile: RegularFileProperty @@ -87,6 +91,7 @@ abstract class ApolloGenerateIrTask: DefaultTask() { logger = logger(), generateOptionalOperationVariables = generateOptionalOperationVariables.getOrElse(defaultGenerateOptionalOperationVariables), alwaysGenerateTypesMatching = alwaysGenerateTypesMatching.get(), + enableCatchAndNullOnlyOnError = enableCatchAndNullOnlyOnError.getOrElse(false) ) ApolloCompiler.buildIrOperations(options).writeTo(outputFile.asFile.get()) diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateSourcesTask.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateSourcesTask.kt index 0fcf8539728..dfea1cf8854 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateSourcesTask.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloGenerateSourcesTask.kt @@ -80,6 +80,10 @@ abstract class ApolloGenerateSourcesTask : ApolloGenerateSourcesBase() { @get:Optional abstract val fieldsOnDisjointTypesMustMerge: Property + @get:Input + @get:Optional + abstract val enableCatchAndNullOnlyOnError: Property + @get:Input @get:Optional abstract val decapitalizeFields: Property @@ -111,6 +115,7 @@ abstract class ApolloGenerateSourcesTask : ApolloGenerateSourcesBase() { logger = logger(), generateOptionalOperationVariables = generateOptionalOperationVariables.getOrElse(defaultGenerateOptionalOperationVariables), alwaysGenerateTypesMatching = alwaysGenerateTypesMatching.getOrElse(defaultAlwaysGenerateTypesMatching), + enableCatchAndNullOnlyOnError = enableCatchAndNullOnlyOnError.getOrElse(false) ) val irOperations = ApolloCompiler.buildIrOperations(irOptions) diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultApolloExtension.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultApolloExtension.kt index d7891eac781..a26671bb0a2 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultApolloExtension.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultApolloExtension.kt @@ -605,6 +605,7 @@ abstract class DefaultApolloExtension( task.failOnWarnings.set(service.failOnWarnings) task.generateOptionalOperationVariables.set(service.generateOptionalOperationVariables) task.alwaysGenerateTypesMatching.set(service.alwaysGenerateTypesMatching()) + task.enableCatchAndNullOnlyOnError.set(service.enableCatchAndNullOnlyOnError) task.outputFile.set(BuildDirLayout.ir(project, service)) } @@ -782,6 +783,7 @@ abstract class DefaultApolloExtension( task.generateDataBuilders.set(service.generateDataBuilders) task.fieldsOnDisjointTypesMustMerge.set(service.fieldsOnDisjointTypesMustMerge) task.decapitalizeFields.set(service.decapitalizeFields) + task.enableCatchAndNullOnlyOnError.set(service.enableCatchAndNullOnlyOnError) configureBaseCodegenTask(project, task, service) } diff --git a/libraries/apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo3/ApolloClient.kt b/libraries/apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo3/ApolloClient.kt index aa5ff36d875..6167b7ad5ec 100644 --- a/libraries/apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo3/ApolloClient.kt +++ b/libraries/apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo3/ApolloClient.kt @@ -15,8 +15,8 @@ import com.apollographql.apollo3.api.Subscription import com.apollographql.apollo3.api.http.HttpHeader import com.apollographql.apollo3.api.http.HttpMethod import com.apollographql.apollo3.exception.ApolloException -import com.apollographql.apollo3.exception.ApolloGraphQLException import com.apollographql.apollo3.exception.ApolloHttpException +import com.apollographql.apollo3.exception.NoDataAndNoErrorsException import com.apollographql.apollo3.interceptor.ApolloInterceptor import com.apollographql.apollo3.interceptor.AutoPersistedQueryInterceptor import com.apollographql.apollo3.interceptor.DefaultInterceptorChain @@ -166,9 +166,8 @@ private constructor( .let { if (request.useV3ExceptionHandling == true) { it.onEach { response -> - val exception = response.exception ?: return@onEach - if (exception !is ApolloGraphQLException) { - throw exception + if (response.exception != null && response.exception !is NoDataAndNoErrorsException) { + throw response.exception!! } } } else { 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..d4a257aecfa --- /dev/null +++ b/tests/catch/src/test/kotlin/test/CatchTest.kt @@ -0,0 +1,104 @@ +package test + +import com.apollographql.apollo3.api.CustomScalarAdapters +import com.apollographql.apollo3.api.json.JsonReader +import com.apollographql.apollo3.api.json.jsonReader +import com.apollographql.apollo3.api.parseResponse +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?.errorsOrNull()?.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?.errorsOrNull()?.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) + } +} diff --git a/tests/data-builders-kotlin/src/test/kotlin/test/FragmentTest.kt b/tests/data-builders-kotlin/src/test/kotlin/test/FragmentTest.kt index 293847d220f..f980f5af728 100644 --- a/tests/data-builders-kotlin/src/test/kotlin/test/FragmentTest.kt +++ b/tests/data-builders-kotlin/src/test/kotlin/test/FragmentTest.kt @@ -1,12 +1,11 @@ package test +import com.apollographql.apollo3.exception.DefaultApolloException import data.builders.fragment.AnimalDetailsImpl import data.builders.fragment.CatDetailsImpl -import data.builders.fragment.TrivialFragment import data.builders.fragment.TrivialFragmentImpl import data.builders.type.Animal import data.builders.type.buildLion -import org.junit.Assert.assertNull import org.junit.Test import kotlin.test.assertEquals import kotlin.test.assertFails @@ -44,7 +43,7 @@ class FragmentTest { // __typename is unknown so this fails // XXX: we could be smarter about this (the parsers are // data.builders.fragment.AnimalDetailsImpl_ResponseAdapter$OnAnimal.fromJson(AnimalDetailsImpl_ResponseAdapter.kt:85) - assertFailsWith(NullPointerException::class) { + assertFailsWith(DefaultApolloException::class) { TrivialFragmentImpl.Data(Animal) { __typename = "Brontaroc" species = "alien" diff --git a/tests/integration-tests/src/commonTest/kotlin/test/ExceptionsTest.kt b/tests/integration-tests/src/commonTest/kotlin/test/ExceptionsTest.kt index ff571c30007..80d95410e9d 100644 --- a/tests/integration-tests/src/commonTest/kotlin/test/ExceptionsTest.kt +++ b/tests/integration-tests/src/commonTest/kotlin/test/ExceptionsTest.kt @@ -70,7 +70,7 @@ class ExceptionsTest { @Test @Suppress("DEPRECATION") - fun toFlowDoesNotThrowOnV3() = runTest(before = { setUp() }, after = { tearDown() }) { + fun toFlowDoesNotThrowForGraphQLErrorsOnV3() = runTest(before = { setUp() }, after = { tearDown() }) { mockServer.enqueueString(""" { "errors": [ diff --git a/tests/integration-tests/src/commonTest/kotlin/test/ParseResponseBodyTest.kt b/tests/integration-tests/src/commonTest/kotlin/test/ParseResponseBodyTest.kt index 229ec8f3c00..b76aab27012 100644 --- a/tests/integration-tests/src/commonTest/kotlin/test/ParseResponseBodyTest.kt +++ b/tests/integration-tests/src/commonTest/kotlin/test/ParseResponseBodyTest.kt @@ -8,7 +8,6 @@ import com.apollographql.apollo3.api.json.MapJsonReader import com.apollographql.apollo3.api.json.jsonReader import com.apollographql.apollo3.api.toApolloResponse import com.apollographql.apollo3.api.toJsonString -import com.apollographql.apollo3.exception.ApolloException import com.apollographql.apollo3.exception.DefaultApolloException import com.apollographql.apollo3.integration.httpcache.AllFilmsQuery import com.apollographql.apollo3.integration.httpcache.AllPlanetsQuery @@ -24,7 +23,6 @@ import testFixtureToJsonReader import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse -import kotlin.test.assertIs import kotlin.test.assertNull import kotlin.test.assertTrue @@ -166,12 +164,7 @@ class ParseResponseBodyTest { fun fieldMissing() { val exception = testFixtureToJsonReader("ResponseDataMissing.json").toApolloResponse(operation = HeroNameQuery()).exception if (exception is DefaultApolloException) { - // This is the (better) Java codegen case assertTrue(exception.message?.contains("Field 'name' is missing") == true) - } else { - // Kotlin codegen case - assertIs(exception) - assertIs(exception.cause) } }