Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/apollo-ast/api/apollo-ast.api
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public final class com/apollographql/apollo/ast/GQLCapability : com/apollographq
public fun copyWithNewChildrenInternal (Lcom/apollographql/apollo/ast/NodeContainer;)Lcom/apollographql/apollo/ast/GQLNode;
public fun getChildren ()Ljava/util/List;
public final fun getDescription ()Ljava/lang/String;
public final fun getQualifiedName ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm advocating for name instead of identifier because there is name in many other places and I don't think we need specific language for this.

See graphql/graphql-spec#1208 (comment)

public fun getSourceLocation ()Lcom/apollographql/apollo/ast/SourceLocation;
public final fun getValue ()Ljava/lang/String;
public fun writeInternal (Lcom/apollographql/apollo/ast/SDLWriter;)V
Expand Down
4 changes: 2 additions & 2 deletions libraries/apollo-ast/api/apollo-ast.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ final class com.apollographql.apollo.ast/GQLCapability : com.apollographql.apoll
final fun <get-children>(): kotlin.collections/List<com.apollographql.apollo.ast/GQLNode> // com.apollographql.apollo.ast/GQLCapability.children.<get-children>|<get-children>(){}[0]
final val description // com.apollographql.apollo.ast/GQLCapability.description|{}description[0]
final fun <get-description>(): kotlin/String? // com.apollographql.apollo.ast/GQLCapability.description.<get-description>|<get-description>(){}[0]
final val qualifiedName // com.apollographql.apollo.ast/GQLCapability.qualifiedName|{}qualifiedName[0]
final fun <get-qualifiedName>(): kotlin/String // com.apollographql.apollo.ast/GQLCapability.qualifiedName.<get-qualifiedName>|<get-qualifiedName>(){}[0]
final val name // com.apollographql.apollo.ast/GQLCapability.name|{}name[0]
final fun <get-name>(): kotlin/String // com.apollographql.apollo.ast/GQLCapability.name.<get-name>|<get-name>(){}[0]
final val sourceLocation // com.apollographql.apollo.ast/GQLCapability.sourceLocation|{}sourceLocation[0]
final fun <get-sourceLocation>(): com.apollographql.apollo.ast/SourceLocation? // com.apollographql.apollo.ast/GQLCapability.sourceLocation.<get-sourceLocation>|<get-sourceLocation>(){}[0]
final val value // com.apollographql.apollo.ast/GQLCapability.value|{}value[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class GQLServiceExtension(
class GQLCapability(
override val sourceLocation: SourceLocation? = null,
val description: String?,
val qualifiedName: String,
val name: String,
val value: String?,
) : GQLNode {
override val children: List<GQLNode>
Expand All @@ -448,7 +448,7 @@ class GQLCapability(
with(writer) {
writeDescription(description)
write("capability ")
write(qualifiedName)
write(name)
if (value != null) {
write("(\"$value\")")
}
Expand All @@ -459,13 +459,13 @@ class GQLCapability(
fun copy(
sourceLocation: SourceLocation? = this.sourceLocation,
description: String? = this.description,
qualifiedName: String = this.qualifiedName,
qualifiedName: String = this.name,
value: String? = this.value,
): GQLCapability {
return GQLCapability(
sourceLocation = sourceLocation,
description = description,
qualifiedName = qualifiedName,
name = qualifiedName,
value = value
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private fun ExtensionsMerger.mergeService(
): GQLServiceDefinition = with(serviceDefinition) {
return copy(
directives = mergeDirectives(directives, extension.directives),
capabilities = mergeUniquesOrThrow(capabilities, extension.capabilities) { it.qualifiedName }
capabilities = mergeUniquesOrThrow(capabilities, extension.capabilities) { it.name }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ internal class Parser(
return GQLCapability(
sourceLocation = sourceLocation(start),
description = description,
qualifiedName = qualifiedName,
name = qualifiedName,
value = value
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ internal fun validateSchema(definitions: List<GQLDefinition>, options: SchemaVal
val typeSystemExtensions = mutableListOf<GQLTypeSystemExtension>()
var schemaDefinition: GQLSchemaDefinition? = null
val reportedDefinitions = mutableSetOf<GQLDefinition>()
var serviceDefinition: GQLServiceDefinition? = null

/*
* Deduplicate the user input
Expand Down Expand Up @@ -139,6 +140,7 @@ internal fun validateSchema(definitions: List<GQLDefinition>, options: SchemaVal
}

is GQLServiceDefinition -> {
serviceDefinition = definition
// TODO: any validation to do here?
// See https://github.com/graphql/graphql-spec/pull/1208/changes#r2732688632
}
Expand Down Expand Up @@ -303,7 +305,7 @@ internal fun validateSchema(definitions: List<GQLDefinition>, options: SchemaVal
*
* Moving forward, extensions merging should probably be done first thing as a separate step, before any validation and/or linking of foreign schemas.
*/
val dedupedDefinitions = listOfNotNull(schemaDefinition) + directiveDefinitions.values + typeDefinitions.values
val dedupedDefinitions = listOfNotNull(schemaDefinition) + directiveDefinitions.values + typeDefinitions.values + listOfNotNull(serviceDefinition)
val mergedDefinitions = ExtensionsMerger(dedupedDefinitions + typeSystemExtensions, options.mergeOptions).merge().getOrThrow()

val mergedScope = DefaultValidationScope(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package com.apollographql.apollo.ast.introspection

import com.apollographql.apollo.annotations.ApolloExperimental
import com.apollographql.apollo.annotations.ApolloInternal
import com.apollographql.apollo.ast.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -479,7 +478,7 @@ private class GQLDocumentBuilder(private val introspectionSchema: IntrospectionS
private fun RCapability.toGQLCapability(): GQLCapability {
return GQLCapability(
description = description.unwrapDescription(qualifiedName),
qualifiedName = qualifiedName,
name = qualifiedName,
value = value.getOrThrow()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ internal fun GQLResult<GQLDocument>.serialize(): String {
}
}

fun shouldUpdateTestFixtures(): Boolean {
if (System.getenv("updateTestFixtures") != null) {
return true
}

return false
}
fun shouldUpdateTestFixtures() = System.getenv("updateTestFixtures") != null

internal fun testFilterMatches(value: String): Boolean {
val testFilter = System.getenv("testFilter") ?: return true
Expand Down
16 changes: 14 additions & 2 deletions libraries/apollo-execution/api/apollo-execution.api
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public final class com/apollographql/apollo/execution/ErrorPersistedDocument : c
}

public final class com/apollographql/apollo/execution/ExecutableSchema {
public fun <init> (Lcom/apollographql/apollo/ast/Schema;Ljava/util/Map;Lcom/apollographql/apollo/execution/RootResolver;Lcom/apollographql/apollo/execution/RootResolver;Lcom/apollographql/apollo/execution/RootResolver;Lcom/apollographql/apollo/execution/Resolver;Lcom/apollographql/apollo/execution/TypeResolver;Ljava/util/List;Lcom/apollographql/apollo/execution/PersistedDocumentCache;)V
public final fun execute (Lcom/apollographql/apollo/execution/GraphQLRequest;Lcom/apollographql/apollo/api/ExecutionContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun execute$default (Lcom/apollographql/apollo/execution/ExecutableSchema;Lcom/apollographql/apollo/execution/GraphQLRequest;Lcom/apollographql/apollo/api/ExecutionContext;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public final fun subscribe (Lcom/apollographql/apollo/execution/GraphQLRequest;Lcom/apollographql/apollo/api/ExecutionContext;)Lkotlinx/coroutines/flow/Flow;
Expand All @@ -33,6 +32,7 @@ public final class com/apollographql/apollo/execution/ExecutableSchema$Builder {
public final fun addInstrumentation (Lcom/apollographql/apollo/execution/Instrumentation;)Lcom/apollographql/apollo/execution/ExecutableSchema$Builder;
public final fun build ()Lcom/apollographql/apollo/execution/ExecutableSchema;
public final fun mutationRoot (Lcom/apollographql/apollo/execution/RootResolver;)Lcom/apollographql/apollo/execution/ExecutableSchema$Builder;
public final fun onError (Lcom/apollographql/apollo/execution/OnError;)Lcom/apollographql/apollo/execution/ExecutableSchema$Builder;
public final fun persistedDocumentCache (Lcom/apollographql/apollo/execution/PersistedDocumentCache;)Lcom/apollographql/apollo/execution/ExecutableSchema$Builder;
public final fun queryRoot (Lcom/apollographql/apollo/execution/RootResolver;)Lcom/apollographql/apollo/execution/ExecutableSchema$Builder;
public final fun resolver (Lcom/apollographql/apollo/execution/Resolver;)Lcom/apollographql/apollo/execution/ExecutableSchema$Builder;
Expand All @@ -59,6 +59,7 @@ public final class com/apollographql/apollo/execution/FloatCoercing : com/apollo
public final class com/apollographql/apollo/execution/GraphQLRequest {
public final fun getDocument ()Ljava/lang/String;
public final fun getExtensions ()Ljava/util/Map;
public final fun getOnError ()Lcom/apollographql/apollo/execution/OnError;
public final fun getOperationName ()Ljava/lang/String;
public final fun getVariables ()Ljava/util/Map;
}
Expand All @@ -70,11 +71,14 @@ public final class com/apollographql/apollo/execution/GraphQLRequest$Builder {
public final fun extensions (Ljava/util/Map;)Lcom/apollographql/apollo/execution/GraphQLRequest$Builder;
public final fun getDocument ()Ljava/lang/String;
public final fun getExtensions ()Ljava/util/Map;
public final fun getOnError ()Lcom/apollographql/apollo/execution/OnError;
public final fun getOperationName ()Ljava/lang/String;
public final fun getVariables ()Ljava/util/Map;
public final fun onError (Lcom/apollographql/apollo/execution/OnError;)Lcom/apollographql/apollo/execution/GraphQLRequest$Builder;
public final fun operationName (Ljava/lang/String;)Lcom/apollographql/apollo/execution/GraphQLRequest$Builder;
public final fun setDocument (Ljava/lang/String;)V
public final fun setExtensions (Ljava/util/Map;)V
public final fun setOnError (Lcom/apollographql/apollo/execution/OnError;)V
public final fun setOperationName (Ljava/lang/String;)V
public final fun setVariables (Ljava/util/Map;)V
public final fun variables (Ljava/util/Map;)Lcom/apollographql/apollo/execution/GraphQLRequest$Builder;
Expand All @@ -85,7 +89,6 @@ public final class com/apollographql/apollo/execution/GraphQLRequestKt {
public static final fun parseAsGraphQLRequest (Ljava/util/Map;)Ljava/lang/Object;
public static final fun parseAsGraphQLRequest (Lokio/BufferedSource;)Ljava/lang/Object;
public static final fun toExternalValueMap (Ljava/util/Map;)Ljava/lang/Object;
public static final fun toGraphQLRequest (Ljava/lang/String;)Lcom/apollographql/apollo/execution/GraphQLRequest;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaky removal before it's too late. 🥷

}

public final class com/apollographql/apollo/execution/GraphQLResponse {
Expand Down Expand Up @@ -140,6 +143,15 @@ public final class com/apollographql/apollo/execution/JsonCoercing : com/apollog
public fun serialize (Ljava/lang/Object;)Ljava/lang/Object;
}

public final class com/apollographql/apollo/execution/OnError : java/lang/Enum {
public static final field HALT Lcom/apollographql/apollo/execution/OnError;
public static final field NULL Lcom/apollographql/apollo/execution/OnError;
public static final field PROPAGATE Lcom/apollographql/apollo/execution/OnError;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lcom/apollographql/apollo/execution/OnError;
public static fun values ()[Lcom/apollographql/apollo/execution/OnError;
}

public abstract interface class com/apollographql/apollo/execution/OperationCallback {
public abstract fun onOperationCompleted (Lcom/apollographql/apollo/execution/GraphQLResponse;)Lcom/apollographql/apollo/execution/GraphQLResponse;
}
Expand Down
Loading
Loading