From 0ebb2f8a393ddbb01a0d0e83cf16b29d1c638129 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Thu, 28 Mar 2024 15:38:04 +0100 Subject: [PATCH] Added more test cases --- .../composite/_supergraph.graphql | 91 ------------------- .../composite/a.graphql | 9 ++ .../composite/b.graphql | 9 ++ .../composite/c.graphql | 10 ++ .../composite/extra.graphql | 3 + .../federation/a.graphql | 1 - .../federation/b.graphql | 2 +- 7 files changed, 32 insertions(+), 93 deletions(-) delete mode 100644 rfcs/test-cases/basic-example-with-provides/composite/_supergraph.graphql create mode 100644 rfcs/test-cases/basic-example-with-requires/composite/a.graphql create mode 100644 rfcs/test-cases/basic-example-with-requires/composite/b.graphql create mode 100644 rfcs/test-cases/basic-example-with-requires/composite/c.graphql create mode 100644 rfcs/test-cases/basic-example-with-requires/composite/extra.graphql diff --git a/rfcs/test-cases/basic-example-with-provides/composite/_supergraph.graphql b/rfcs/test-cases/basic-example-with-provides/composite/_supergraph.graphql deleted file mode 100644 index 3486bd1..0000000 --- a/rfcs/test-cases/basic-example-with-provides/composite/_supergraph.graphql +++ /dev/null @@ -1,91 +0,0 @@ -schema - @link(url: "https://specs.apollo.dev/link/v1.0") - @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) { - query: Query -} - -directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE - -directive @join__field( - graph: join__Graph - requires: join__FieldSet - provides: join__FieldSet - type: String - external: Boolean - override: String - usedOverridden: Boolean -) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION - -directive @join__graph(name: String!, url: String!) on ENUM_VALUE - -directive @join__implements( - graph: join__Graph! - interface: String! -) repeatable on OBJECT | INTERFACE - -directive @join__type( - graph: join__Graph! - key: join__FieldSet - extension: Boolean! = false - resolvable: Boolean! = true - isInterfaceObject: Boolean! = false -) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR - -directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION - -directive @link( - url: String - as: String - for: link__Purpose - import: [link__Import] -) repeatable on SCHEMA - -type B @join__type(graph: B) { - id: ID! - user: User! -} - -type D @join__type(graph: D) { - id: ID! - user: User! @join__field(graph: D, provides: "id") -} - -scalar join__FieldSet - -enum join__Graph { - A @join__graph(name: "a", url: "") - B @join__graph(name: "b", url: "") - C @join__graph(name: "c", url: "") - D @join__graph(name: "d", url: "") -} - -scalar link__Import - -enum link__Purpose { - """ - `SECURITY` features provide metadata necessary to securely resolve fields. - """ - SECURITY - - """ - `EXECUTION` features provide metadata necessary for operation execution. - """ - EXECUTION -} - -type Query @join__type(graph: A) @join__type(graph: B) @join__type(graph: C) @join__type(graph: D) { - a: User @join__field(graph: A) -} - -type User - @join__type(graph: A, key: "id") - @join__type(graph: A, key: "uuid") - @join__type(graph: B, key: "uuid") - @join__type(graph: C, key: "id") - @join__type(graph: C, key: "uuid") - @join__type(graph: D, key: "uuid") { - id: ID! @join__field(graph: A) @join__field(graph: C) @join__field(graph: D, external: true) - uuid: String! - name: String! @join__field(graph: A) - commentCount: Int! @join__field(graph: C) -} diff --git a/rfcs/test-cases/basic-example-with-requires/composite/a.graphql b/rfcs/test-cases/basic-example-with-requires/composite/a.graphql new file mode 100644 index 0000000..f0ae203 --- /dev/null +++ b/rfcs/test-cases/basic-example-with-requires/composite/a.graphql @@ -0,0 +1,9 @@ +type User @extends @key(fields: "id") { + a: String + id: ID! @external +} + +type Query { + a: String + userById(id: ID!): User @lookup +} diff --git a/rfcs/test-cases/basic-example-with-requires/composite/b.graphql b/rfcs/test-cases/basic-example-with-requires/composite/b.graphql new file mode 100644 index 0000000..249e1be --- /dev/null +++ b/rfcs/test-cases/basic-example-with-requires/composite/b.graphql @@ -0,0 +1,9 @@ +type User @key(fields: "id") { + b(uuid: String! @requires(fields: "uuid")): String + id: ID! @external +} + +type Query { + b: String + userById(id: ID!): User @lookup +} diff --git a/rfcs/test-cases/basic-example-with-requires/composite/c.graphql b/rfcs/test-cases/basic-example-with-requires/composite/c.graphql new file mode 100644 index 0000000..9f7fe67 --- /dev/null +++ b/rfcs/test-cases/basic-example-with-requires/composite/c.graphql @@ -0,0 +1,10 @@ +type User @key(fields: "id") { + c: String + id: ID! + uuid: ID! +} + +type Query { + c: User + userById(id: ID!): User @lookup +} diff --git a/rfcs/test-cases/basic-example-with-requires/composite/extra.graphql b/rfcs/test-cases/basic-example-with-requires/composite/extra.graphql new file mode 100644 index 0000000..fe821eb --- /dev/null +++ b/rfcs/test-cases/basic-example-with-requires/composite/extra.graphql @@ -0,0 +1,3 @@ +type Query { + extra: String +} diff --git a/rfcs/test-cases/basic-example-with-requires/federation/a.graphql b/rfcs/test-cases/basic-example-with-requires/federation/a.graphql index ae4dafb..f5d019a 100644 --- a/rfcs/test-cases/basic-example-with-requires/federation/a.graphql +++ b/rfcs/test-cases/basic-example-with-requires/federation/a.graphql @@ -1,7 +1,6 @@ type User @extends @key(fields: "id") { a: String id: ID! @external - uuid: ID! @external } type Query { diff --git a/rfcs/test-cases/basic-example-with-requires/federation/b.graphql b/rfcs/test-cases/basic-example-with-requires/federation/b.graphql index 5f15271..1ccb063 100644 --- a/rfcs/test-cases/basic-example-with-requires/federation/b.graphql +++ b/rfcs/test-cases/basic-example-with-requires/federation/b.graphql @@ -1,4 +1,4 @@ -type User @extends @key(fields: "id") { +type User @key(fields: "id") { b: String @requires(fields: "uuid") id: ID! @external uuid: ID! @external