From f41e0894824663f62caf8fab6d10a6904449ec39 Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Fri, 16 Dec 2022 10:09:58 -0600 Subject: [PATCH] chore: updates schema (#1457) ran `cargo xtask prep --schema-only` and fixed the compile errors --- crates/rover-client/.schema/hash.id | 2 +- crates/rover-client/.schema/last_run.uuid | 2 +- crates/rover-client/.schema/schema.graphql | 102 +++++++++++++++--- .../src/operations/graph/check/types.rs | 2 +- .../src/operations/subgraph/check/types.rs | 2 +- 5 files changed, 89 insertions(+), 21 deletions(-) diff --git a/crates/rover-client/.schema/hash.id b/crates/rover-client/.schema/hash.id index 6cfb46a2a..a0a10aae2 100644 --- a/crates/rover-client/.schema/hash.id +++ b/crates/rover-client/.schema/hash.id @@ -1 +1 @@ -56a073e5ff2022fa643b9ea8103391b586138b696f8805e40255976764a96d6d \ No newline at end of file +9a7b988b3a87afbc156104828d4aa12bd344c2a7e75b037bf3017b9b9729505b \ No newline at end of file diff --git a/crates/rover-client/.schema/last_run.uuid b/crates/rover-client/.schema/last_run.uuid index 8524fe0cc..7effdef93 100644 --- a/crates/rover-client/.schema/last_run.uuid +++ b/crates/rover-client/.schema/last_run.uuid @@ -1 +1 @@ -70e07c24-5d76-4cbd-aa22-d18cfec80d99 \ No newline at end of file +e7d29e25-cc98-4fb9-a99b-154ed98fc79b \ No newline at end of file diff --git a/crates/rover-client/.schema/schema.graphql b/crates/rover-client/.schema/schema.graphql index 784c063b1..7e58a1c25 100644 --- a/crates/rover-client/.schema/schema.graphql +++ b/crates/rover-client/.schema/schema.graphql @@ -6,12 +6,14 @@ schema { """An organization in Apollo Studio. Can have multiple members and graphs.""" type Organization { auditLogExports: [AuditLogExport!] + """Graphs belonging to this organization.""" + graphs(includeDeleted: Boolean): [Graph!]! """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! """Graphs belonging to this organization.""" - services(includeDeleted: Boolean): [Graph!]! + services(includeDeleted: Boolean): [Graph!]! @deprecated(reason: "Use graphs field instead") } type OrganizationMutation { @@ -381,7 +383,7 @@ input CheckSchemaAsyncInput { config: HistoricQueryParametersInput! """The GitHub context to associate with the check.""" gitContext: GitContextInput! - graphRef: ID! + 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`.""" introspectionEndpoint: String """If `true`, the check was initiated by Apollo Sandbox.""" @@ -398,22 +400,23 @@ type CheckSchemaResult { } type CheckWorkflow { - id: ID! - """The set of check tasks associated with this workflow, e.g. composition, operations, etc.""" - tasks: [CheckWorkflowTask!]! """ - The variant provided as a base to check against. Only the differences from the + The variant provided as a base to check against. Only the differences from the base schema will be tested in operations checks. """ baseVariant: GraphVariant - """Contextual parameters supplied by the runtime environment where the check was run.""" - gitContext: GitContext + id: ID! """The name of the implementing service that was responsible for triggering the validation.""" implementingServiceName: String + """The timestamp when the check workflow started.""" + startedAt: Timestamp + """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.""" + gitContext: GitContext """Overall status of the workflow, based on the underlying task statuses.""" status: CheckWorkflowStatus! createdAt: Timestamp! - startedAt: Timestamp completedAt: Timestamp } @@ -540,6 +543,22 @@ type CompositionCheckResult implements CompositionResult { supergraphSdl: GraphQLDocument } +type ContractVariantUpsertErrors { + """A list of all errors that occurred when attempting to create or update a contract variant.""" + errorMessages: [String!]! +} + +union ContractVariantUpsertResult = ContractVariantUpsertErrors | ContractVariantUpsertSuccess + +type ContractVariantUpsertSuccess { + """The updated contract variant""" + contractVariant: GraphVariant! + """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.""" + launchUrl: String +} + """Contains the supergraph and API schemas generated by composition.""" type CoreSchema { """The composed API schema document.""" @@ -667,11 +686,18 @@ type FilterCheckTask implements CheckWorkflowTask { workflow: CheckWorkflow! } -"""Filter config specifies strings to be included and or excluded.""" +"""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 { - """Strings to be excluded.""" + """Tags of schema elements to exclude from the contract schema.""" + exclude: [String!]! + """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.""" exclude: [String!]! - """Strings to be included.""" + """A list of tags for schema elements to include in the resulting contract schema.""" include: [String!]! } @@ -723,6 +749,10 @@ type GraphVariant { """The variant's global identifier in the form `graphID@variant`.""" id: ID! 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.""" + contractFilterConfig: FilterConfig + """The graph that this variant belongs to.""" + graph: Graph! """Latest approved launch for the variant, and what is served through Uplink.""" latestApprovedLaunch: Launch """Latest launch for the variant, whether successful or not.""" @@ -732,10 +762,10 @@ type GraphVariant { """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.""" + sourceVariant: GraphVariant """A list of the saved [operation collections](https://www.apollographql.com/docs/studio/explorer/operation-collections/) associated with this variant.""" operationCollections: [OperationCollection!]! - """The graph that this variant belongs to.""" - graph: Graph! """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.""" @@ -1377,6 +1407,7 @@ type Order { status: OrderStatus! reason: String logs(first: Int, offset: Int): [LogMessage!]! + router: Router! } union OrderOrError = Order @@ -1469,12 +1500,27 @@ type Readme { 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""" status: RouterStatus! + """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""" order(orderId: ID!): Order + """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""" secrets: [Secret!]! } @@ -1489,6 +1535,8 @@ enum RouterStatus { type RouterVersion { version: String! + core: String! + build: String! status: Status! configVersion: String! configSchema: String! @@ -1609,10 +1657,21 @@ type GraphMutation { """Deletes the existing graph API key with the provided ID, if any.""" removeKey( """API key ID""" - id: 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.""" variant(name: String!): GraphVariantMutation """Publish a schema to this variant, either via a document or an introspection query result.""" @@ -1733,8 +1792,14 @@ type Subgraph { hash: String! """The subgraph's registered name.""" name: String! + """The number of fields in this subgraph""" + numberOfFields: Int + """The number of types in this subgraph""" + numberOfTypes: Int """The subgraph's routing URL, provided to gateways that use managed federation.""" routingURL: String! + """Timestamp of when the subgraph was published.""" + updatedAt: Timestamp } """A change made to a subgraph as part of a launch.""" @@ -1758,7 +1823,7 @@ input SubgraphCheckAsyncInput { """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`).""" - graphRef: ID! + graphRef: ID """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.""" @@ -1875,7 +1940,10 @@ type UserMutation { """ provisionKey(keyName: String! = "add-a-name"): ApiKeyProvision """Deletes the user API key with the provided ID, if any.""" - removeKey(id: ID!): Void + 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 } diff --git a/crates/rover-client/src/operations/graph/check/types.rs b/crates/rover-client/src/operations/graph/check/types.rs index 842db8edf..9074c32eb 100644 --- a/crates/rover-client/src/operations/graph/check/types.rs +++ b/crates/rover-client/src/operations/graph/check/types.rs @@ -22,7 +22,7 @@ impl From for MutationVariables { graph_id: input.graph_ref.name, name: input.graph_ref.variant, input: MutationInput { - graph_ref: graph_ref.to_string(), + graph_ref: Some(graph_ref.to_string()), proposed_schema_document: Some(input.proposed_schema), git_context: input.git_context.into(), config: input.config.into(), diff --git a/crates/rover-client/src/operations/subgraph/check/types.rs b/crates/rover-client/src/operations/subgraph/check/types.rs index 6a7669234..cb06d7218 100644 --- a/crates/rover-client/src/operations/subgraph/check/types.rs +++ b/crates/rover-client/src/operations/subgraph/check/types.rs @@ -23,7 +23,7 @@ impl From for MutationVariables { graph_id: input.graph_ref.name, name: input.graph_ref.variant, input: MutationInput { - graph_ref: graph_ref.to_string(), + graph_ref: Some(graph_ref.to_string()), proposed_schema: input.proposed_schema, git_context: input.git_context.into(), config: input.config.into(),