From fea4170b26f179cb881c8379ce3607c68dcb9631 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Thu, 17 Aug 2023 23:46:28 +0200 Subject: [PATCH] allow to upload PQL from Gradle --- .../apollo3/cli/PublishSchemaCommand.kt | 2 +- .../apollo-compiler/api/apollo-compiler.api | 1 + .../apollo3/compiler/add_required_fields.kt | 10 +- .../compiler/pqm/PersistedQueryManifest.kt | 8 +- .../api/apollo-gradle-plugin-external.api | 1 + .../gradle/api/RegisterOperationsConfig.kt | 2 + .../gradle/internal/ApolloPushSchemaTask.kt | 2 +- .../internal/ApolloRegisterOperationsTask.kt | 77 +- .../gradle/internal/DefaultApolloExtension.kt | 2 + .../apollo3/gradle/internal/DefaultService.kt | 7 - .../apollo-tooling/api/apollo-tooling.api | 39 + .../platform-api/public/operations.graphql | 34 + .../platform-api/public/schema.graphqls | 3141 ++++++----------- .../tooling/PersistedQueriesUploader.kt | 68 + .../apollo3/tooling/SchemaDownloader.kt | 12 - .../apollo3/tooling/SchemaUploader.kt | 15 +- .../apollographql/apollo3/tooling/graphos.kt | 25 + 17 files changed, 1253 insertions(+), 2193 deletions(-) create mode 100644 libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/PersistedQueriesUploader.kt create mode 100644 libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/graphos.kt diff --git a/libraries/apollo-cli/src/main/kotlin/com/apollographql/apollo3/cli/PublishSchemaCommand.kt b/libraries/apollo-cli/src/main/kotlin/com/apollographql/apollo3/cli/PublishSchemaCommand.kt index 4494f472c04..5fe1d2e0411 100644 --- a/libraries/apollo-cli/src/main/kotlin/com/apollographql/apollo3/cli/PublishSchemaCommand.kt +++ b/libraries/apollo-cli/src/main/kotlin/com/apollographql/apollo3/cli/PublishSchemaCommand.kt @@ -17,7 +17,7 @@ internal class PublishSchemaCommand: CliktCommand() { override fun run() { SchemaUploader.uploadSchema( - key = key, + apolloKey = key, graph = graph, variant = graphVariant, sdl = File(schema).readText(), diff --git a/libraries/apollo-compiler/api/apollo-compiler.api b/libraries/apollo-compiler/api/apollo-compiler.api index da8d668a37a..a42656f9d7a 100644 --- a/libraries/apollo-compiler/api/apollo-compiler.api +++ b/libraries/apollo-compiler/api/apollo-compiler.api @@ -463,6 +463,7 @@ public final class com/apollographql/apollo3/compiler/pqm/PersistedQueryManifest } public final class com/apollographql/apollo3/compiler/pqm/PersistedQueryManifestKt { + public static final fun toPersistedQueryManifest (Ljava/io/File;)Lcom/apollographql/apollo3/compiler/pqm/PersistedQueryManifest; public static final fun toPersistedQueryManifest (Ljava/util/Map;)Lcom/apollographql/apollo3/compiler/pqm/PersistedQueryManifest; public static final fun writeTo (Lcom/apollographql/apollo3/compiler/pqm/PersistedQueryManifest;Ljava/io/File;)V } diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/add_required_fields.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/add_required_fields.kt index 89b42b7b61e..a5059858dd3 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/add_required_fields.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/add_required_fields.kt @@ -78,7 +78,15 @@ private fun List.addRequiredFields( val requiresTypename = when(addTypename) { "ifPolymorphic" -> isRoot && isPolymorphic(schema, fragments, parentType) "ifFragments" -> { - println("Using addTypename=\"ifFragments\" is deprecated. Use \"always\" if you're using the cache or \"ifPolymorphic\" else.") + println("""Apollo: addTypename=\"ifFragments\" (default) is deprecated as it could lead to cache misses. Use \"always\" if you're using the cache or \"ifPolymorphic\" else: + |apollo { + | service("service") { + | addTypename.set("$ADD_TYPENAME_ALWAYS") + | // or + | addTypename.set("$ADD_TYPENAME_IF_POLYMORPHIC") + | } + |} + """.trimMargin()) selectionSet.any { it is GQLFragmentSpread || it is GQLInlineFragment } } "ifAbstract" -> isRoot && schema.typeDefinition(parentType).isAbstract() diff --git a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/pqm/PersistedQueryManifest.kt b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/pqm/PersistedQueryManifest.kt index 863531c292a..104bf9937fd 100644 --- a/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/pqm/PersistedQueryManifest.kt +++ b/libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/pqm/PersistedQueryManifest.kt @@ -1,6 +1,5 @@ package com.apollographql.apollo3.compiler.pqm -import com.apollographql.apollo3.compiler.operationoutput.OperationDescriptor import com.apollographql.apollo3.compiler.operationoutput.OperationOutput import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable @@ -34,6 +33,13 @@ fun PersistedQueryManifest.writeTo(file: File) { } } +@OptIn(ExperimentalSerializationApi::class) +fun File.toPersistedQueryManifest(): PersistedQueryManifest { + return source().buffer().use { + Json.decodeFromBufferedSource(it) + } +} + fun OperationOutput.toPersistedQueryManifest(): PersistedQueryManifest { return PersistedQueryManifest( format = "apollo-persisted-query-manifest", diff --git a/libraries/apollo-gradle-plugin-external/api/apollo-gradle-plugin-external.api b/libraries/apollo-gradle-plugin-external/api/apollo-gradle-plugin-external.api index f96a65b56aa..13c74ba1faa 100644 --- a/libraries/apollo-gradle-plugin-external/api/apollo-gradle-plugin-external.api +++ b/libraries/apollo-gradle-plugin-external/api/apollo-gradle-plugin-external.api @@ -76,6 +76,7 @@ public abstract interface class com/apollographql/apollo3/gradle/api/RegisterOpe public abstract fun getGraph ()Lorg/gradle/api/provider/Property; public abstract fun getGraphVariant ()Lorg/gradle/api/provider/Property; public abstract fun getKey ()Lorg/gradle/api/provider/Property; + public abstract fun getListId ()Lorg/gradle/api/provider/Property; } public abstract interface class com/apollographql/apollo3/gradle/api/Registry { diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/RegisterOperationsConfig.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/RegisterOperationsConfig.kt index ac81e1c8878..30711d1205f 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/RegisterOperationsConfig.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/api/RegisterOperationsConfig.kt @@ -3,6 +3,8 @@ package com.apollographql.apollo3.gradle.api import org.gradle.api.provider.Property interface RegisterOperationsConfig { + val listId: Property + val key: Property val graph: Property diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloPushSchemaTask.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloPushSchemaTask.kt index b141207642d..569693ec73b 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloPushSchemaTask.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloPushSchemaTask.kt @@ -83,7 +83,7 @@ abstract class ApolloPushSchemaTask : DefaultTask() { // Files are relative to the root project. It is not possible in a consistent way to have them relative to the current // working directory where the gradle command was started SchemaUploader.uploadSchema( - key = key, + apolloKey = key, graph = graph, variant = graphVariant ?: "current", sdl = File(projectRootDir).resolve(schema).readText(), diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloRegisterOperationsTask.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloRegisterOperationsTask.kt index 972465b7c3a..27b50cc5dfe 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloRegisterOperationsTask.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/ApolloRegisterOperationsTask.kt @@ -1,20 +1,32 @@ package com.apollographql.apollo3.gradle.internal +import com.apollographql.apollo3.compiler.MANIFEST_OPERATION_OUTPUT +import com.apollographql.apollo3.compiler.MANIFEST_PERSISTED_QUERY import com.apollographql.apollo3.compiler.operationoutput.toOperationOutput +import com.apollographql.apollo3.compiler.pqm.toPersistedQueryManifest +import com.apollographql.apollo3.tooling.CannotModifyOperationBody +import com.apollographql.apollo3.tooling.GraphNotFound +import com.apollographql.apollo3.tooling.PermissionError +import com.apollographql.apollo3.tooling.PersistedQuery +import com.apollographql.apollo3.tooling.PublishOperationsSuccess import com.apollographql.apollo3.tooling.RegisterOperations -import okio.buffer -import okio.source +import com.apollographql.apollo3.tooling.publishOperations import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty import org.gradle.api.provider.Property import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction abstract class ApolloRegisterOperationsTask: DefaultTask() { @get:InputFile abstract val operationOutput: RegularFileProperty + @get:Input + @get:Optional + abstract val listId: Property + @get:Input abstract val key: Property @@ -22,15 +34,64 @@ abstract class ApolloRegisterOperationsTask: DefaultTask() { abstract val graph: Property @get:Input + abstract val operationManifestFormat: Property + + @get:Input + @get:Optional abstract val graphVariant: Property @TaskAction fun taskAction() { - RegisterOperations.registerOperations( - key = key.get() ?: error("key is required to register operations"), - graphID = graph.get() ?: error("graphID is required to register operations"), - graphVariant = graphVariant.get() ?: error("graphVariant is required to register operations"), - operationOutput = operationOutput.get().asFile.toOperationOutput() - ) + if (listId.isPresent) { + check(operationManifestFormat.get() == MANIFEST_PERSISTED_QUERY) { + """Apollo: registering operations to a persisted query list requires operationManifestFormat = "$MANIFEST_PERSISTED_QUERY": + |apollo { + | service("service") { + | operationManifestFormat.set("$MANIFEST_PERSISTED_QUERY") + | } + |} + """.trimMargin() + } + val result = publishOperations( + listId = listId.get(), + persistedQueries = operationOutput.get().asFile.toPersistedQueryManifest().operations.map { + PersistedQuery( + name = it.name, + id = it.id, + body = it.body, + operationType = it.type + ) + }, + apolloKey = key.get(), + graph = graph.get() + ) + + when(result) { + is PublishOperationsSuccess -> { + println("Apollo: persisted query list uploaded successfully") + } + + is CannotModifyOperationBody -> error("Cannot upload persisted query list: cannot modify operation body ('${result.message}')") + GraphNotFound -> error("Cannot upload persisted query list: graph '$graph' not found") + is PermissionError -> error("Cannot upload persisted query list: permission error ('${result.message}')") + } + } else { + println("Apollo: registering operations without a listId is deprecated") + check(operationManifestFormat.get() == MANIFEST_OPERATION_OUTPUT) { + """Apollo: registering legacy operations requires operationManifestFormat = "$MANIFEST_OPERATION_OUTPUT": + |apollo { + | service("service") { + | operationManifestFormat.set("$MANIFEST_OPERATION_OUTPUT") + | } + |} + """.trimMargin() + } + RegisterOperations.registerOperations( + key = key.get() ?: error("key is required to register operations"), + graphID = graph.get() ?: error("graphID is required to register operations"), + graphVariant = graphVariant.get() ?: error("graphVariant is required to register operations"), + operationOutput = operationOutput.get().asFile.toOperationOutput() + ) + } } } \ No newline at end of file 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 b0aee1eeb9f..e469395dbc5 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 @@ -585,6 +585,8 @@ abstract class DefaultApolloExtension( project.tasks.register(ModelNames.registerApolloOperations(service), ApolloRegisterOperationsTask::class.java) { task -> task.group = TASK_GROUP + task.operationManifestFormat.set(service.operationManifestFormat()) + task.listId.set(registerOperationsConfig.listId) task.graph.set(registerOperationsConfig.graph) task.graphVariant.set(registerOperationsConfig.graphVariant) task.key.set(registerOperationsConfig.key) diff --git a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultService.kt b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultService.kt index 03502ff6ad1..1be0ceb5e3c 100644 --- a/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultService.kt +++ b/libraries/apollo-gradle-plugin-external/src/main/kotlin/com/apollographql/apollo3/gradle/internal/DefaultService.kt @@ -119,13 +119,6 @@ abstract class DefaultService @Inject constructor(val project: Project, override "Apollo: registerOperations {} cannot be configured outside of a service {} block" } - val existing = operationManifestFormat.orNull - check(existing == null || existing == MANIFEST_OPERATION_OUTPUT) { - "Apollo: registerOperation {} requires $MANIFEST_OPERATION_OUTPUT (found $existing)" - } - operationManifestFormat.set(MANIFEST_OPERATION_OUTPUT) - operationManifestFormat.finalizeValue() - val registerOperationsConfig = objects.newInstance(DefaultRegisterOperationsConfig::class.java) if (this.registerOperationsConfig != null) { diff --git a/libraries/apollo-tooling/api/apollo-tooling.api b/libraries/apollo-tooling/api/apollo-tooling.api index da8dd75ca2c..2d402fe9782 100644 --- a/libraries/apollo-tooling/api/apollo-tooling.api +++ b/libraries/apollo-tooling/api/apollo-tooling.api @@ -1,3 +1,42 @@ +public final class com/apollographql/apollo3/tooling/CannotModifyOperationBody : com/apollographql/apollo3/tooling/PublishOperationsResult { + public fun (Ljava/lang/String;)V + public final fun getMessage ()Ljava/lang/String; +} + +public final class com/apollographql/apollo3/tooling/GraphNotFound : com/apollographql/apollo3/tooling/PublishOperationsResult { + public static final field INSTANCE Lcom/apollographql/apollo3/tooling/GraphNotFound; +} + +public final class com/apollographql/apollo3/tooling/PermissionError : com/apollographql/apollo3/tooling/PublishOperationsResult { + public fun (Ljava/lang/String;)V + public final fun getMessage ()Ljava/lang/String; +} + +public final class com/apollographql/apollo3/tooling/PersistedQueriesUploaderKt { +} + +public final class com/apollographql/apollo3/tooling/PersistedQuery { + public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + public final fun getBody ()Ljava/lang/String; + public final fun getId ()Ljava/lang/String; + public final fun getName ()Ljava/lang/String; + public final fun getOperationType ()Ljava/lang/String; +} + +public abstract interface class com/apollographql/apollo3/tooling/PublishOperationsResult { +} + +public final class com/apollographql/apollo3/tooling/PublishOperationsSuccess : com/apollographql/apollo3/tooling/PublishOperationsResult { + public fun (IIIIILjava/lang/String;I)V + public final fun getAdded ()I + public final fun getIdentical ()I + public final fun getName ()Ljava/lang/String; + public final fun getRemoved ()I + public final fun getRevision ()I + public final fun getUnaffected ()I + public final fun getUpdated ()I +} + public final class com/apollographql/apollo3/tooling/SchemaDownloader$SpecVersion : java/lang/Enum { public static final field Draft Lcom/apollographql/apollo3/tooling/SchemaDownloader$SpecVersion; public static final field June_2018 Lcom/apollographql/apollo3/tooling/SchemaDownloader$SpecVersion; diff --git a/libraries/apollo-tooling/src/main/graphql/platform-api/public/operations.graphql b/libraries/apollo-tooling/src/main/graphql/platform-api/public/operations.graphql index 449e69a8e0a..dab84baf1fe 100644 --- a/libraries/apollo-tooling/src/main/graphql/platform-api/public/operations.graphql +++ b/libraries/apollo-tooling/src/main/graphql/platform-api/public/operations.graphql @@ -30,3 +30,37 @@ mutation PublishSubgraphSchema($graphID: ID!, $variant: String!, $subgraph: Stri } } } + +mutation PublishOperationsMutation($graphId: ID!, $listId: ID!, $operationManifest: [PersistedQueryInput!]) { + graph(id: $graphId) { + persistedQueryList(id: $listId) { + publishOperations(operations: $operationManifest) { + __typename + ... on PermissionError { + message + } + ... on CannotModifyOperationBodyError { + message + } + ... on PublishOperationsResult { + build { + revision + publish { + operationCounts { + added + identical + updated + unaffected + removed + } + } + list { + name + } + } + unchanged + } + } + } + } +} \ No newline at end of file diff --git a/libraries/apollo-tooling/src/main/graphql/platform-api/public/schema.graphqls b/libraries/apollo-tooling/src/main/graphql/platform-api/public/schema.graphqls index 0c4b7a4e81a..4a19d3e371a 100644 --- a/libraries/apollo-tooling/src/main/graphql/platform-api/public/schema.graphqls +++ b/libraries/apollo-tooling/src/main/graphql/platform-api/public/schema.graphqls @@ -3,142 +3,81 @@ schema { mutation: Mutation } -""" -An organization in Apollo Studio. Can have multiple members and graphs. -""" +"""An organization in Apollo Studio. Can have multiple members and graphs.""" type Organization { - """ - Globally unique identifier, which isn't guaranteed stable (can be changed by administrators). - """ + """Globally unique identifier, which isn't guaranteed stable (can be changed by administrators).""" id: ID! - + """Name of the organization, which can change over time and isn't unique.""" + name: String! auditLogExports: [AuditLogExport!] - - """ - Graphs belonging to this organization. - """ + """Graphs belonging to this organization.""" graphs(includeDeleted: Boolean): [Graph!]! - - """ - Name of the organization, which can change over time and isn't unique. - """ - name: String! - - """ - Graphs belonging to this organization. - """ + """Graphs belonging to this organization.""" services(includeDeleted: Boolean): [Graph!]! @deprecated(reason: "Use graphs field instead") } type OrganizationMutation { - """ - Trigger a request for an audit export - """ + """Trigger a request for an audit export""" requestAuditExport(actors: [ActorInput!], from: Timestamp!, graphIds: [String!], to: Timestamp!): Organization } -""" -Represents an actor that performs actions in Apollo Studio. Most actors are either a `USER` or a `GRAPH` (based on a request's provided API key), and they have the corresponding `ActorType`. -""" +"""Represents an actor that performs actions in Apollo Studio. Most actors are either a `USER` or a `GRAPH` (based on a request's provided API key), and they have the corresponding `ActorType`.""" type Actor { actorId: ID! - type: ActorType! } -""" -Input type to provide when specifying an `Actor` in operation arguments. See also the `Actor` object type. -""" +"""Input type to provide when specifying an `Actor` in operation arguments. See also the `Actor` object type.""" input ActorInput { actorId: ID! - type: ActorType! } enum ActorType { ANONYMOUS_USER - BACKFILL - CRON - GRAPH - INTERNAL_IDENTITY - SYNCHRONIZATION - SYSTEM - USER } -union AddOperationCollectionEntriesResult = AddOperationCollectionEntriesSuccess|PermissionError|ValidationError +union AddOperationCollectionEntriesResult = AddOperationCollectionEntriesSuccess | PermissionError | ValidationError type AddOperationCollectionEntriesSuccess { operationCollectionEntries: [OperationCollectionEntry!]! } -union AddOperationCollectionEntryResult = OperationCollectionEntry|PermissionError|ValidationError +union AddOperationCollectionEntryResult = OperationCollectionEntry | PermissionError | ValidationError input AddOperationInput { - """ - The operation's fields. - """ + """The operation's fields.""" document: OperationCollectionEntryStateInput! - - """ - The operation's name. - """ + """The operation's name.""" name: String! } type AffectedQuery { id: ID! - - """ - First 128 characters of query signature for display - """ + """First 128 characters of query signature for display""" signature: String - - """ - Name to display to the user for the operation - """ + """Name to display to the user for the operation""" displayName: String - - """ - Name provided for the operation, which can be empty string if it is an anonymous operation - """ + """Name provided for the operation, which can be empty string if it is an anonymous operation""" name: String - - """ - Determines if this query validates against the proposed schema - """ + """Determines if this query validates against the proposed schema""" isValid: Boolean - - """ - List of changes affecting this query. Returns null if queried from SchemaDiff.changes.affectedQueries.changes - """ + """List of changes affecting this query. Returns null if queried from SchemaDiff.changes.affectedQueries.changes""" changes: [ChangeOnOperation!] - - """ - Whether this operation was ignored and its severity was downgraded for that reason - """ + """Whether this operation was ignored and its severity was downgraded for that reason""" markedAsIgnored: Boolean - - """ - Whether the changes were marked as safe and its severity was downgraded for that reason - """ + """Whether the changes were marked as safe and its severity was downgraded for that reason""" markedAsSafe: Boolean - - """ - If the operation would be approved if the check ran again. Returns null if queried from SchemaDiff.changes.affectedQueries.alreadyApproved - """ + """If the operation would be approved if the check ran again. Returns null if queried from SchemaDiff.changes.affectedQueries.alreadyApproved""" alreadyApproved: Boolean - - """ - If the operation would be ignored if the check ran again - """ + """If the operation would be ignored if the check ran again""" alreadyIgnored: Boolean } @@ -147,184 +86,106 @@ Represents an API key that's used to authenticate a particular Apollo user or graph. """ interface ApiKey { - """ - The API key's ID. - """ + """The API key's ID.""" id: ID! - - """ - The API key's name, for distinguishing it from other keys. - """ + """The API key's name, for distinguishing it from other keys.""" keyName: String - - """ - The value of the API key. **This is a secret credential!** - """ + """The value of the API key. **This is a secret credential!**""" token: String! } type ApiKeyProvision { apiKey: ApiKey! - created: Boolean! } type AuditLogExport { - """ - The list of actors to filter the audit export - """ + """The list of actors to filter the audit export""" actors: [Identity!] - - """ - The time when the audit export was completed - """ + """The time when the audit export was completed""" completedAt: Timestamp - - """ - The time when the audit export was reqeusted - """ + """The time when the audit export was reqeusted""" createdAt: Timestamp! - - """ - List of URLs to download the audits for the requested range - """ + """List of URLs to download the audits for the requested range""" downloadUrls: [String!] - - """ - The starting point of audits to include in export - """ + """The starting point of audits to include in export""" from: Timestamp! - - """ - The list of graphs to filter the audit export - """ + """The list of graphs to filter the audit export""" graphs: [Graph!] - - """ - The id for the audit export - """ + """The id for the audit export""" id: ID! - - """ - The user that initiated the audit export - """ + """The user that initiated the audit export""" requester: User - - """ - The status of the audit export - """ + """The status of the audit export""" status: AuditStatus! - - """ - The end point of audits to include in export - """ + """The end point of audits to include in export""" to: Timestamp! } enum AuditStatus { CANCELLED - COMPLETED - EXPIRED - FAILED - IN_PROGRESS - QUEUED } -""" -The building of a Studio variant (including supergraph composition and any contract filtering) as part of a launch. -""" +"""The building of a Studio variant (including supergraph composition and any contract filtering) as part of a launch.""" type Build { - """ - The inputs provided to the build, including subgraph and contract details. - """ + """The inputs provided to the build, including subgraph and contract details.""" input: BuildInput! - - """ - The result of the build. This value is null until the build completes. - """ + """The result of the build. This value is null until the build completes.""" result: BuildResult } -""" -A single error that occurred during the failed execution of a build. -""" +"""A single error that occurred during the failed execution of a build.""" type BuildError { code: String - + failedStep: String locations: [SourceLocation!]! - message: String! } -""" -Contains the details of an executed build that failed. -""" +"""Contains the details of an executed build that failed.""" type BuildFailure { - """ - A list of all errors that occurred during the failed build. - """ + """A list of all errors that occurred during the failed build.""" errorMessages: [BuildError!]! } -union BuildInput = CompositionBuildInput|FilterBuildInput +union BuildInput = CompositionBuildInput | FilterBuildInput -union BuildResult = BuildFailure|BuildSuccess +union BuildResult = BuildFailure | BuildSuccess -""" -Contains the details of an executed build that succeeded. -""" +"""Contains the details of an executed build that succeeded.""" type BuildSuccess { - """ - Contains the supergraph and API schemas created by composition. - """ + """Contains the supergraph and API schemas created by composition.""" coreSchema: CoreSchema! } -""" -A single change that was made to a definition in a schema. -""" +type CannotModifyOperationBodyError implements Error { + message: String! +} + +"""A single change that was made to a definition in a schema.""" type Change { - """ - The severity of the change (e.g., `FAILURE` or `NOTICE`) - """ + """The severity of the change (e.g., `FAILURE` or `NOTICE`)""" severity: ChangeSeverity! - - """ - Indicates the type of change that was made, and to what (e.g., 'TYPE_REMOVED'). - """ + """Indicates the type of change that was made, and to what (e.g., 'TYPE_REMOVED').""" code: String! - - """ - Indication of the category of the change (e.g. addition, removal, edit). - """ + """Indication of the category of the change (e.g. addition, removal, edit).""" category: ChangeCategory! - - """ - A human-readable description of the change. - """ + """A human-readable description of the change.""" description: String! - affectedQueries: [AffectedQuery!] - - """ - Top level node affected by the change. - """ + """Top level node affected by the change.""" parentNode: NamedIntrospectionType - """ Node related to the top level node that was changed, such as a field in an object, a value in an enum or the object of an interface. """ childNode: NamedIntrospectionValue - - """ - Target arg of change made. - """ + """Target arg of change made.""" argNode: NamedIntrospectionArg } @@ -334,11 +195,8 @@ can be grouped by. """ enum ChangeCategory { ADDITION - EDIT - REMOVAL - DEPRECATION } @@ -347,200 +205,86 @@ These schema change codes represent all of the possible changes that can occur during the schema diff algorithm. """ enum ChangeCode { - """ - Field was removed from the type. - """ + """Field was removed from the type.""" FIELD_REMOVED - - """ - Type (object or scalar) was removed from the schema. - """ + """Type (object or scalar) was removed from the schema.""" TYPE_REMOVED - - """ - Argument to a field was removed. - """ + """Argument to a field was removed.""" ARG_REMOVED - - """ - Type is no longer included in the union. - """ + """Type is no longer included in the union.""" TYPE_REMOVED_FROM_UNION - - """ - Field was removed from the input object. - """ + """Field was removed from the input object.""" FIELD_REMOVED_FROM_INPUT_OBJECT - - """ - Value was removed from the enum. - """ + """Value was removed from the enum.""" VALUE_REMOVED_FROM_ENUM - - """ - Type no longer implements the interface. - """ + """Type no longer implements the interface.""" TYPE_REMOVED_FROM_INTERFACE - - """ - Non-nullable argument was added to the field. - """ + """Non-nullable argument was added to the field.""" REQUIRED_ARG_ADDED - - """ - Non-nullable field was added to the input object. (Deprecated.) - """ + """Non-nullable field was added to the input object. (Deprecated.)""" NON_NULLABLE_FIELD_ADDED_TO_INPUT_OBJECT - - """ - Required field was added to the input object. - """ + """Required field was added to the input object.""" REQUIRED_FIELD_ADDED_TO_INPUT_OBJECT - - """ - Return type for the field was changed. - """ + """Return type for the field was changed.""" FIELD_CHANGED_TYPE - - """ - Type of the field in the input object was changed. - """ + """Type of the field in the input object was changed.""" FIELD_ON_INPUT_OBJECT_CHANGED_TYPE - """ Type was changed from one kind to another. Ex: scalar to object or enum to union. """ TYPE_CHANGED_KIND - - """ - Type of the argument was changed. - """ + """Type of the argument was changed.""" ARG_CHANGED_TYPE - - """ - Argument was changed from nullable to non-nullable. - """ + """Argument was changed from nullable to non-nullable.""" ARG_CHANGED_TYPE_OPTIONAL_TO_REQUIRED - - """ - A new value was added to the enum. - """ + """A new value was added to the enum.""" VALUE_ADDED_TO_ENUM - - """ - A new value was added to the enum. - """ + """A new value was added to the enum.""" TYPE_ADDED_TO_UNION - - """ - Type now implements the interface. - """ + """Type now implements the interface.""" TYPE_ADDED_TO_INTERFACE - - """ - Default value added or changed for the argument. - """ + """Default value added or changed for the argument.""" ARG_DEFAULT_VALUE_CHANGE - - """ - Nullable argument was added to the field. - """ + """Nullable argument was added to the field.""" OPTIONAL_ARG_ADDED - - """ - Nullable field was added to the input type. (Deprecated.) - """ + """Nullable field was added to the input type. (Deprecated.)""" NULLABLE_FIELD_ADDED_TO_INPUT_OBJECT - - """ - Optional field was added to the input type. - """ + """Optional field was added to the input type.""" OPTIONAL_FIELD_ADDED_TO_INPUT_OBJECT - - """ - Field was added to the type. - """ + """Field was added to the type.""" FIELD_ADDED - - """ - Type was added to the schema. - """ + """Type was added to the schema.""" TYPE_ADDED - - """ - Enum was deprecated. - """ + """Enum was deprecated.""" ENUM_DEPRECATED - - """ - Enum deprecation was removed. - """ + """Enum deprecation was removed.""" ENUM_DEPRECATION_REMOVED - - """ - Reason for enum deprecation changed. - """ + """Reason for enum deprecation changed.""" ENUM_DEPRECATED_REASON_CHANGE - - """ - Field was deprecated. - """ + """Field was deprecated.""" FIELD_DEPRECATED - - """ - Field deprecation removed. - """ + """Field deprecation removed.""" FIELD_DEPRECATION_REMOVED - - """ - Reason for field deprecation changed. - """ + """Reason for field deprecation changed.""" FIELD_DEPRECATED_REASON_CHANGE - - """ - Description was added, removed, or updated for type. - """ + """Description was added, removed, or updated for type.""" TYPE_DESCRIPTION_CHANGE - - """ - Description was added, removed, or updated for field. - """ + """Description was added, removed, or updated for field.""" FIELD_DESCRIPTION_CHANGE - - """ - Description was added, removed, or updated for enum value. - """ + """Description was added, removed, or updated for enum value.""" ENUM_VALUE_DESCRIPTION_CHANGE - - """ - Description was added, removed, or updated for argument. - """ + """Description was added, removed, or updated for argument.""" ARG_DESCRIPTION_CHANGE - - """ - Directive was removed. - """ + """Directive was removed.""" DIRECTIVE_REMOVED - - """ - Argument to the directive was removed. - """ + """Argument to the directive was removed.""" DIRECTIVE_ARG_REMOVED - - """ - Location of the directive was removed. - """ + """Location of the directive was removed.""" DIRECTIVE_LOCATION_REMOVED - - """ - Repeatable flag was removed for directive. - """ + """Repeatable flag was removed for directive.""" DIRECTIVE_REPEATABLE_REMOVED - - """ - Non-nullable argument added to directive. - """ + """Non-nullable argument added to directive.""" REQUIRED_DIRECTIVE_ARG_ADDED } @@ -550,39 +294,26 @@ about a particular kind of schema change. """ type ChangeDefinition { code: ChangeCode! - defaultSeverity: ChangeSeverity! - category: ChangeCategory! } -""" -An addition made to a Studio variant's changelog after a launch. -""" +"""An addition made to a Studio variant's changelog after a launch.""" type ChangelogLaunchResult { createdAt: Timestamp! - schemaTagID: ID! } -""" -Info about a change in the context of an operation it affects -""" +"""Info about a change in the context of an operation it affects""" type ChangeOnOperation { - """ - The semantic info about this change, i.e. info about the change that doesn't depend on the operation - """ + """The semantic info about this change, i.e. info about the change that doesn't depend on the operation""" semanticChange: SemanticChange! - - """ - Human-readable explanation of the impact of this change on the operation - """ + """Human-readable explanation of the impact of this change on the operation""" impact: String } enum ChangeSeverity { FAILURE - NOTICE } @@ -603,37 +334,25 @@ type ChangeSummary { and all aspects of enums, unions, and scalars. """ type: TypeChangeSummaryCounts! - - """ - Counts for changes to fields of objects, input objects, and interfaces. - """ + """Counts for changes to fields of objects, input objects, and interfaces.""" field: FieldChangeSummaryCounts! - - """ - Counts for all changes. - """ + """Counts for all changes.""" total: TotalChangeSummaryCounts! } enum ChangeType { FAILURE - NOTICE } -""" -Filter options available when listing checks. -""" +"""Filter options available when listing checks.""" input CheckFilterInput { authors: [String!] - branches: [String!] - subgraphs: [String!] - status: CheckFilterInputStatusOption - variants: [String!] + ids: [String!] } """ @@ -642,93 +361,52 @@ This should always match CheckWorkflowStatus """ enum CheckFilterInputStatusOption { FAILED - - PENDING - PASSED + PENDING } -""" -The result of performing a subgraph check, including all steps. -""" +"""The result of performing a subgraph check, including all steps.""" type CheckPartialSchemaResult { - """ - Result of compostion run as part of the overall subgraph check. - """ + """Result of compostion run as part of the overall subgraph check.""" compositionValidationResult: CompositionCheckResult! - - """ - Overall result of the check. This will be null if composition validation was unsuccessful. - """ + """Overall result of the check. This will be null if composition validation was unsuccessful.""" checkSchemaResult: CheckSchemaResult - - """ - Whether any modifications were detected in the composed core schema. - """ + """Whether any modifications were detected in the composed core schema.""" coreSchemaModified: Boolean! } -""" -The possible results of a request to initiate schema checks (either a success object or one of multiple `Error` objects). -""" -union CheckRequestResult = CheckRequestSuccess|InvalidInputError|PermissionError|PlanError +"""The possible results of a request to initiate schema checks (either a success object or one of multiple `Error` objects).""" +union CheckRequestResult = CheckRequestSuccess | InvalidInputError | PermissionError | PlanError -""" -Represents a successfully initiated execution of schema checks. This does not indicate the _result_ of the checks, only that they were initiated. -""" +"""Represents a successfully initiated execution of schema checks. This does not indicate the _result_ of the checks, only that they were initiated.""" type CheckRequestSuccess { - """ - The URL of the Apollo Studio page for this check. - """ + """The URL of the Apollo Studio page for this check.""" targetURL: String! - - """ - The unique ID for this execution of schema checks. - """ + """The unique ID for this execution of schema checks.""" workflowID: ID! } -""" -Input type to provide when running schema checks asynchronously for a non-federated graph. -""" +"""Input type to provide when running schema checks asynchronously for a non-federated graph.""" input CheckSchemaAsyncInput { - """ - Configuration options for the check execution. - """ + """Configuration options for the check execution.""" config: HistoricQueryParametersInput! - - """ - The GitHub context to associate with the check. - """ + """The GitHub context to associate with the check.""" gitContext: GitContextInput! - graphRef: ID @deprecated(reason: "This field is not required to be sent anymore") - - """ - The URL of the GraphQL endpoint that Apollo Sandbox introspected to obtain the proposed schema. Required if `isSandbox` is `true`. - """ + """The URL of the GraphQL endpoint that Apollo Sandbox introspected to obtain the proposed schema. Required if `isSandbox` is `true`.""" introspectionEndpoint: String - - """ - If `true`, the check was initiated by Apollo Sandbox. - """ + """If `true`, the check was initiated automatically by a Proposal update.""" + isProposal: Boolean + """If `true`, the check was initiated by Apollo Sandbox.""" isSandbox: Boolean! - proposedSchemaDocument: String } -""" -The result of running schema checks on a graph variant. -""" +"""The result of running schema checks on a graph variant.""" type CheckSchemaResult { - """ - The schema diff and affected operations generated by the schema check. - """ + """The schema diff and affected operations generated by the schema check.""" diffToPrevious: SchemaDiff! - - """ - The URL to view the schema diff in Studio. - """ + """The URL to view the schema diff in Studio.""" targetUrl: String } @@ -738,176 +416,104 @@ type CheckWorkflow { base schema will be tested in operations checks. """ baseVariant: GraphVariant - - """ - The timestamp when the check workflow completed. - """ + """The timestamp when the check workflow completed.""" completedAt: Timestamp - id: ID! - - """ - The name of the implementing service that was responsible for triggering the validation. - """ + """The name of the implementing service that was responsible for triggering the validation.""" implementingServiceName: String - - """ - The timestamp when the check workflow started. - """ + """The timestamp when the check workflow started.""" startedAt: Timestamp - - """ - Overall status of the workflow, based on the underlying task statuses. - """ + """Overall status of the workflow, based on the underlying task statuses.""" status: CheckWorkflowStatus! - - """ - The set of check tasks associated with this workflow, e.g. composition, operations, etc. - """ + """The set of check tasks associated with this workflow, e.g. composition, operations, etc.""" tasks: [CheckWorkflowTask!]! - - """ - Contextual parameters supplied by the runtime environment where the check was run. - """ + """Contextual parameters supplied by the runtime environment where the check was run.""" gitContext: GitContext - createdAt: Timestamp! } enum CheckWorkflowStatus { FAILED - PASSED - PENDING } interface CheckWorkflowTask { completedAt: Timestamp - createdAt: Timestamp! - id: ID! - """ The status of this task. All tasks start with the PENDING status while initializing. If any - prerequisite task fails, then the task status becomes BLOCKED. Otherwise, if all prerequisite - tasks pass, then this task runs (still having the PENDING status). Once the task completes, the - task status will become either PASSED or FAILED. + prerequisite task fails, then the task status becomes BLOCKED. Otherwise, if all prerequisite + tasks pass, then this task runs (still having the PENDING status). Once the task completes, the + task status will become either PASSED or FAILED. """ status: CheckWorkflowTaskStatus! - - """ - A studio UI url to view the details of this check workflow task - """ + """A studio UI url to view the details of this check workflow task""" targetURL: String - - """ - The workflow that this task belongs to. - """ + """The workflow that this task belongs to.""" workflow: CheckWorkflow! } enum CheckWorkflowTaskStatus { BLOCKED - FAILED - PASSED - PENDING } -""" -Filter options to exclude by client reference ID, client name, and client version. -""" +"""Filter options to exclude by client reference ID, client name, and client version.""" input ClientInfoFilter { name: String! - - """ - Ignored - """ + """Ignored""" referenceID: ID - version: String } -""" -The result of supergraph composition that Studio performed in response to an attempted deletion of a subgraph. -""" +"""The result of supergraph composition that Studio performed in response to an attempted deletion of a subgraph.""" type SubgraphRemovalResult { - """ - A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated. - """ + """A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated.""" errors: [SchemaCompositionError]! - - """ - Whether this composition result resulted in a new supergraph schema passed to Uplink (`true`), or the build failed for any reason (`false`). For dry runs, this value is `true` if Uplink _would have_ been updated with the result. - """ + """Whether this composition result resulted in a new supergraph schema passed to Uplink (`true`), or the build failed for any reason (`false`). For dry runs, this value is `true` if Uplink _would have_ been updated with the result.""" updatedGateway: Boolean! } -""" -The result of supergraph composition that Studio performed in response to an attempted publish of a subgraph. -""" +"""The result of supergraph composition that Studio performed in response to an attempted publish of a subgraph.""" type SubgraphPublicationResult { - """ - The generated composition config, or null if any errors occurred. - """ + """The generated composition config, or null if any errors occurred.""" compositionConfig: CompositionConfig - - """ - A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated. - """ + """A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated.""" errors: [SchemaCompositionError]! - - """ - Whether this composition result resulted in a new supergraph schema passed to Uplink (`true`), or the build failed for any reason (`false`). For dry runs, this value is `true` if Uplink _would have_ been updated with the result. - """ + """Whether this composition result resulted in a new supergraph schema passed to Uplink (`true`), or the build failed for any reason (`false`). For dry runs, this value is `true` if Uplink _would have_ been updated with the result.""" updatedGateway: Boolean! - - """ - Whether a new subgraph was created as part of this publish. - """ + """Whether a new subgraph was created as part of this publish.""" wasCreated: Boolean! - - """ - The URL of the Studio page for this update's associated launch, if available. - """ + """All subgraphs that were created from this mutation""" + subgraphsCreated: [String!]! + """The URL of the Studio page for this update's associated launch, if available.""" launchUrl: String - - """ - Human-readable text describing the launch result of the subgraph publish. - """ + """Human-readable text describing the launch result of the subgraph publish.""" launchCliCopy: String } type CompositionBuildInput { subgraphs: [Subgraph!]! - version: String } type CompositionCheckTask implements CheckWorkflowTask { completedAt: Timestamp - """ Whether the build's output supergraph core schema differs from that of the active publish for the workflow's variant at the time this field executed (NOT at the time the check workflow started). """ coreSchemaModified: Boolean! - createdAt: Timestamp! - id: ID! - status: CheckWorkflowTaskStatus! - targetURL: String - workflow: CheckWorkflow! - """ An old version of buildResult that returns a very old GraphQL type that generally should be avoided. This field will soon be deprecated. @@ -915,188 +521,124 @@ type CompositionCheckTask implements CheckWorkflowTask { result: CompositionResult } -""" -Composition configuration exposed to the gateway. -""" +"""Composition configuration exposed to the gateway.""" type CompositionConfig { - """ - The resulting API schema's SHA256 hash, represented as a hexadecimal string. - """ + """The resulting API schema's SHA256 hash, represented as a hexadecimal string.""" schemaHash: String! } -""" -The result of supergraph composition that Studio performed. -""" +"""The result of supergraph composition that Studio performed.""" type CompositionPublishResult implements CompositionResult { - """ - The unique ID for this instance of composition. - """ + """The unique ID for this instance of composition.""" graphCompositionID: ID! - - """ - A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated. - """ + """A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated.""" errors: [SchemaCompositionError!]! - - """ - The supergraph SDL generated by composition. - """ + """The supergraph SDL generated by composition.""" supergraphSdl: GraphQLDocument } -""" -The result of supergraph composition performed by Apollo Studio, often as the result of a subgraph check or subgraph publish. See individual implementations for more details. -""" +"""The result of supergraph composition performed by Apollo Studio, often as the result of a subgraph check or subgraph publish. See individual implementations for more details.""" interface CompositionResult { - """ - The unique ID for this instance of composition. - """ + """The unique ID for this instance of composition.""" graphCompositionID: ID! - - """ - A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated. - """ + """A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated.""" errors: [SchemaCompositionError!]! - - """ - Supergraph SDL generated by composition. - """ + """Supergraph SDL generated by composition.""" supergraphSdl: GraphQLDocument } -""" -The result of composition validation run by Apollo Studio during a subgraph check. -""" +"""The result of composition validation run by Apollo Studio during a subgraph check.""" type CompositionCheckResult implements CompositionResult { - """ - The unique ID for this instance of composition. - """ + """The unique ID for this instance of composition.""" graphCompositionID: ID! - - """ - A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated. - """ + """A list of errors that occurred during composition. Errors mean that Apollo was unable to compose the graph variant's subgraphs into a supergraph schema. If any errors are present, gateways / routers are not updated.""" errors: [SchemaCompositionError!]! - - """ - The supergraph schema document generated by composition. - """ + """The supergraph schema document generated by composition.""" supergraphSdl: GraphQLDocument } type ContractVariantUpsertErrors { - """ - A list of all errors that occurred when attempting to create or update a contract variant. - """ + """A list of all errors that occurred when attempting to create or update a contract variant.""" errorMessages: [String!]! } -union ContractVariantUpsertResult = ContractVariantUpsertErrors|ContractVariantUpsertSuccess +union ContractVariantUpsertResult = ContractVariantUpsertErrors | ContractVariantUpsertSuccess type ContractVariantUpsertSuccess { - """ - The updated contract variant - """ + """The updated contract variant""" contractVariant: GraphVariant! - - """ - Human-readable text describing the launch result of the contract update. - """ + """Human-readable text describing the launch result of the contract update.""" launchCliCopy: String - - """ - The URL of the Studio page for this update's associated launch, if available. - """ + """The URL of the Studio page for this update's associated launch, if available.""" launchUrl: String } -""" -Contains the supergraph and API schemas generated by composition. -""" +type Coordinate { + byteOffset: Int! + column: Int! + line: Int! +} + +"""Contains the supergraph and API schemas generated by composition.""" type CoreSchema { - """ - The composed API schema document. - """ + """The composed API schema document.""" apiDocument: GraphQLDocument! - - """ - The composed supergraph schema document. - """ + """The composed supergraph schema document.""" coreDocument: GraphQLDocument! - - """ - The supergraph schema document's SHA256 hash, represented as a hexadecimal string. - """ + """The supergraph schema document's SHA256 hash, represented as a hexadecimal string.""" coreHash: String! } -union CreateOperationCollectionResult = OperationCollection|PermissionError|ValidationError +union CreateOperationCollectionResult = OperationCollection | PermissionError | ValidationError + +"""An error that occurs when creating a proposal fails.""" +type CreateProposalError implements Error { + """The error's details.""" + message: String! +} """ Implement the DateTime scalar The input/output is a string in RFC3339 format. """ -scalar DateTime @specifiedBy(url: "https:\/\/datatracker.ietf.org\/doc\/html\/rfc3339") +scalar DateTime @specifiedBy(url: "https://datatracker.ietf.org/doc/html/rfc3339") union DeleteOperationCollectionResult = PermissionError -""" -The result of attempting to delete a graph variant. -""" +"""The result of attempting to delete a graph variant.""" type GraphVariantDeletionResult { - """ - Whether the variant was deleted or not. - """ + """Whether the variant was deleted or not.""" deleted: Boolean! } -""" -The result of a schema checks workflow that was run on a downstream variant as part of checks for the corresponding source variant. Most commonly, these downstream checks are [contract checks](https://www.apollographql.com/docs/studio/contracts#contract-checks). -""" +"""The result of a schema checks workflow that was run on a downstream variant as part of checks for the corresponding source variant. Most commonly, these downstream checks are [contract checks](https://www.apollographql.com/docs/studio/contracts#contract-checks).""" type DownstreamCheckResult { - """ - Whether the downstream check workflow blocks the upstream check workflow from completing. - """ + """Whether the downstream check workflow blocks the upstream check workflow from completing.""" blocking: Boolean! - - """ - The ID of the graph that the downstream variant belongs to. - """ + """The ID of the graph that the downstream variant belongs to.""" downstreamGraphID: String! - - """ - The name of the downstream variant. - """ + """The name of the downstream variant.""" downstreamVariantName: String! - """ The downstream checks workflow that this result corresponds to. This value is null if the workflow hasn't been initialized yet, or if the downstream variant was deleted. """ downstreamWorkflow: CheckWorkflow - """ Whether the downstream check workflow is causing the upstream check workflow to fail. This occurs when the downstream check workflow is both blocking and failing. This may be null while the downstream check workflow is pending. """ failsUpstreamWorkflow: Boolean - - """ - The downstream checks task that this result corresponds to. - """ + """The downstream checks task that this result corresponds to.""" workflowTask: DownstreamCheckTask! } type DownstreamCheckTask implements CheckWorkflowTask { completedAt: Timestamp - createdAt: Timestamp! - id: ID! - """ A list of results for all downstream checks triggered as part of the source variant's checks workflow. This value is null if the task hasn't been initialized yet, or if the build task fails (the build task is a @@ -1104,87 +646,50 @@ type DownstreamCheckTask implements CheckWorkflowTask { if the source variant has no downstream variants. """ results: [DownstreamCheckResult!] - status: CheckWorkflowTaskStatus! - targetURL: String - workflow: CheckWorkflow! } +"""GraphQL Error""" interface Error { message: String! } -""" -A single subgraph in a supergraph. Every supergraph managed by Apollo Studio includes at least one subgraph. See https://www.apollographql.com/docs/federation/managed-federation/overview/ for more information. -""" +"""A single subgraph in a supergraph. Every supergraph managed by Apollo Studio includes at least one subgraph. See https://www.apollographql.com/docs/federation/managed-federation/overview/ for more information.""" type GraphVariantSubgraph { - """ - The subgraph's name. - """ + """The subgraph's name.""" name: String! - - """ - The URL of the subgraph's GraphQL endpoint. - """ + """The URL of the subgraph's GraphQL endpoint.""" url: String - - """ - The current user-provided version/edition of the subgraph. Typically a Git SHA or docker image ID. - """ + """The current user-provided version/edition of the subgraph. Typically a Git SHA or docker image ID.""" revision: String! - - """ - The ID of the graph this subgraph belongs to. - """ + """The ID of the graph this subgraph belongs to.""" graphID: String! - - """ - The name of the graph variant this subgraph belongs to. - """ + """The name of the graph variant this subgraph belongs to.""" graphVariant: String! - - """ - The subgraph's current active schema, used in supergraph composition for the the associated variant. - """ + """The subgraph's current active schema, used in supergraph composition for the the associated variant.""" activePartialSchema: SubgraphSchema! - - """ - The timestamp when the subgraph was created. - """ + """The timestamp when the subgraph was created.""" createdAt: Timestamp! - - """ - The timestamp when the subgraph was most recently updated. - """ + """The timestamp when the subgraph was deleted. Null if it wasn't deleted.""" + deletedAt: Timestamp + """The timestamp when the subgraph was most recently updated.""" updatedAt: Timestamp! } -""" -Container for a list of subgraphs composing a supergraph. -""" +"""Container for a list of subgraphs composing a supergraph.""" type GraphVariantSubgraphs { - """ - The list of underlying subgraphs. - """ + """The list of underlying subgraphs.""" services: [GraphVariantSubgraph!]! } -""" -Counts of changes at the field level, including objects, interfaces, and input fields. -""" +"""Counts of changes at the field level, including objects, interfaces, and input fields.""" type FieldChangeSummaryCounts { - """ - Number of changes that are additions of fields to object, interface, and input types. - """ + """Number of changes that are additions of fields to object, interface, and input types.""" additions: Int! - - """ - Number of changes that are removals of fields from object, interface, and input types. - """ + """Number of changes that are removals of fields from object, interface, and input types.""" removals: Int! - """ Number of changes that are field edits. This includes fields changing type and any field deprecation and description changes, but also includes any argument changes and any input object @@ -1193,65 +698,40 @@ type FieldChangeSummaryCounts { edits: Int! } -""" -Inputs provided to the build for a contract variant, which filters types and fields from a source variant's schema. -""" +"""Inputs provided to the build for a contract variant, which filters types and fields from a source variant's schema.""" type FilterBuildInput { - """ - Schema filtering rules for the build, such as tags to include or exclude from the source variant schema. - """ + """Schema filtering rules for the build, such as tags to include or exclude from the source variant schema.""" filterConfig: FilterConfig! - - """ - The source variant schema document's SHA256 hash, represented as a hexadecimal string. - """ + """The source variant schema document's SHA256 hash, represented as a hexadecimal string.""" schemaHash: String! } type FilterCheckTask implements CheckWorkflowTask { completedAt: Timestamp - createdAt: Timestamp! - id: ID! - status: CheckWorkflowTaskStatus! - targetURL: String - workflow: CheckWorkflow! } -""" -The filter configuration used to build a contract schema. The configuration consists of lists of tags for schema elements to include or exclude in the resulting schema. -""" +"""The filter configuration used to build a contract schema. The configuration consists of lists of tags for schema elements to include or exclude in the resulting schema.""" type FilterConfig { - """ - Tags of schema elements to exclude from the contract schema. - """ + """Tags of schema elements to exclude from the contract schema.""" exclude: [String!]! - - """ - Tags of schema elements to include in the contract schema. - """ + """Tags of schema elements to include in the contract schema.""" include: [String!]! } input FilterConfigInput { - """ - A list of tags for schema elements to exclude from the resulting contract schema. - """ + """A list of tags for schema elements to exclude from the resulting contract schema.""" exclude: [String!]! - """ Whether to hide unreachable objects, interfaces, unions, inputs, enums and scalars from the resulting contract schema. Defaults to `false`. """ hideUnreachableTypes: Boolean! = false - - """ - A list of tags for schema elements to include in the resulting contract schema. - """ + """A list of tags for schema elements to include in the resulting contract schema.""" include: [String!]! } @@ -1259,33 +739,17 @@ type GitContext { commit: ID } -""" -Input type to provide when specifying the Git context for a run of schema checks. -""" +"""This is stored with a schema when it is uploaded""" input GitContextInput { - """ - The Git repository branch used in the check. - """ + """The Git repository branch used in the check.""" branch: String - - """ - The ID of the Git commit used in the check. - """ + """The ID of the Git commit used in the check.""" commit: ID - - """ - The username of the user who created the Git commit used in the check. - """ + """The username of the user who created the Git commit used in the check.""" committer: String - - """ - The commit message of the Git commit used in the check. - """ + """The commit message of the Git commit used in the check.""" message: String - - """ - The Git repository's remote URL. - """ + """The Git repository's remote URL.""" remoteUrl: String } @@ -1294,255 +758,148 @@ Represents a graph API key, which has permissions scoped to a user role for a single Apollo graph. """ type GraphApiKey implements ApiKey { - """ - The timestamp when the API key was created. - """ + """The timestamp when the API key was created.""" createdAt: Timestamp! - - """ - Details of the user or graph that created the API key. - """ + """Details of the user or graph that created the API key.""" createdBy: Identity - - """ - The API key's ID. - """ + """The API key's ID.""" id: ID! - - """ - The API key's name, for distinguishing it from other keys. - """ + """The API key's name, for distinguishing it from other keys.""" keyName: String - - """ - The permission level assigned to the API key upon creation. - """ + """The permission level assigned to the API key upon creation.""" role: UserPermission! - - """ - The value of the API key. **This is a secret credential!** - """ + """The value of the API key. **This is a secret credential!**""" token: String! } -""" -A union of all containers that can comprise the components of a Studio graph -""" +"""A union of all containers that can comprise the components of a Studio graph""" union GraphImplementors = GraphVariantSubgraphs -""" -A GraphQL document, such as the definition of an operation or schema. -""" +type GraphQLDoc { + graph: Graph! + hash: ID! + source: GraphQLDocument! +} + +"""A GraphQL document, such as the definition of an operation or schema.""" scalar GraphQLDocument -""" -A graph variant -""" +"""A graph variant""" type GraphVariant { - """ - The variant's global identifier in the form `graphID@variant`. - """ + """The variant's global identifier in the form `graphID@variant`.""" id: ID! - + """Router associated with this graph variant""" router: Router - - """ - The filter configuration used to build a contract schema. The configuration consists of lists of tags for schema elements to include or exclude in the resulting schema. - """ + """The variant's name (e.g., `staging`).""" + name: String! + """The filter configuration used to build a contract schema. The configuration consists of lists of tags for schema elements to include or exclude in the resulting schema.""" contractFilterConfig: FilterConfig - """ A human-readable description of the filter configuration of this contract variant, or null if this isn't a contract variant. """ contractFilterConfigDescription: String - - """ - The graph that this variant belongs to. - """ + """The graph that this variant belongs to.""" graph: Graph! - - """ - Latest approved launch for the variant, and what is served through Uplink. - """ + """Latest approved launch for the variant, and what is served through Uplink.""" latestApprovedLaunch: Launch - - """ - Latest launch for the variant, whether successful or not. - """ + """Latest launch for the variant, whether successful or not.""" latestLaunch: Launch - - """ - The variant's name (e.g., `staging`). - """ - name: String! - - """ - Which permissions the current user has for interacting with this variant - """ + """Which permissions the current user has for interacting with this variant""" permissions: GraphVariantPermissions! - readme: Readme! - - """ - The variant this variant is derived from. This property currently only exists on contract variants. - """ + """The variant this variant is derived from. This property currently only exists on contract variants.""" sourceVariant: GraphVariant - - """ - A list of the saved [operation collections](https://www.apollographql.com/docs/studio/explorer/operation-collections/) associated with this variant. - """ + """A list of the saved [operation collections](https://www.apollographql.com/docs/studio/explorer/operation-collections/) associated with this variant.""" operationCollections: [OperationCollection!]! - - """ - The URL of the variant's GraphQL endpoint for query and mutation operations. For subscription operations, use `subscriptionUrl`. - """ + """The Persisted Query List linked to this variant, if any.""" + persistedQueryList: PersistedQueryList + """The URL of the variant's GraphQL endpoint for query and mutation operations. For subscription operations, use `subscriptionUrl`.""" url: String - - """ - The URL of the variant's GraphQL endpoint for subscription operations. - """ + """The URL of the variant's GraphQL endpoint for subscription operations.""" subscriptionUrl: String - - """ - The details of the variant's most recent publication. - """ + """The details of the variant's most recent publication.""" latestPublication: SchemaPublication - - """ - A list of the subgraphs included in this variant. This value is null for non-federated variants. Set `includeDeleted` to `true` to include deleted subgraphs. - """ + """A list of the subgraphs included in this variant. This value is null for non-federated variants. Set `includeDeleted` to `true` to include deleted subgraphs.""" subgraphs(includeDeleted: Boolean! = false): [GraphVariantSubgraph!] - - """ - Returns the details of the subgraph with the provided `name`, or null if this variant doesn't include a subgraph with that name. - """ + """Returns the details of the subgraph with the provided `name`, or null if this variant doesn't include a subgraph with that name.""" subgraph(name: ID!): GraphVariantSubgraph } -""" -Result of looking up a variant by ref -""" -union GraphVariantLookup = GraphVariant|InvalidRefFormat +"""Result of looking up a variant by ref""" +union GraphVariantLookup = GraphVariant | InvalidRefFormat -""" -Modifies a variant of a graph, also called a schema tag in parts of our product. -""" +"""Modifies a variant of a graph, also called a schema tag in parts of our product.""" type GraphVariantMutation { + """Gets the router attached to a graph variant""" + router: RouterMutation """ _Asynchronously_ kicks off operation checks for a proposed non-federated schema change against its associated graph. - + Returns a `CheckRequestSuccess` object with a workflow ID that you can use to check status, or an error object if the checks workflow failed to start. """ submitCheckSchemaAsync(input: CheckSchemaAsyncInput!): CheckRequestResult! - """ _Asynchronously_ kicks off composition and operation checks for a proposed subgraph schema change against its associated supergraph. - + Returns a `CheckRequestSuccess` object with a workflow ID that you can use to check status, or an error object if the checks workflow failed to start. """ submitSubgraphCheckAsync(input: SubgraphCheckAsyncInput!): CheckRequestResult! - - """ - Updates the [README](https://www.apollographql.com/docs/studio/org/graphs/#the-readme-page) of this variant. - """ - updateVariantReadme("The full new text of the README, as a Markdown-formatted string." readme: String!): GraphVariant - - """ - Delete the variant. - """ + """Updates the [README](https://www.apollographql.com/docs/studio/org/graphs/#the-readme-page) of this variant.""" + updateVariantReadme( + """The full new text of the README, as a Markdown-formatted string.""" + readme: String! + ): GraphVariant + """Delete the variant.""" delete: GraphVariantDeletionResult! } -""" -Individual permissions for the current user when interacting with a particular Studio graph variant. -""" +"""Individual permissions for the current user when interacting with a particular Studio graph variant.""" type GraphVariantPermissions { - """ - Whether the currently authenticated user is permitted to manage/update this variant's build configuration (e.g., build pipeline version). - """ + """Whether the currently authenticated user is permitted to manage/update this variant's build configuration (e.g., build pipeline version).""" canManageBuildConfig: Boolean! - - """ - Whether the currently authenticated user is permitted to manage/update cloud routers - """ + """Whether the currently authenticated user is permitted to manage/update cloud routers""" canManageCloudRouter: Boolean! - - """ - Whether the currently authenticated user is permitted to update variant-level settings for the Apollo Studio Explorer. - """ + """Whether the currently authenticated user is permitted to update variant-level settings for the Apollo Studio Explorer.""" canManageExplorerSettings: Boolean! - - """ - Whether the currently authenticated user is permitted to publish schemas to this variant. - """ + """Whether the currently authenticated user is permitted to publish schemas to this variant.""" canPushSchemas: Boolean! - - """ - Whether the currently authenticated user is permitted to view this variant's build configuration details (e.g., build pipeline version). - """ + """Whether the currently authenticated user is permitted to view this variant's build configuration details (e.g., build pipeline version).""" canQueryBuildConfig: Boolean! - - """ - Whether the currently authenticated user is permitted to view details regarding cloud routers - """ + """Whether the currently authenticated user is permitted to view details regarding cloud routers""" canQueryCloudRouter: Boolean! - - """ - Whether the currently authenticated user is permitted to view cloud router logs - """ + """Whether the currently authenticated user is permitted to view cloud router logs""" canQueryCloudRouterLogs: Boolean! - - """ - Whether the currently authenticated user is permitted to download schemas associated to this variant. - """ + """Whether the currently authenticated user is permitted to view launch history""" + canQueryLaunches: Boolean! + """Whether the currently authenticated user is permitted to download schemas associated to this variant.""" canQuerySchemas: Boolean! - - """ - Whether the currently authenticated user is permitted to update the README for this variant. - """ + """Whether the currently authenticated user is permitted to update the README for this variant.""" canUpdateVariantReadme: Boolean! - canCreateCollectionInVariant: Boolean! - canShareCollectionInVariant: Boolean! } input HistoricQueryParameters { from: String = "-86400" - to: String = "0" - - """ - Minimum number of requests within the window for a query to be considered. - """ + """Minimum number of requests within the window for a query to be considered.""" queryCountThreshold: Int = 1 - """ Number of requests within the window for a query to be considered, relative to total request count. Expected values are between 0 and 0.05 (minimum 5% of total request volume) """ queryCountThresholdPercentage: Float = 0 - - """ - A list of operation IDs to filter out during validation. - """ + """A list of operation IDs to filter out during validation.""" ignoredOperations: [ID!] = null - - """ - A list of clients to filter out during validation. - """ + """A list of clients to filter out during validation.""" excludedClients: [ClientInfoFilter!] = null - - """ - A list of operation names to filter out during validation. - """ + """A list of operation names to filter out during validation.""" excludedOperationNames: [OperationNameFilterInput!] = null - """ A list of variants to include in the validation. If no variants are provided then this defaults to the "current" variant along with the base variant. The @@ -1554,607 +911,437 @@ input HistoricQueryParameters { includedVariants: [String!] = null } -""" -Input type to provide when specifying configuration details for schema checks. -""" +"""Input type to provide when specifying configuration details for schema checks.""" input HistoricQueryParametersInput { - """ - Clients to be excluded from check. - """ + """Clients to be excluded from check.""" excludedClients: [ClientInfoFilter!] - - """ - Operations to be ignored in this schema check, specified by operation name. - """ + """Operations to be ignored in this schema check, specified by operation name.""" excludedOperationNames: [OperationNameFilterInput!] - - """ - Start time for operations to be checked against. Specified as either a) an ISO formatted date/time string or b) a negative number of seconds relative to the time the check request was submitted. - """ + """Start time for operations to be checked against. Specified as either a) an ISO formatted date/time string or b) a negative number of seconds relative to the time the check request was submitted.""" from: String - - """ - Operations to be ignored in this schema check, specified by ID. - """ + """Operations to be ignored in this schema check, specified by ID.""" ignoredOperations: [ID!] - - """ - Graph variants to be included in check. - """ + """Graph variants to be included in check.""" includedVariants: [String!] - - """ - Maximum number of queries to be checked against the change. - """ + """Maximum number of queries to be checked against the change.""" queryCountThreshold: Int - - """ - Only fail check if this percentage of operations would be negatively impacted. - """ + """Only fail check if this percentage of operations would be negatively impacted.""" queryCountThresholdPercentage: Float - - """ - End time for operations to be checked against. Specified as either a) an ISO formatted date/time string or b) a negative number of seconds relative to the time the check request was submitted. - """ + """End time for operations to be checked against. Specified as either a) an ISO formatted date/time string or b) a negative number of seconds relative to the time the check request was submitted.""" to: String } -""" -An identity (such as a `User` or `Graph`) in Apollo Studio. See implementing types for details. -""" +"""An identity (such as a `User` or `Graph`) in Apollo Studio. See implementing types for details.""" interface Identity { - """ - Returns a representation of the identity as an `Actor` type. - """ + """Returns a representation of the identity as an `Actor` type.""" asActor: Actor! - - """ - The identity's identifier, which is unique among objects of its type. - """ + """The identity's identifier, which is unique among objects of its type.""" id: ID! - - """ - The identity's human-readable name. - """ + """The identity's human-readable name.""" name: String! } type InternalIdentity implements Identity { accounts: [Organization!]! - asActor: Actor! - email: String - id: ID! - name: String! } input IntrospectionDirectiveInput { name: String! - description: String - locations: [IntrospectionDirectiveLocation!]! - args: [IntrospectionInputValueInput!]! - isRepeatable: Boolean } -""" -__DirectiveLocation introspection type -""" +"""__DirectiveLocation introspection type""" enum IntrospectionDirectiveLocation { - """ - Location adjacent to a query operation. - """ + """Location adjacent to a query operation.""" QUERY - - """ - Location adjacent to a mutation operation. - """ + """Location adjacent to a mutation operation.""" MUTATION - - """ - Location adjacent to a subscription operation. - """ + """Location adjacent to a subscription operation.""" SUBSCRIPTION - - """ - Location adjacent to a field. - """ + """Location adjacent to a field.""" FIELD - - """ - Location adjacent to a fragment definition. - """ + """Location adjacent to a fragment definition.""" FRAGMENT_DEFINITION - - """ - Location adjacent to a fragment spread. - """ + """Location adjacent to a fragment spread.""" FRAGMENT_SPREAD - - """ - Location adjacent to an inline fragment. - """ + """Location adjacent to an inline fragment.""" INLINE_FRAGMENT - - """ - Location adjacent to a variable definition. - """ + """Location adjacent to a variable definition.""" VARIABLE_DEFINITION - - """ - Location adjacent to a schema definition. - """ + """Location adjacent to a schema definition.""" SCHEMA - - """ - Location adjacent to a scalar definition. - """ + """Location adjacent to a scalar definition.""" SCALAR - - """ - Location adjacent to an object type definition. - """ + """Location adjacent to an object type definition.""" OBJECT - - """ - Location adjacent to a field definition. - """ + """Location adjacent to a field definition.""" FIELD_DEFINITION - - """ - Location adjacent to an argument definition. - """ + """Location adjacent to an argument definition.""" ARGUMENT_DEFINITION - - """ - Location adjacent to an interface definition. - """ + """Location adjacent to an interface definition.""" INTERFACE - - """ - Location adjacent to a union definition. - """ + """Location adjacent to a union definition.""" UNION - - """ - Location adjacent to an enum definition. - """ + """Location adjacent to an enum definition.""" ENUM - - """ - Location adjacent to an enum value definition. - """ + """Location adjacent to an enum value definition.""" ENUM_VALUE - - """ - Location adjacent to an input object type definition. - """ + """Location adjacent to an input object type definition.""" INPUT_OBJECT - - """ - Location adjacent to an input object field definition. - """ + """Location adjacent to an input object field definition.""" INPUT_FIELD_DEFINITION } -""" -__EnumValue introspection type -""" +"""__EnumValue introspection type""" input IntrospectionEnumValueInput { name: String! - description: String - isDeprecated: Boolean! - deprecationReason: String } -""" -__Field introspection type -""" +"""__Field introspection type""" input IntrospectionFieldInput { name: String! - description: String - args: [IntrospectionInputValueInput!]! - type: IntrospectionTypeInput! - isDeprecated: Boolean! - deprecationReason: String } -""" -__Value introspection type -""" +"""__Value introspection type""" input IntrospectionInputValueInput { name: String! - description: String - type: IntrospectionTypeInput! - defaultValue: String - isDeprecated: Boolean - deprecationReason: String } -""" -__Schema introspection type -""" +"""__Schema introspection type""" input IntrospectionSchemaInput { types: [IntrospectionTypeInput!] - queryType: IntrospectionTypeRefInput! - mutationType: IntrospectionTypeRefInput - subscriptionType: IntrospectionTypeRefInput - directives: [IntrospectionDirectiveInput!]! - description: String } -""" -__Type introspection type -""" +"""__Type introspection type""" input IntrospectionTypeInput { kind: IntrospectionTypeKind! - name: String - description: String - specifiedByUrl: String - fields: [IntrospectionFieldInput!] - interfaces: [IntrospectionTypeInput!] - possibleTypes: [IntrospectionTypeInput!] - enumValues: [IntrospectionEnumValueInput!] - inputFields: [IntrospectionInputValueInput!] - ofType: IntrospectionTypeInput } enum IntrospectionTypeKind { - """ - Indicates this type is a scalar. - """ + """Indicates this type is a scalar.""" SCALAR - - """ - Indicates this type is an object. 'fields' and 'interfaces' are valid fields. - """ + """Indicates this type is an object. 'fields' and 'interfaces' are valid fields.""" OBJECT - """ Indicates this type is an interface. 'fields' and 'possibleTypes' are valid fields """ INTERFACE - - """ - Indicates this type is a union. 'possibleTypes' is a valid field. - """ + """Indicates this type is a union. 'possibleTypes' is a valid field.""" UNION - - """ - Indicates this type is an enum. 'enumValues' is a valid field. - """ + """Indicates this type is an enum. 'enumValues' is a valid field.""" ENUM - - """ - Indicates this type is an input object. 'inputFields' is a valid field. - """ + """Indicates this type is an input object. 'inputFields' is a valid field.""" INPUT_OBJECT - - """ - Indicates this type is a list. 'ofType' is a valid field. - """ + """Indicates this type is a list. 'ofType' is a valid field.""" LIST - - """ - Indicates this type is a non-null. 'ofType' is a valid field. - """ + """Indicates this type is a non-null. 'ofType' is a valid field.""" NON_NULL } -""" -Shallow __Type introspection type -""" +"""Shallow __Type introspection type""" input IntrospectionTypeRefInput { name: String! - kind: String } -""" -An error caused by providing invalid input for a task, such as schema checks. -""" +"""An error caused by providing invalid input for a task, such as schema checks.""" type InvalidInputError { - """ - The error message. - """ + """The error message.""" message: String! } -""" -This object is returned when a request to fetch a Studio graph variant provides an invalid graph ref. -""" +"""This object is returned when a request to fetch a Studio graph variant provides an invalid graph ref.""" type InvalidRefFormat implements Error { message: String! } -""" -Represents the complete process of making a set of updates to a deployed graph variant. -""" +"""Represents the complete process of making a set of updates to a deployed graph variant.""" type Launch { - """ - The unique identifier for this launch. - """ + """The unique identifier for this launch.""" id: ID! - - """ - The ID of the launch's associated graph. - """ + """The ID of the launch's associated graph.""" graphId: String! - - """ - The name of the launch's associated variant. - """ + """The name of the launch's associated variant.""" graphVariant: String! - + """Cloud Router order for this launch ID""" order: OrderOrError! - - """ - The timestamp when the launch was approved. - """ + """The timestamp when the launch was approved.""" approvedAt: Timestamp - - """ - The associated build for this launch (a build includes schema composition and contract filtering). This value is null until the build is initiated. - """ + """The associated build for this launch (a build includes schema composition and contract filtering). This value is null until the build is initiated.""" build: Build - - """ - The inputs provided to this launch's associated build, including subgraph schemas and contract filters. - """ + """The inputs provided to this launch's associated build, including subgraph schemas and contract filters.""" buildInput: BuildInput! - - """ - The timestamp when the launch completed. This value is null until the launch completes. - """ + """The timestamp when the launch completed. This value is null until the launch completes.""" completedAt: Timestamp - - """ - The timestamp when the launch was initiated. - """ + """The timestamp when the launch was initiated.""" createdAt: Timestamp! - - """ - Contract launches that were triggered by this launch. - """ + """Contract launches that were triggered by this launch.""" downstreamLaunches: [Launch!]! - - """ - Whether the launch completed. - """ + """Whether the launch completed.""" isCompleted: Boolean - - """ - Whether the result of the launch has been published to the associated graph and variant. This is always false for a failed launch. - """ + """Whether the result of the launch has been published to the associated graph and variant. This is always false for a failed launch.""" isPublished: Boolean - - """ - The most recent launch sequence step that has started but not necessarily completed. - """ + """The most recent launch sequence step that has started but not necessarily completed.""" latestSequenceStep: LaunchSequenceStep - - """ - A specific publication of a graph variant pertaining to this launch. - """ + """A specific publication of a graph variant pertaining to this launch.""" publication: SchemaPublication - - """ - A list of results from the completed launch. The items included in this list vary depending on whether the launch succeeded, failed, or was superseded. - """ + """A list of results from the completed launch. The items included in this list vary depending on whether the launch succeeded, failed, or was superseded.""" results: [LaunchResult!]! - - """ - Cloud router configuration associated with this build event. It will be non-null for any cloud-router variant, and null for any not cloudy variant/graph. - """ + """Cloud router configuration associated with this build event. It will be non-null for any cloud-router variant, and null for any not cloudy variant/graph.""" routerConfig: String - - """ - A list of all serial steps in the launch sequence. This list can change as the launch progresses. For example, a `LaunchCompletedStep` is appended after a launch completes. - """ + """A list of all serial steps in the launch sequence. This list can change as the launch progresses. For example, a `LaunchCompletedStep` is appended after a launch completes.""" sequence: [LaunchSequenceStep!]! - - """ - A shortened version of `Launch.id` that includes only the first 8 characters. - """ + """A shortened version of `Launch.id` that includes only the first 8 characters.""" shortenedID: String! - - """ - The launch's status. If a launch is superseded, its status remains `LAUNCH_INITIATED`. To check for a superseded launch, use `supersededAt`. - """ + """The launch's status. If a launch is superseded, its status remains `LAUNCH_INITIATED`. To check for a superseded launch, use `supersededAt`.""" status: LaunchStatus! - - """ - A list of subgraph changes that are included in this launch. - """ + """A list of subgraph changes that are included in this launch.""" subgraphChanges: [SubgraphChange!] - - """ - The timestamp when this launch was superseded by another launch. If an active launch is superseded, it terminates. - """ + """The timestamp when this launch was superseded by another launch. If an active launch is superseded, it terminates.""" supersededAt: Timestamp - - """ - The launch that superseded this launch, if any. If an active launch is superseded, it terminates. - """ + """The launch that superseded this launch, if any. If an active launch is superseded, it terminates.""" supersededBy: Launch - - """ - The source variant launch that caused this launch to be initiated. This value is present only for contract variant launches. Otherwise, it's null. - """ + """The source variant launch that caused this launch to be initiated. This value is present only for contract variant launches. Otherwise, it's null.""" upstreamLaunch: Launch } -""" -Types of results that can be associated with a `Launch` -""" +"""Types of results that can be associated with a `Launch`""" union LaunchResult = ChangelogLaunchResult -""" -The timing details for the build step of a launch. -""" +"""The timing details for the build step of a launch.""" type LaunchSequenceBuildStep { - """ - The timestamp when the step completed. - """ - completedAt: Timestamp - - """ - The timestamp when the step started. - """ - startedAt: Timestamp -} - -""" -The timing details for the checks step of a launch. -""" -type LaunchSequenceCheckStep { - """ - The timestamp when the step completed. - """ + """The timestamp when the step completed.""" completedAt: Timestamp - - """ - The timestamp when the step started. - """ + """The timestamp when the step started.""" startedAt: Timestamp } -""" -The timing details for the completion step of a launch. -""" +"""The timing details for the completion step of a launch.""" type LaunchSequenceCompletedStep { - """ - The timestamp when the step (and therefore the launch) completed. - """ + """The timestamp when the step (and therefore the launch) completed.""" completedAt: Timestamp } -""" -The timing details for the initiation step of a launch. -""" +"""The timing details for the initiation step of a launch.""" type LaunchSequenceInitiatedStep { - """ - The timestamp when the step (and therefore the launch) started. - """ + """The timestamp when the step (and therefore the launch) started.""" startedAt: Timestamp } -""" -The timing details for the publish step of a launch. -""" +"""The timing details for the publish step of a launch.""" type LaunchSequencePublishStep { - """ - The timestamp when the step completed. - """ + """The timestamp when the step completed.""" completedAt: Timestamp - - """ - The timestamp when the step started. - """ + """The timestamp when the step started.""" startedAt: Timestamp } -""" -Represents the various steps that occur in sequence during a single launch. -""" -union LaunchSequenceStep = LaunchSequenceBuildStep|LaunchSequenceCheckStep|LaunchSequenceCompletedStep|LaunchSequenceInitiatedStep|LaunchSequencePublishStep|LaunchSequenceSupersededStep +"""Represents the various steps that occur in sequence during a single launch.""" +union LaunchSequenceStep = LaunchSequenceBuildStep | LaunchSequenceCompletedStep | LaunchSequenceInitiatedStep | LaunchSequencePublishStep | LaunchSequenceSupersededStep -""" -The timing details for the superseded step of a launch. This step occurs only if the launch is superseded by another launch. -""" +"""The timing details for the superseded step of a launch. This step occurs only if the launch is superseded by another launch.""" type LaunchSequenceSupersededStep { - """ - The timestamp when the step completed, thereby ending the execution of this launch in favor of the superseding launch. - """ + """The timestamp when the step completed, thereby ending the execution of this launch in favor of the superseding launch.""" completedAt: Timestamp } enum LaunchStatus { LAUNCH_COMPLETED - LAUNCH_FAILED - LAUNCH_INITIATED } -enum LogLevel { - WARN +type LintCheckTask implements CheckWorkflowTask { + completedAt: Timestamp + createdAt: Timestamp! + graphID: ID! + id: ID! + status: CheckWorkflowTaskStatus! + targetURL: String + workflow: CheckWorkflow! + result: LintResult +} - INFO +"""A single rule violation.""" +type LintDiagnostic { + """The schema coordinate of this diagnostic.""" + coordinate: String! + """The graph's configured level for the rule.""" + level: LintDiagnosticLevel! + """The message describing the rule violation.""" + message: String! + """The lint rule being violated.""" + rule: LintRule! + """The human readable position in the file of the rule violation.""" + sourceLocations: [Location!]! +} +"""The severity level of an lint result.""" +enum LintDiagnosticLevel { ERROR - + IGNORED + WARNING +} + +"""The result of linting a schema.""" +type LintResult { + """The set of lint rule violations found in the schema.""" + diagnostics: [LintDiagnostic!]! + """Stats generated from the resulting diagnostics.""" + stats: LintStats! +} + +enum LintRule { + ALL_ELEMENTS_REQUIRE_DESCRIPTION + CONTACT_DIRECTIVE_MISSING + DEPRECATED_DIRECTIVE_MISSING_REASON + DIRECTIVE_COMPOSITION + DIRECTIVE_NAMES_SHOULD_BE_CAMEL_CASE + DOES_NOT_PARSE + ENUM_PREFIX + ENUM_SUFFIX + ENUM_USED_AS_INPUT_WITHOUT_SUFFIX + ENUM_USED_AS_OUTPUT_DESPITE_SUFFIX + ENUM_VALUES_SHOULD_BE_SCREAMING_SNAKE_CASE + FIELD_NAMES_SHOULD_BE_CAMEL_CASE + FROM_SUBGRAPH_DOES_NOT_EXIST + INCONSISTENT_ARGUMENT_PRESENCE + INCONSISTENT_BUT_COMPATIBLE_ARGUMENT_TYPE + INCONSISTENT_BUT_COMPATIBLE_FIELD_TYPE + INCONSISTENT_DEFAULT_VALUE_PRESENCE + INCONSISTENT_DESCRIPTION + INCONSISTENT_ENTITY + INCONSISTENT_ENUM_VALUE_FOR_INPUT_ENUM + INCONSISTENT_ENUM_VALUE_FOR_OUTPUT_ENUM + INCONSISTENT_EXECUTABLE_DIRECTIVE_LOCATIONS + INCONSISTENT_EXECUTABLE_DIRECTIVE_PRESENCE + INCONSISTENT_EXECUTABLE_DIRECTIVE_REPEATABLE + INCONSISTENT_INPUT_OBJECT_FIELD + INCONSISTENT_INTERFACE_VALUE_TYPE_FIELD + INCONSISTENT_NON_REPEATABLE_DIRECTIVE_ARGUMENTS + INCONSISTENT_OBJECT_VALUE_TYPE_FIELD + INCONSISTENT_RUNTIME_TYPES_FOR_SHAREABLE_RETURN + INCONSISTENT_TYPE_SYSTEM_DIRECTIVE_LOCATIONS + INCONSISTENT_TYPE_SYSTEM_DIRECTIVE_REPEATABLE + INCONSISTENT_UNION_MEMBER + INPUT_ARGUMENT_NAMES_SHOULD_BE_CAMEL_CASE + INPUT_TYPE_SUFFIX + INTERFACE_PREFIX + INTERFACE_SUFFIX + MERGED_NON_REPEATABLE_DIRECTIVE_ARGUMENTS + NO_EXECUTABLE_DIRECTIVE_INTERSECTION + OBJECT_PREFIX + OBJECT_SUFFIX + OVERRIDDEN_FIELD_CAN_BE_REMOVED + OVERRIDE_DIRECTIVE_CAN_BE_REMOVED + QUERY_DOCUMENT_DECLARATION + RESTY_FIELD_NAMES + TAG_DIRECTIVE_USES_UNKNOWN_NAME + TYPE_NAMES_SHOULD_BE_PASCAL_CASE + TYPE_PREFIX + TYPE_SUFFIX + UNUSED_ENUM_TYPE +} + +"""Stats generated from linting a schema against the graph's linter configuration.""" +type LintStats { + """Total number of lint errors.""" + errorsCount: Int! + """Total number of lint rules ignored.""" + ignoredCount: Int! + """Total number of lint rules violated.""" + totalCount: Int! + """Total number of lint warnings.""" + warningsCount: Int! +} + +type Location { + end: Coordinate + start: Coordinate + subgraphName: String +} + +"""Level of the log entry""" +enum LogLevel { + """Debug log entry""" DEBUG + """Informational log entry""" + INFO + """Warning log entry""" + WARN + """Error log entry""" + ERROR } +"""Order log message""" type LogMessage { - """ - Timestamp in UTC - """ + """Timestamp in UTC""" timestamp: DateTime! - - """ - Log message contents - """ + """Log message contents""" message: String! - - """ - Log level - """ + """Log level""" level: LogLevel! } +"""GraphQL mutations""" type Mutation { - """ - Provides access to mutation fields for modifying a Studio graph with the provided ID. - """ + """Provides access to mutation fields for modifying a Studio graph with the provided ID.""" graph(id: ID!): GraphMutation - """ Provides access to mutation fields for modifying an Apollo user with the provided ID. """ user(id: ID!): UserMutation - - """ - Creates an [operation collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/) for a given variant, or creates a [sandbox collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/#sandbox-collections) without an associated variant. - """ - createOperationCollection("The collection's description." description: String, "Whether the collection is a [sandbox collection](https:\/\/www.apollographql.com\/docs\/studio\/explorer\/operation-collections\/#sandbox-collections)." isSandbox: Boolean!, "Whether the collection is shared across its associated organization." isShared: Boolean!, "The minimum role a user needs to edit this collection. Valid values: null, CONSUMER, OBSERVER, DOCUMENTER, CONTRIBUTOR, GRAPH_ADMIN. This value is ignored if `isShared` is `false`. The default value is `GRAPH_ADMIN`." minEditRole: UserPermission, "The collection's name." name: String!, "The [graph ref](https:\/\/www.apollographql.com\/docs\/rover\/conventions\/#graph-refs) of the graph variants to associate the collection with." variantRefs: [ID!]): CreateOperationCollectionResult! - + """Creates an [operation collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/) for a given variant, or creates a [sandbox collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/#sandbox-collections) without an associated variant.""" + createOperationCollection( + """The collection's description.""" + description: String + """Whether the collection is a [sandbox collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/#sandbox-collections).""" + isSandbox: Boolean! + """Whether the collection is shared across its associated organization.""" + isShared: Boolean! + """The minimum role a user needs to edit this collection. Valid values: null, CONSUMER, OBSERVER, DOCUMENTER, CONTRIBUTOR, GRAPH_ADMIN. This value is ignored if `isShared` is `false`. The default value is `GRAPH_ADMIN`.""" + minEditRole: UserPermission + """The collection's name.""" + name: String! + """The [graph ref](https://www.apollographql.com/docs/rover/conventions/#graph-refs) of the graph variants to associate the collection with.""" + variantRefs: [ID!] + ): CreateOperationCollectionResult! operationCollection(id: ID!): OperationCollectionMutation } @@ -2169,7 +1356,6 @@ scalar NaiveDateTime type NamedIntrospectionArg { name: String - description: String } @@ -2184,9 +1370,7 @@ https://github.com/DefinitelyTyped/DefinitelyTyped/blob/659eb50d3/types/graphql/ """ type NamedIntrospectionType { kind: IntrospectionTypeKind - name: String - description: String } @@ -2198,360 +1382,180 @@ returned. """ type NamedIntrospectionValue { name: String - description: String - printedType: String } -""" -An error that occurs when a requested object is not found. -""" +"""An error that occurs when a requested object is not found.""" type NotFoundError implements Error { - """ - The error message. - """ + """The error message.""" message: String! } -""" -A list of saved GraphQL operations. -""" +"""A list of saved GraphQL operations.""" type OperationCollection { - """ - The timestamp when the collection was created. - """ + """The timestamp when the collection was created.""" createdAt: Timestamp! - - """ - The user or other entity that created the collection. - """ + """The user or other entity that created the collection.""" createdBy: Identity - - """ - The collection's description. A `null` description was never set, and empty string description was set to be empty string by a user, or other entity. - """ + """The collection's description. A `null` description was never set, and empty string description was set to be empty string by a user, or other entity.""" description: String - id: ID! - - """ - Whether the current user has marked the collection as a favorite. - """ + """Whether the current user has marked the collection as a favorite.""" isFavorite: Boolean! - - """ - Whether the collection is a [sandbox collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/#sandbox-collections). - """ + """Whether the collection is a [sandbox collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/#sandbox-collections).""" isSandbox: Boolean! - - """ - Whether the collection is shared across its associated organization. - """ + """Whether the collection is shared across its associated organization.""" isShared: Boolean! - - """ - The timestamp when the collection was most recently updated. - """ + """The timestamp when the collection was most recently updated.""" lastUpdatedAt: Timestamp! - - """ - The user or other entity that most recently updated the collection. - """ + """The user or other entity that most recently updated the collection.""" lastUpdatedBy: Identity - - """ - The minimum role a user needs to edit this collection. Valid values: null, CONSUMER, OBSERVER, DOCUMENTER, CONTRIBUTOR, GRAPH_ADMIN. This value is always `null` if `isShared` is `false`. If `null` when `isShared` is `true`, the minimum role is `GRAPH_ADMIN`. - """ + """The minimum role a user needs to edit this collection. Valid values: null, CONSUMER, OBSERVER, DOCUMENTER, CONTRIBUTOR, GRAPH_ADMIN. This value is always `null` if `isShared` is `false`. If `null` when `isShared` is `true`, the minimum role is `GRAPH_ADMIN`.""" minEditRole: UserPermission - - """ - The collection's name. - """ + """The collection's name.""" name: String! - - """ - Returns the operation in the collection with the specified ID, if any. - """ + """Returns the operation in the collection with the specified ID, if any.""" operation(id: ID!): OperationCollectionEntryResult - - """ - A list of the GraphQL operations that belong to the collection. - """ + """A list of the GraphQL operations that belong to the collection.""" operations: [OperationCollectionEntry!]! - - """ - The permissions that the current user has for the collection. - """ + """The permissions that the current user has for the collection.""" permissions: OperationCollectionPermissions! } -""" -A saved operation entry within an Operation Collection. -""" +"""A saved operation entry within an Operation Collection.""" type OperationCollectionEntry { - """ - The timestamp when the entry was created. - """ + """The timestamp when the entry was created.""" createdAt: Timestamp! - - """ - The user or other entity that created the entry. - """ + """The user or other entity that created the entry.""" createdBy: Identity - - """ - Details of the entry's associated operation, such as its `body` and `variables`. - """ + """Details of the entry's associated operation, such as its `body` and `variables`.""" currentOperationRevision: OperationCollectionEntryState! - id: ID! - - """ - The timestamp when the entry was most recently updated. - """ + """The timestamp when the entry was most recently updated.""" lastUpdatedAt: Timestamp! - - """ - The user or other entity that most recently updated the entry. - """ + """The user or other entity that most recently updated the entry.""" lastUpdatedBy: Identity - - """ - The entry's name. - """ + """The entry's name.""" name: String! - - """ - The entry's lexicographical ordering index within its containing collection. - """ + """The entry's lexicographical ordering index within its containing collection.""" orderingIndex: String! } -""" -Provides fields for modifying an operation in a collection. -""" +"""Provides fields for modifying an operation in a collection.""" type OperationCollectionEntryMutation { - """ - Updates the name of an operation. - """ + """Updates the name of an operation.""" updateName(name: String!): UpdateOperationCollectionEntryResult - - """ - Updates the body, headers, and/or variables of an operation. - """ + """Updates the body, headers, and/or variables of an operation.""" updateValues(operationInput: OperationCollectionEntryStateInput!): UpdateOperationCollectionEntryResult } -union OperationCollectionEntryMutationResult = NotFoundError|OperationCollectionEntryMutation|PermissionError +union OperationCollectionEntryMutationResult = NotFoundError | OperationCollectionEntryMutation | PermissionError -""" -Possible return values when querying for an entry in an operation collection (either the entry object or an `Error` object). -""" -union OperationCollectionEntryResult = NotFoundError|OperationCollectionEntry +"""Possible return values when querying for an entry in an operation collection (either the entry object or an `Error` object).""" +union OperationCollectionEntryResult = NotFoundError | OperationCollectionEntry -""" -The most recent body, variable and header values of a saved operation entry. -""" +"""The most recent body, variable and header values of a saved operation entry.""" type OperationCollectionEntryState { - """ - The raw body of the entry's GraphQL operation. - """ + """The raw body of the entry's GraphQL operation.""" body: String! - - """ - Headers for the entry's GraphQL operation. - """ + """Headers for the entry's GraphQL operation.""" headers: [OperationHeader!] - - """ - Variables for the entry's GraphQL operation, as a JSON string. - """ + """Variables for the entry's GraphQL operation, as a JSON string.""" variables: String } -""" -Fields for creating or modifying an operation collection entry. -""" +"""Fields for creating or modifying an operation collection entry.""" input OperationCollectionEntryStateInput { - """ - The operation's query body. - """ + """The operation's query body.""" body: String! - - """ - The operation's headers. - """ + """The operation's headers.""" headers: [OperationHeaderInput!] - - """ - The operation's variables. - """ + """The operation's variables.""" variables: String } -""" -Provides fields for modifying an [operation collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/). -""" +"""Provides fields for modifying an [operation collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/).""" type OperationCollectionMutation { - """ - Adds an operation to this collection. - """ + """Adds an operation to this collection.""" addOperation(name: String!, operationInput: OperationCollectionEntryStateInput!): AddOperationCollectionEntryResult - - """ - Adds operations to this collection. - """ + """Adds operations to this collection.""" addOperations(operations: [AddOperationInput!]!): AddOperationCollectionEntriesResult - - """ - Deletes this operation collection. This also deletes all of the collection's associated operations. - """ + """Deletes this operation collection. This also deletes all of the collection's associated operations.""" delete: DeleteOperationCollectionResult - - """ - Deletes an operation from this collection. - """ + """Deletes an operation from this collection.""" deleteOperation(id: ID!): RemoveOperationCollectionEntryResult - operation(id: ID!): OperationCollectionEntryMutationResult - - """ - Updates the minimum role a user needs to be able to modify this collection. - """ + """Updates the minimum role a user needs to be able to modify this collection.""" setMinEditRole(editRole: UserPermission): UpdateOperationCollectionResult - - """ - Updates this collection's description. - """ + """Updates this collection's description.""" updateDescription(description: String): UpdateOperationCollectionResult - - """ - Updates whether the current user has marked this collection as a favorite. - """ + """Updates whether the current user has marked this collection as a favorite.""" updateIsFavorite(isFavorite: Boolean!): UpdateOperationCollectionResult - - """ - Updates whether this collection is shared across its associated organization. - """ + """Updates whether this collection is shared across its associated organization.""" updateIsShared(isShared: Boolean!): UpdateOperationCollectionResult - - """ - Updates this operation collection's name. - """ + """Updates this operation collection's name.""" updateName(name: String!): UpdateOperationCollectionResult } -""" -Whether the current user can perform various actions on the associated collection. -""" +"""Whether the current user can perform various actions on the associated collection.""" type OperationCollectionPermissions { - """ - Whether the current user can edit operations in the associated collection. - """ + """Whether the current user can edit operations in the associated collection.""" canEditOperations: Boolean! - - """ - Whether the current user can delete or update the associated collection's metadata, such as its name and description. - """ + """Whether the current user can delete or update the associated collection's metadata, such as its name and description.""" canManage: Boolean! - - """ - Whether the current user can read operations in the associated collection. - """ + """Whether the current user can read operations in the associated collection.""" canReadOperations: Boolean! } -union OperationCollectionResult = NotFoundError|OperationCollection|PermissionError|ValidationError +union OperationCollectionResult = NotFoundError | OperationCollection | PermissionError | ValidationError -""" -Saved headers on a saved operation. -""" +"""Saved headers on a saved operation.""" type OperationHeader { - """ - The header's name. - """ + """The header's name.""" name: String! - - """ - The header's value. - """ + """The header's value.""" value: String! } input OperationHeaderInput { - """ - The header's name. - """ + """The header's name.""" name: String! - - """ - The header's value. - """ + """The header's value.""" value: String! } -""" -Options to filter by operation name. -""" +"""Options to filter by operation name.""" input OperationNameFilterInput { - """ - name of the operation set by the user and reported alongside metrics - """ + """name of the operation set by the user and reported alongside metrics""" name: String! - version: String } type OperationsCheckResult { id: ID! - - """ - Indication of the success of the change, either failure, warning, or notice. - """ + """Indication of the success of the change, either failure, warning, or notice.""" checkSeverity: ChangeSeverity! - - """ - Number of operations that were validated during schema diff - """ + """Number of operations that were validated during schema diff""" numberOfCheckedOperations: Int! - - """ - List of schema changes with associated affected clients and operations - """ + """List of schema changes with associated affected clients and operations""" changes: [Change!]! - - """ - Summary/counts for all changes in diff - """ + """Summary/counts for all changes in diff""" changeSummary: ChangeSummary! - - """ - Operations affected by all changes in diff - """ + """Operations affected by all changes in diff""" affectedQueries: [AffectedQuery!] - - """ - Number of affected query operations that are neither marked as SAFE or IGNORED - """ + """Number of affected query operations that are neither marked as SAFE or IGNORED""" numberOfAffectedOperations: Int! - createdAt: Timestamp! } type OperationsCheckTask implements CheckWorkflowTask { completedAt: Timestamp - createdAt: Timestamp! - id: ID! - status: CheckWorkflowTaskStatus! - targetURL: String - workflow: CheckWorkflow! - """ The result of the operations check. This will be null when the task is initializing or running, or when the build task fails (which is a prerequisite task to this one). @@ -2559,49 +1563,66 @@ type OperationsCheckTask implements CheckWorkflowTask { result: OperationsCheckResult } +enum OperationType { + MUTATION + QUERY + SUBSCRIPTION +} + +"""Cloud Router order""" type Order { + """Order identifier""" id: ID! - + """Order type""" orderType: OrderType! - + """Order status""" status: OrderStatus! - + """Reason for ERRORED or ROLLING_BACK orders""" reason: String - - logs(first: Int, offset: Int): [LogMessage!]! - + logs: [LogMessage!]! + """Router associated with this Order""" router: Router! } +"""Return an Order or an error""" union OrderOrError = Order +"""Represents the different status for an order""" enum OrderStatus { + """New Order in progress""" PENDING - + """Order was successfully completed""" COMPLETED - + """ + Order is currently rolling back + + All resources created as part of this Order are being deleted + """ ROLLING_BACK - + """Order was unsuccessful""" ERRORED - + """ + Order has been superseded by another, more recent order + + This can happen if two update orders arrive in close succession and we already + started to process the newer order first. + """ SUPERSEDED } +"""Represents the different types of order""" enum OrderType { + """Create a new Cloud Router""" CREATE_ROUTER - + """Destroy an existing Cloud Router""" DESTROY_ROUTER - + """Update an existing Cloud Router""" UPDATE_ROUTER } -""" -The schema for a single published subgraph in Studio. -""" +"""The schema for a single published subgraph in Studio.""" type SubgraphSchema { - """ - The subgraph schema document as SDL. - """ + """The subgraph schema document as SDL.""" sdl: String! } @@ -2617,334 +1638,311 @@ hash doesn't match our hash of the sdl contents. If the sdl field is specified, the hash does not need to be and will be computed server-side. """ input PartialSchemaInput { - """ - Contents of the partial schema in SDL syntax, but may reference types - that aren't defined in this document - """ - sdl: String - """ Hash of the partial schema to associate; error is thrown if only the hash is specified and the hash has not been seen before """ hash: String + """ + Contents of the partial schema in SDL syntax, but may reference types + that aren't defined in this document + """ + sdl: String } -""" -An error that occurs when the current user doesn't have sufficient permissions to perform an action. -""" +"""An error that's returned when the current user doesn't have sufficient permissions to perform an action.""" type PermissionError implements Error { - """ - The error message. - """ + """The error message.""" message: String! } -""" -An error related to an organization's Apollo Studio plan. -""" +"""Information about the act of publishing operations to the list""" +type PersistedQueriesPublish { + operationCounts: PersistedQueriesPublishOperationCounts! +} + +type PersistedQueriesPublishOperationCounts { + """The number of new operations added to the list by this publish.""" + added: Int! + """The number of operations included in this publish whose metadata and body were unchanged from the previous list revision.""" + identical: Int! + """The number of operations removed from the list by this publish.""" + removed: Int! + """The number of operations in this list that were not mentioned by this publish.""" + unaffected: Int! + """The number of operations whose metadata or body were changed by this publish.""" + updated: Int! +} + +"""Operations to be published to the Persisted Query List.""" +input PersistedQueryInput { + """The GraphQL document for this operation, including all necessary fragment definitions.""" + body: GraphQLDocument! + """An opaque identifier for this operation. This should map uniquely to an operation body; editing the body should generally result in a new ID. Apollo's tools generally use the lowercase hex SHA256 of the operation body.""" + id: ID! + """A name for the operation. Typically this is the name of the actual GraphQL operation in the body. This does not need to be unique within a Persisted Query List; as a client project evolves and its operations change, multiple operations with the same name (but different body and id) can be published.""" + name: String! + """The operation's type.""" + type: OperationType! +} + +"""TODO""" +type PersistedQueryList { + """The immutable ID for this Persisted Query List.""" + id: ID! + """All variants linked to this Persisted Query List, if any.""" + linkedVariants: [GraphVariant!]! + """The list's name; can be changed and does not need to be unique.""" + name: String! +} + +"""Information about a particular revision of the list, as produced by a particular publish.""" +type PersistedQueryListBuild { + """The persisted query list that this build built.""" + list: PersistedQueryList! + """Information about the publish operation that created this build.""" + publish: PersistedQueriesPublish! + """The revision of this Persisted Query List. Revision 0 is the initial empty list; each publish increments the revision by 1.""" + revision: Int! + """The total number of operations in the list after this build. Compare to PersistedQueriesPublish.operationCounts.""" + totalOperationsInList: Int! +} + +type PersistedQueryListMutation { + """Updates this Persisted Query List by publishing a set of operations and removing other operations. Operations not mentioned remain in the list unchanged.""" + publishOperations(allowOverwrittenOperations: Boolean, operations: [PersistedQueryInput!], removeOperations: [ID!]): PublishOperationsResultOrError! +} + +"""An error related to an organization's Apollo Studio plan.""" type PlanError { - """ - The error message. - """ + """The error message.""" message: String! } -type Query { - """ - Returns the root URL of the Apollo Studio frontend. - """ - frontendUrlRoot: String! +"""The result of a successful call to PersistedQueryListMutation.publishOperations.""" +type PublishOperationsResult { + """The build created by this publish operation.""" + build: PersistedQueryListBuild! + """Returns `true` if no changes were made by this publish (and no new revision was created). Otherwise, returns `false`.""" + unchanged: Boolean! +} - """ - Returns details of the graph with the provided ID. - """ - graph(id: ID!): Graph +"""The interface returned by PersistedQueryListMutation.publishOperations.""" +union PublishOperationsResultOrError = CannotModifyOperationBodyError | PermissionError | PublishOperationsResult - """ - Returns details of the authenticated `User` or `Graph` executing this query. If this is an unauthenticated query (i.e., no API key is provided), this field returns null. - """ - me: Identity +input PublishSubgraphsSubgraphInput { + activePartialSchema: PartialSchemaInput! + name: String! + url: String +} - """ - Returns details of the Studio organization with the provided ID. - """ +"""Queries defined by this subgraph""" +type Query { + """Returns details of the Studio organization with the provided ID.""" organization(id: ID!): Organization - - """ - Returns details of the Apollo user with the provided ID. - """ + """Returns the root URL of the Apollo Studio frontend.""" + frontendUrlRoot: String! + """Returns details of the graph with the provided ID.""" + graph(id: ID!): Graph + """Returns details of the authenticated `User` or `Graph` executing this query. If this is an unauthenticated query (i.e., no API key is provided), this field returns null.""" + me: Identity + """Returns details of the Apollo user with the provided ID.""" user(id: ID!): User - - """ - Returns details of a Studio graph variant with the provided graph ref. A graph ref has the format `graphID@variantName` (or just `graphID` for the default variant `current`). Returns null if the graph or variant doesn't exist, or if the graph isn't accessible by the current actor. - """ + """Returns details of a Studio graph variant with the provided graph ref. A graph ref has the format `graphID@variantName` (or just `graphID` for the default variant `current`). Returns null if the graph or variant doesn't exist, or if the graph isn't accessible by the current actor.""" variant(ref: ID!): GraphVariantLookup - - """ - Returns the [operation collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/) for the provided ID. - """ + """Returns the [operation collection](https://www.apollographql.com/docs/studio/explorer/operation-collections/) for the provided ID.""" operationCollection(id: ID!): OperationCollectionResult! } -""" -The README documentation for a graph variant, which is displayed in Studio. -""" +"""The README documentation for a graph variant, which is displayed in Studio.""" type Readme { - """ - The contents of the README in plaintext. - """ + """The contents of the README in plaintext.""" content: String! - - """ - The README's unique ID. `a15177c0-b003-4837-952a-dbfe76062eb1` for the default README - """ + """The README's unique ID. `a15177c0-b003-4837-952a-dbfe76062eb1` for the default README""" id: ID! - - """ - The actor that most recently updated the README (usually a `User`). `null` for the default README, or if the `User` was deleted. - """ + """The actor that most recently updated the README (usually a `User`). `null` for the default README, or if the `User` was deleted.""" lastUpdatedBy: Identity - - """ - The timestamp when the README was most recently updated. `null` for the default README - """ + """The timestamp when the README was most recently updated. `null` for the default README""" lastUpdatedTime: Timestamp } -union RemoveOperationCollectionEntryResult = OperationCollection|PermissionError +union RemoveOperationCollectionEntryResult = OperationCollection | PermissionError type Router { """ Last time when the Cloud Router was updated - + If the Cloud Router was never updated, this value will be null """ updatedAt: NaiveDateTime - - """ - Current status of the Cloud Router - """ + """Current status of the Cloud Router""" status: RouterStatus! - - """ - Current version of the Cloud Router - """ + """Current version of the Cloud Router""" routerVersion: RouterVersion! - """ URL where the Cloud Router can be found - + This will be null if the Cloud Router is in a deleted status """ routerUrl: String - - """ - Retrieves a specific Order related to this Cloud Router - """ + """Retrieves a specific Order related to this Cloud Router""" order(orderId: ID!): Order - - """ - Retrieves all Orders related to this Cloud Router - """ + """Retrieves all Orders related to this Cloud Router""" orders(first: Int, offset: Int): [Order!]! - - """ - Return the list of secrets for this Cloud Router with their hash values - """ + """Return the list of secrets for this Cloud Router with their hash values""" secrets: [Secret!]! } type RouterMutation { + """Set secrets for this Cloud Router""" setSecrets(input: RouterSecretsInput!): RouterSecretsResult! } -""" -User input for a RouterSecrets mutation -""" +"""User input for a RouterSecrets mutation""" input RouterSecretsInput { + """Secrets to create or update""" secrets: [SecretInput!] - + """Secrets to remove""" unsetSecrets: [String!] } -""" -Represents the possible outcomes of a RouterSecrets mutation -""" +"""Represents the possible outcomes of a RouterSecrets mutation""" union RouterSecretsResult = RouterSecretsSuccess -""" -Success branch of a RouterSecrets mutation. -""" +"""Success branch of a RouterSecrets mutation.""" type RouterSecretsSuccess { secrets: [Secret!]! } -""" -Current status of Cloud Routers -""" +"""Current status of Cloud Routers""" enum RouterStatus { + """Cloud Router is not yet provisioned""" CREATING - + """Cloud Router is running, but currently being updated""" UPDATING - + """ + Cloud Router is running, but currently being deleted + + This is the only mutation state that doesn't support rollback. If we fail to + delete a Router, the workflows are configured to stop and keep the router into + the Deleting status. + """ DELETING - + """ + Current order is rolling back to the last known good state + + After a RollingBack state, a Router can move either into Running state (from a + Update order) or Deleted (from a Create order). + + If we fail to roll back, the workflows are configured to stop and keep the router + into the RollingBack status. + """ ROLLING_BACK - + """Current router is running and able to server requests""" RUNNING - + """Router has been deleted""" DELETED } +"""Router Version""" type RouterVersion { + """Version identifier""" version: String! - + """Core version identifier""" core: String! - + """Build number""" build: String! - + """Status of a router version""" status: Status! - + """Config version for this router version""" configVersion: String! - + """JSON schema for validating the router configuration for this router version""" configSchema: String! } -""" -A GraphQL schema document and associated metadata. -""" +"""A GraphQL schema document and associated metadata.""" type Schema { - """ - The GraphQL schema document's SHA256 hash, represented as a hexadecimal string. - """ + """The GraphQL schema document's SHA256 hash, represented as a hexadecimal string.""" hash: ID! - - """ - The GraphQL schema document. - """ + """The GraphQL schema document.""" document: GraphQLDocument! } -""" -An error that occurred while running schema composition on a set of subgraph schemas. -""" +"""An error that occurred while running schema composition on a set of subgraph schemas.""" type SchemaCompositionError { - """ - A human-readable message describing the error. - """ + """A human-readable message describing the error.""" message: String! - - """ - Source locations related to the error. - """ + """Source locations related to the error.""" locations: [SourceLocation]! - - """ - A machine-readable error code. - """ + """A machine-readable error code.""" code: String } -""" -The result of computing the difference between two schemas, usually as part of schema checks. -""" +"""The result of computing the difference between two schemas, usually as part of schema checks.""" type SchemaDiff { - """ - Indicates the overall safety of the changes included in the diff, based on operation history (e.g., `FAILURE` or `NOTICE`). - """ + """Indicates the overall safety of the changes included in the diff, based on operation history (e.g., `FAILURE` or `NOTICE`).""" severity: ChangeSeverity! - - """ - A list of all schema changes in the diff, including their severity. - """ + """A list of all schema changes in the diff, including their severity.""" changes: [Change!]! - - """ - Numeric summaries for each type of change in the diff. - """ + """Numeric summaries for each type of change in the diff.""" changeSummary: ChangeSummary! - - """ - Operations affected by all changes in the diff. - """ + """Operations affected by all changes in the diff.""" affectedQueries: [AffectedQuery!] - - """ - The number of GraphQL operations that were validated during the check. - """ + """The number of GraphQL operations that were validated during the check.""" numberOfCheckedOperations: Int - - """ - The number of GraphQL operations affected by the diff's changes that are neither marked as safe nor ignored. - """ + """The number of GraphQL operations affected by the diff's changes that are neither marked as safe nor ignored.""" numberOfAffectedOperations: Int! } -""" -Contains details for an individual publication of an individual graph variant. -""" +"""Contains details for an individual publication of an individual graph variant.""" type SchemaPublication { """ The variant that was published to." """ variant: GraphVariant! - - """ - The schema that was published to the variant. - """ + """The schema that was published to the variant.""" schema: Schema! - - """ - The result of federated composition executed for this publication. This result includes either a supergraph schema or error details, depending on whether composition succeeded. This value is null when the publication is for a non-federated graph. - """ + """The result of federated composition executed for this publication. This result includes either a supergraph schema or error details, depending on whether composition succeeded. This value is null when the publication is for a non-federated graph.""" compositionResult: CompositionResult - - """ - The timestamp when the variant was published to. - """ + """The timestamp when the variant was published to.""" publishedAt: Timestamp! - - """ - A schema diff comparing against the schema from the most recent previous successful publication. - """ + """A schema diff comparing against the schema from the most recent previous successful publication.""" diffToPrevious: SchemaDiff } +"""Cloud Router secret""" type Secret { + """When the secret was created""" createdAt: DateTime! - + """Name of the secret""" name: String! - + """Hash of the secret""" hash: String! } +"""Input for creating or updating secrets""" input SecretInput { + """Name of the secret""" name: String! - + """ + Value for that secret + + This can only be used for input, as it is not possible to retrieve the value of secrets. + """ value: String! } type SemanticChange { - """ - Semantic metadata about the type of change - """ + """Semantic metadata about the type of change""" definition: ChangeDefinition! - - """ - Top level node affected by the change - """ + """Top level node affected by the change""" parentNode: NamedIntrospectionType - """ Node related to the top level node that was changed, such as a field in an object, a value in an enum or the object of an interface """ childNode: NamedIntrospectionValue - - """ - Target arg of change made. - """ + """Target arg of change made.""" argNode: NamedIntrospectionArg } @@ -2954,106 +1952,77 @@ Each graph has one or more variants, which correspond to the different environme Each variant has its own GraphQL schema, which means schemas can differ between environments. """ type Graph implements Identity { - """ - The organization that this graph belongs to. - """ - account: Organization - - """ - A list of the graph API keys that are active for this graph. - """ + """A list of the graph API keys that are active for this graph.""" apiKeys: [GraphApiKey!] - - """ - Provides a view of the graph as an `Actor` type. - """ + """Provides a view of the graph as an `Actor` type.""" asActor: Actor! - - """ - Get a check workflow for this graph by its ID - """ - checkWorkflow(id: ID!): CheckWorkflow - - """ - The graph's globally unique identifier. - """ - id: ID! - - """ - Permissions of the current user in this graph. - """ - myRole: UserPermission - + """The graph's globally unique identifier.""" + id: ID! name: String! - - """ - Describes the permissions that the active user has for this graph. - """ + """Describes the permissions that the active user has for this graph.""" roles: GraphRoles - - """ - The graph's name. - """ + """A list of the variants for this graph.""" + variants: [GraphVariant!]! + """The organization that this graph belongs to.""" + account: Organization + """Get a check workflow for this graph by its ID""" + checkWorkflow(id: ID!): CheckWorkflow + """Permissions of the current user in this graph.""" + myRole: UserPermission + """The graph's name.""" title: String! - """ Provides details of the graph variant with the provided `name`, if a variant with that name exists for this graph. Otherwise, returns null. - - For a list of _all_ variants associated with a graph, use `Graph.variants` instead. + + For a list of _all_ variants associated with a graph, use `Graph.variants` instead. """ variant(name: String!): GraphVariant - - """ - A list of the variants for this graph. - """ - variants: [GraphVariant!]! - - """ - Get a GraphQL document by hash - """ - document(hash: SHA256): GraphQLDocument - - """ - Get check workflows for this graph ordered by creation time, most recent first. - """ + """The Persisted Query List associated with this graph with the given ID.""" + persistedQueryList(id: ID!): PersistedQueryList + """Get a GraphQL document by hash""" + doc(hash: SHA256): GraphQLDoc + """Get a GraphQL document by hash""" + document(hash: SHA256): GraphQLDocument @deprecated(reason: "Use doc instead") + """Get check workflows for this graph ordered by creation time, most recent first.""" checkWorkflows(limit: Int! = 100, filter: CheckFilterInput): [CheckWorkflow!]! } -""" -Provides access to mutation fields for managing Studio graphs and subgraphs. -""" +"""Provides access to mutation fields for managing Studio graphs and subgraphs.""" type GraphMutation { - """ - Generates a new graph API key for this graph with the specified permission level. - """ + """Generates a new graph API key for this graph with the specified permission level.""" newKey(keyName: String, role: UserPermission! = GRAPH_ADMIN): GraphApiKey! - - """ - Deletes the existing graph API key with the provided ID, if any. - """ - removeKey("API key ID" id: ID!): Void - - """ - Sets a new name for the graph API key with the provided ID, if any. This does not invalidate the key or change its value. - """ + """Deletes the existing graph API key with the provided ID, if any.""" + removeKey( + """API key ID""" + id: ID! + ): Void + """Sets a new name for the graph API key with the provided ID, if any. This does not invalidate the key or change its value.""" renameKey(id: ID!, newKeyName: String): GraphApiKey - - """ - Creates a contract schema from a source variant and a set of filter configurations - """ - upsertContractVariant("The name of the contract variant, e.g. `public-api`. Once set, this value cannot be changed." contractVariantName: String!, "The filter configuration used to build a contract schema. The configuration consists of lists of tags for schema elements to include or exclude in the resulting schema." filterConfig: FilterConfigInput!, "Whether a launch and schema publish should be initiated after updating configuration. Defaults to `true`." initiateLaunch: Boolean! = true, "The graphRef of the variant the contract will be derived from, e.g. `my-graph@production`. Once set, this value cannot be changed." sourceVariant: String): ContractVariantUpsertResult! - - """ - Make changes to a graph variant. - """ + """Creates a contract schema from a source variant and a set of filter configurations""" + upsertContractVariant( + """The name of the contract variant, e.g. `public-api`. Once set, this value cannot be changed.""" + contractVariantName: String! + """The filter configuration used to build a contract schema. The configuration consists of lists of tags for schema elements to include or exclude in the resulting schema.""" + filterConfig: FilterConfigInput! + """Whether a launch and schema publish should be initiated after updating configuration. Defaults to `true`.""" + initiateLaunch: Boolean! = true + """The graphRef of the variant the contract will be derived from, e.g. `my-graph@production`. Once set, this value cannot be changed.""" + sourceVariant: String + ): ContractVariantUpsertResult! + """Lint a single schema using the graph's linter configuration.""" + lintSchema( + """The schema to diff rule violations against, if not provided the full set of rule violations will be returned for the proposed sdl.""" + baseSdl: String + """The schema to lint.""" + sdl: String! + ): LintResult! + """Provides access to mutation fields for modifying a Persisted Query List with the provided ID.""" + persistedQueryList(id: ID!): PersistedQueryListMutation! + """Make changes to a graph variant.""" variant(name: String!): GraphVariantMutation - - """ - Publish a schema to this variant, either via a document or an introspection query result. - """ + """Publish a schema to this variant, either via a document or an introspection query result.""" uploadSchema(schema: IntrospectionSchemaInput, schemaDocument: String, tag: String!, historicParameters: HistoricQueryParameters, overrideComposedSchema: Boolean! = false, errorOnBadRequest: Boolean! = true, gitContext: GitContextInput): SchemaPublicationResult - """ Checks a proposed schema against the schema that has been published to a particular variant, using metrics corresponding to `historicParameters`. @@ -3062,237 +2031,188 @@ type GraphMutation { If they do not set `historicParameters` but set `useMaximumRetention`, validation will use the maximum retention the graph has access to. """ - checkSchema("Only one of proposedSchema, proposedSchemaDocument, and proposedSchemaHash\nmay be specified" proposedSchema: IntrospectionSchemaInput, proposedSchemaDocument: String, proposedSchemaHash: String, baseSchemaTag: String = "current", gitContext: GitContextInput, historicParameters: HistoricQueryParameters, useMaximumRetention: Boolean, isSandboxCheck: Boolean! = false, "If this check is triggered for an sdl fetched using introspection, this is the endpoint where that schema was being served." introspectionEndpoint: String, "Deprecated and ignored." frontend: String): CheckSchemaResult! - - """ - Publish to a subgraph. If composition is successful, this will update running routers. - """ + checkSchema( + """ + Only one of proposedSchema, proposedSchemaDocument, and proposedSchemaHash + may be specified + """ + proposedSchema: IntrospectionSchemaInput + proposedSchemaDocument: String + proposedSchemaHash: String + baseSchemaTag: String = "current" + gitContext: GitContextInput + historicParameters: HistoricQueryParameters + useMaximumRetention: Boolean + isSandboxCheck: Boolean! = false + isProposalCheck: Boolean! = false + """If this check is triggered for an sdl fetched using introspection, this is the endpoint where that schema was being served.""" + introspectionEndpoint: String + """Deprecated and ignored.""" + frontend: String + ): CheckSchemaResult! + """Publish to a subgraph. If composition is successful, this will update running routers.""" publishSubgraph(graphVariant: String!, name: String!, url: String, revision: String!, activePartialSchema: PartialSchemaInput!, gitContext: GitContextInput): SubgraphPublicationResult - - """ - Removes a subgraph. If composition is successful, this will update running routers. - """ - removeImplementingServiceAndTriggerComposition(graphVariant: String!, name: String!, "Do not remove the service, but recompose without it and report any errors." dryRun: Boolean! = false): SubgraphRemovalResult! - + """Publishes multiple subgraphs. If composition is successful, this will update running routers.""" + publishSubgraphs(graphVariant: String!, revision: String!, subgraphInputs: [PublishSubgraphsSubgraphInput!]!, gitContext: GitContextInput): SubgraphPublicationResult + """Removes a subgraph. If composition is successful, this will update running routers.""" + removeImplementingServiceAndTriggerComposition( + graphVariant: String! + name: String! + """Do not remove the service, but recompose without it and report any errors.""" + dryRun: Boolean! = false + ): SubgraphRemovalResult! """ Checks a proposed subgraph schema change against a published subgraph. If the proposal composes successfully, perform a usage check for the resulting supergraph schema. """ - checkPartialSchema("The name of the graph variant to run the check against." graphVariant: String!, "Name of the implementing service to validate the partial schema against" implementingServiceName: String!, "The partial schema to validate against an implementing service" partialSchema: PartialSchemaInput!, gitContext: GitContextInput, historicParameters: HistoricQueryParameters, "Deprecated and ignored." frontend: String, "Whether to use the maximum retention for historical validation. This only takes\neffect if historicParameters is null." useMaximumRetention: Boolean, isSandboxCheck: Boolean! = false, "If this check is triggered for an sdl fetched using introspection, this is the endpoint where that schema was being served." introspectionEndpoint: String): CheckPartialSchemaResult! -} - -""" -Individual permissions for the current user when interacting with a particular Studio graph. -""" + checkPartialSchema( + """The name of the graph variant to run the check against.""" + graphVariant: String! + """Name of the implementing service to validate the partial schema against""" + implementingServiceName: String! + """The partial schema to validate against an implementing service""" + partialSchema: PartialSchemaInput! + gitContext: GitContextInput + historicParameters: HistoricQueryParameters + """Deprecated and ignored.""" + frontend: String + """ + Whether to use the maximum retention for historical validation. This only takes + effect if historicParameters is null. + """ + useMaximumRetention: Boolean + isSandboxCheck: Boolean! = false + isProposalCheck: Boolean! = false + """If this check is triggered for an sdl fetched using introspection, this is the endpoint where that schema was being served.""" + introspectionEndpoint: String + ): CheckPartialSchemaResult! +} + +"""Individual permissions for the current user when interacting with a particular Studio graph.""" type GraphRoles { - """ - Whether the currently authenticated user is permitted to perform schema checks (i.e., run `rover (sub)graph check`). - """ + service: Graph! + """Whether the currently authenticated user is permitted to perform schema checks (i.e., run `rover (sub)graph check`).""" canCheckSchemas: Boolean! - - """ - Whether the currently authenticated user is permitted to create new graph variants. - """ + """Whether the currently authenticated user is permitted to create new graph variants.""" canCreateVariants: Boolean! - - """ - Whether the currently authenticated user is permitted to delete the graph in question - """ + """Whether the currently authenticated user is permitted to delete the graph in question""" canDelete: Boolean! - - """ - Whether the currently authenticated user is permitted to manage user access to the graph in question. - """ + """Whether the currently authenticated user is permitted to manage user access to the graph in question.""" canManageAccess: Boolean! - - """ - Whether the currently authenticated user is permitted to manage the build configuration (e.g., build pipeline version). - """ + """Whether the currently authenticated user is permitted to manage the build configuration (e.g., build pipeline version).""" canManageBuildConfig: Boolean! - - """ - Whether the currently authenticated user is permitted to manage third-party integrations (e.g., Datadog forwarding). - """ + """Whether the currently authenticated user is permitted to manage third-party integrations (e.g., Datadog forwarding).""" canManageIntegrations: Boolean! - - """ - Whether the currently authenticated user is permitted to manage graph-level API keys. - """ + """Whether the currently authenticated user is permitted to manage graph-level API keys.""" canManageKeys: Boolean! - - """ - Whether the currently authenticated user is permitted to perform basic administration of variants (e.g., make a variant public). - """ + """Whether the currently authenticated user is permitted to manage proposal permission settings for this graph.""" + canManageProposalPermissions: Boolean! + """Whether the currently authenticated user is permitted to perform basic administration of variants (e.g., make a variant public).""" canManageVariants: Boolean! - - """ - Whether the currently authenticated user is permitted to view details about the build configuration (e.g. build pipeline version). - """ + """Whether the currently authenticated user is permitted to view details about the build configuration (e.g. build pipeline version).""" canQueryBuildConfig: Boolean! - - """ - Whether the currently authenticated user is permitted to view details of the check configuration for this graph. - """ + """Whether the currently authenticated user is permitted to view details of the check configuration for this graph.""" canQueryCheckConfiguration: Boolean! - - """ - Whether the currently authenticated user is permitted to view which subgraphs the graph is composed of. - """ + """Whether the currently authenticated user is permitted to view which subgraphs the graph is composed of.""" canQueryImplementingServices: Boolean! - - """ - Whether the currently authenticated user is permitted to download schemas owned by this graph. - """ + canQueryProposals: Boolean! + """Whether the currently authenticated user is permitted to download schemas owned by this graph.""" canQuerySchemas: Boolean! - - """ - Whether the currently authenticated user is permitted to register operations (i.e. `apollo client:push`) for this graph. - """ + """Whether the currently authenticated user is permitted to register operations (i.e. `apollo client:push`) for this graph.""" canRegisterOperations: Boolean! - - """ - Whether the currently authenticated user is permitted to make updates to the check configuration for this graph. - """ + """Whether the currently authenticated user is permitted to make updates to the check configuration for this graph.""" canWriteCheckConfiguration: Boolean! + canCreateProposal: Boolean! + canEditProposal: Boolean! } -""" -A SHA-256 hash, represented as a lowercase hexadecimal string. -""" +"""A SHA-256 hash, represented as a lowercase hexadecimal string.""" scalar SHA256 -""" -A location in a source code file. -""" +"""A location in a source code file.""" type SourceLocation { - """ - Column number. - """ + """Column number.""" column: Int! - - """ - Line number. - """ + """Line number.""" line: Int! } -""" -Possible status of a Cloud Router version -""" +"""Possible status of a Cloud Router version""" enum Status { + """Cloud Router Version is ready to be used by end users""" STABLE - + """ + Upcoming or experimental version of a Cloud Router + + This should only be used internally, or to preview new features to + customers. + """ NEXT - + """ + Deprecated version of a Cloud Router + + New Cloud Routers should not use this version, and this will not be + supported at some point in the future. + """ DEPRECATED } -""" -A subgraph in a federated Studio supergraph. -""" +"""A subgraph in a federated Studio supergraph.""" type Subgraph { - """ - The subgraph schema document's SHA256 hash, represented as a hexadecimal string. - """ + """The subgraph schema document's SHA256 hash, represented as a hexadecimal string.""" hash: String! - - """ - The subgraph's registered name. - """ + """The subgraph's registered name.""" name: String! - - """ - The number of fields in this subgraph - """ + """The number of fields in this subgraph""" numberOfFields: Int - - """ - The number of types in this subgraph - """ + """The number of types in this subgraph""" numberOfTypes: Int - - """ - The subgraph's routing URL, provided to gateways that use managed federation. - """ + """The revision string of this publish if provided""" + revision: String + """The subgraph's routing URL, provided to gateways that use managed federation.""" routingURL: String! - - """ - Timestamp of when the subgraph was published. - """ + """Timestamp of when the subgraph was published.""" updatedAt: Timestamp } -""" -A change made to a subgraph as part of a launch. -""" +"""A change made to a subgraph as part of a launch.""" type SubgraphChange { - """ - The subgraph's name. - """ + """The subgraph's name.""" name: ID! - - """ - The type of change that was made. - """ + """The type of change that was made.""" type: SubgraphChangeType! } enum SubgraphChangeType { ADDITION - DELETION - MODIFICATION } -""" -Input type to provide when running schema checks asynchronously for a federated supergraph. -""" +"""Input type to provide when running schema checks asynchronously for a federated supergraph.""" input SubgraphCheckAsyncInput { - """ - Configuration options for the check execution. - """ + """Configuration options for the check execution.""" config: HistoricQueryParametersInput! - - """ - The GitHub context to associate with the check. - """ + """The GitHub context to associate with the check.""" gitContext: GitContextInput! - - """ - The graph ref of the Studio graph and variant to run checks against (such as `my-graph@current`). - """ + """The graph ref of the Studio graph and variant to run checks against (such as `my-graph@current`).""" graphRef: ID - - """ - The URL of the GraphQL endpoint that Apollo Sandbox introspected to obtain the proposed schema. Required if `isSandbox` is `true`. - """ + """The URL of the GraphQL endpoint that Apollo Sandbox introspected to obtain the proposed schema. Required if `isSandbox` is `true`.""" introspectionEndpoint: String - - """ - If `true`, the check was initiated by Apollo Sandbox. - """ + """If `true`, the check was initiated automatically by a Proposal update.""" + isProposal: Boolean + """If `true`, the check was initiated by Apollo Sandbox.""" isSandbox: Boolean! - - """ - The proposed subgraph schema to perform checks with. - """ + """The proposed subgraph schema to perform checks with.""" proposedSchema: GraphQLDocument! - - """ - The name of the subgraph to check schema changes for. - """ + """The name of the subgraph to check schema changes for.""" subgraphName: String! } -""" -ISO 8601, extended format with nanoseconds, Zulu (or "[+-]seconds" as a string or number relative to now) -""" +"""ISO 8601, extended format with nanoseconds, Zulu (or "[+-]seconds" as a string or number relative to now)""" scalar Timestamp -""" -Counts of changes. -""" +"""Counts of changes.""" type TotalChangeSummaryCounts { """ Number of changes that are additions. This includes adding types, adding fields to object, input @@ -3300,41 +2220,28 @@ type TotalChangeSummaryCounts { adding arguments. """ additions: Int! - """ Number of changes that are removals. This includes removing types, removing fields from object, input object, and interface types, removing values from enums, removing members from interfaces and unions, and removing arguments. This also includes removing @deprecated usages. """ removals: Int! - """ Number of changes that are edits. This includes types changing kind, fields and arguments changing type, arguments changing default value, and any description changes. This also includes edits to @deprecated reason strings. """ edits: Int! - - """ - Number of changes that are new usages of the @deprecated directive. - """ + """Number of changes that are new usages of the @deprecated directive.""" deprecations: Int! } -""" -Counts of changes at the type level, including interfaces, unions, enums, scalars, input objects, etc. -""" +"""Counts of changes at the type level, including interfaces, unions, enums, scalars, input objects, etc.""" type TypeChangeSummaryCounts { - """ - Number of changes that are additions of types. - """ + """Number of changes that are additions of types.""" additions: Int! - - """ - Number of changes that are removals of types. - """ + """Number of changes that are removals of types.""" removals: Int! - """ Number of changes that are edits. This includes types changing kind and any type description changes, but also includes adding/removing values from enums, adding/removing members from @@ -3343,63 +2250,34 @@ type TypeChangeSummaryCounts { edits: Int! } -union UpdateOperationCollectionEntryResult = OperationCollectionEntry|PermissionError|ValidationError +union UpdateOperationCollectionEntryResult = OperationCollectionEntry | PermissionError | ValidationError -union UpdateOperationCollectionResult = OperationCollection|PermissionError|ValidationError +union UpdateOperationCollectionResult = OperationCollection | PermissionError | ValidationError -""" -Describes the result of publishing a schema to a graph variant. -""" +"""Describes the result of publishing a schema to a graph variant.""" type SchemaPublicationResult { - """ - A machine-readable response code that indicates the type of result (e.g., `UPLOAD_SUCCESS` or `NO_CHANGES`) - """ + """A machine-readable response code that indicates the type of result (e.g., `UPLOAD_SUCCESS` or `NO_CHANGES`)""" code: String! - - """ - Whether the schema publish operation succeeded (`true`) or encountered errors (`false`). - """ + """Whether the schema publish operation succeeded (`true`) or encountered errors (`false`).""" success: Boolean! - - """ - A Human-readable message describing the type of result. - """ + """A Human-readable message describing the type of result.""" message: String! - - """ - If the publish operation succeeded, this contains its details. Otherwise, this is null. - """ + """If the publish operation succeeded, this contains its details. Otherwise, this is null.""" publication: SchemaPublication } -""" -A registered Apollo Studio user. -""" +"""A registered Apollo Studio user.""" type User implements Identity { - """ - Returns a list of all active user API keys for the user. - """ - apiKeys(includeCookies: Boolean = false): [UserApiKey!]! - - """ - Returns a representation of this user as an `Actor` type. Useful when determining which actor (usually a `User` or `Graph`) performed a particular action in Studio. - """ + """Returns a representation of this user as an `Actor` type. Useful when determining which actor (usually a `User` or `Graph`) performed a particular action in Studio.""" asActor: Actor! - - """ - The user's unique ID. - """ + """The user's unique ID.""" id: ID! - - """ - A list of the user's memberships in Apollo Studio organizations. - """ - memberships: [UserMembership!]! - - """ - The user's first and last name. - """ + """The user's first and last name.""" name: String! + """Returns a list of all active user API keys for the user.""" + apiKeys(includeCookies: Boolean = false): [UserApiKey!]! + """A list of the user's memberships in Apollo Studio organizations.""" + memberships: [UserMembership!]! } """ @@ -3407,100 +2285,61 @@ Represents a user API key, which has permissions identical to its associated Apollo user. """ type UserApiKey implements ApiKey { - """ - The API key's ID. - """ + """The API key's ID.""" id: ID! - - """ - The API key's name, for distinguishing it from other keys. - """ + """The API key's name, for distinguishing it from other keys.""" keyName: String - - """ - The value of the API key. **This is a secret credential!** - """ + """The value of the API key. **This is a secret credential!**""" token: String! } -""" -A single user's membership in a single Apollo Studio organization. -""" +"""A single user's membership in a single Apollo Studio organization.""" type UserMembership { - """ - The organization that the user belongs to. - """ + """The organization that the user belongs to.""" account: Organization! - - """ - The timestamp when the user was added to the organization. - """ + """The timestamp when the user was added to the organization.""" createdAt: Timestamp! - - """ - The user's permission level within the organization. - """ + """The user's permission level within the organization.""" permission: UserPermission! - - """ - The user that belongs to the organization. - """ + """The user that belongs to the organization.""" user: User! } type UserMutation { - """ - Creates a new user API key for this user. - """ + """Creates a new user API key for this user.""" newKey(keyName: String!): UserApiKey! - """ If this user has no active user API keys, this creates one for the user. - + If this user has at least one active user API key, this returns one of those keys at random and does _not_ create a new key. """ provisionKey(keyName: String! = "add-a-name"): ApiKeyProvision - - """ - Deletes the user API key with the provided ID, if any. - """ - removeKey("API key ID" id: ID!): Void - - """ - Sets a new name for the user API key with the provided ID, if any. This does not invalidate the key or change its value. - """ + """Deletes the user API key with the provided ID, if any.""" + removeKey( + """API key ID""" + id: ID! + ): Void + """Sets a new name for the user API key with the provided ID, if any. This does not invalidate the key or change its value.""" renameKey(id: ID!, newKeyName: String): UserApiKey } enum UserPermission { BILLING_MANAGER - CONSUMER - CONTRIBUTOR - DOCUMENTER - GRAPH_ADMIN - LEGACY_GRAPH_KEY - OBSERVER - ORG_ADMIN + PERSISTED_QUERY_PUBLISHER } -""" -An error that occurs when an operation contains invalid user input. -""" +"""An error that occurs when an operation contains invalid user input.""" type ValidationError implements Error { - """ - The error's details. - """ + """The error's details.""" message: String! } -""" -Always null -""" +"""Always null""" scalar Void diff --git a/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/PersistedQueriesUploader.kt b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/PersistedQueriesUploader.kt new file mode 100644 index 00000000000..7e4116dd981 --- /dev/null +++ b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/PersistedQueriesUploader.kt @@ -0,0 +1,68 @@ +package com.apollographql.apollo3.tooling + +import com.apollographql.apollo3.annotations.ApolloExperimental +import com.apollographql.apollo3.api.Optional +import com.apollographql.apollo3.tooling.platformapi.public.PublishOperationsMutation +import com.apollographql.apollo3.tooling.platformapi.public.type.OperationType +import com.apollographql.apollo3.tooling.platformapi.public.type.PersistedQueryInput +import kotlinx.coroutines.runBlocking + +class PersistedQuery( + val name: String, + val id: String, + val body: String, + val operationType: String, +) + +sealed interface PublishOperationsResult +object GraphNotFound: PublishOperationsResult +class PermissionError(val message: String): PublishOperationsResult +class CannotModifyOperationBody(val message: String): PublishOperationsResult +class PublishOperationsSuccess(val added: Int, val removed: Int, val identical: Int, val updated: Int, val unaffected: Int, val name: String, val revision: Int) : PublishOperationsResult + +@ApolloExperimental +fun publishOperations( + listId: String, + persistedQueries: List, + apolloKey: String, + graph: String?, +): PublishOperationsResult { + val graphID = graph ?: apolloKey.getGraph() ?: error("graph not found") + + val response = runBlocking { + val mutation = PublishOperationsMutation(graphID, listId, Optional.present( + persistedQueries.map { PersistedQueryInput(body = it.body, id = it.id, name = it.name, type = OperationType.safeValueOf(it.operationType.uppercase())) } + )) + apolloClient.mutation(mutation) + .addHttpHeader("x-api-key", apolloKey) + .execute() + } + + val graph1 = response.dataOrThrow().graph + if (graph1 == null) { + return GraphNotFound + } + + val ops = graph1.persistedQueryList.publishOperations + return when { + ops.onPublishOperationsResult != null -> { + val counts = ops.onPublishOperationsResult.build.publish.operationCounts + PublishOperationsSuccess( + counts.added, + counts.removed, + counts.identical, + counts.updated, + counts.unaffected, + ops.onPublishOperationsResult.build.list.name, + ops.onPublishOperationsResult.build.revision + ) + } + ops.onPermissionError != null -> { + PermissionError(ops.onPermissionError.message) + } + ops.onCannotModifyOperationBodyError != null -> { + CannotModifyOperationBody(ops.onCannotModifyOperationBodyError.message) + } + else -> error("") + } +} \ No newline at end of file diff --git a/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaDownloader.kt b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaDownloader.kt index f08f5d54d7a..361d0727a06 100644 --- a/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaDownloader.kt +++ b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaDownloader.kt @@ -19,18 +19,6 @@ import com.apollographql.apollo3.tooling.graphql.draft.IntrospectionQuery as Gra import com.apollographql.apollo3.tooling.graphql.june2018.IntrospectionQuery as GraphQLJune2018IntrospectionQuery import com.apollographql.apollo3.tooling.graphql.october2021.IntrospectionQuery as GraphQLOctober2021IntrospectionQuery -/** - * @return the graph from a service key like "service:$graph:$token" - * - * This will not work with user keys - */ -internal fun String.getGraph(): String? { - if (!startsWith("service:")) { - return null - } - return split(":")[1] -} - @ApolloExperimental object SchemaDownloader { diff --git a/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaUploader.kt b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaUploader.kt index d29a1d204b9..73ccfb7abcf 100644 --- a/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaUploader.kt +++ b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/SchemaUploader.kt @@ -3,7 +3,6 @@ package com.apollographql.apollo3.tooling import com.apollographql.apollo3.ApolloClient import com.apollographql.apollo3.annotations.ApolloExperimental import com.apollographql.apollo3.api.http.HttpHeader -import com.apollographql.apollo3.compiler.APOLLO_VERSION import com.apollographql.apollo3.exception.ApolloGraphQLException import com.apollographql.apollo3.exception.ApolloHttpException import com.apollographql.apollo3.tooling.platformapi.public.PublishMonolithSchemaMutation @@ -14,7 +13,7 @@ import kotlinx.coroutines.runBlocking object SchemaUploader { fun uploadSchema( sdl: String, - key: String, + apolloKey: String, graph: String?, variant: String = "current", subgraph: String? = null, @@ -24,18 +23,12 @@ object SchemaUploader { check(subgraph == null && revision == null || subgraph != null && revision != null) { "subgraph and revision must be both null or both not null" } - val apolloClient = ApolloClient.Builder() - .serverUrl("https://api.apollographql.com/graphql") - .httpExposeErrorBody(true) - .build() - - val graphID = graph ?: key.getGraph() ?: error("graph not found") + val graphID = graph ?: apolloKey.getGraph() ?: error("graph not found") val allHeaders: Map = mapOf( - "x-api-key" to key, - "apollographql-client-name" to "apollo-tooling", - "apollographql-client-version" to APOLLO_VERSION + "x-api-key" to apolloKey, ) + headers + if (subgraph == null) { publishMonolithSchema( apolloClient = apolloClient, diff --git a/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/graphos.kt b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/graphos.kt new file mode 100644 index 00000000000..a1ceaa18aec --- /dev/null +++ b/libraries/apollo-tooling/src/main/kotlin/com/apollographql/apollo3/tooling/graphos.kt @@ -0,0 +1,25 @@ +package com.apollographql.apollo3.tooling + +import com.apollographql.apollo3.ApolloClient +import com.apollographql.apollo3.compiler.APOLLO_VERSION + +internal const val graphosEndpoint = "https://api.apollographql.com/graphql" + +internal val apolloClient = ApolloClient.Builder() + .serverUrl(graphosEndpoint) + .httpExposeErrorBody(true) + .addHttpHeader("apollographql-client-name", "apollo-tooling") + .addHttpHeader("apollographql-client-version", APOLLO_VERSION) + .build() + +/** + * @return the graph from a service key like "service:$graph:$token" + * + * This will not work with user keys + */ +internal fun String.getGraph(): String? { + if (!startsWith("service:")) { + return null + } + return split(":")[1] +}