|
1 | 1 | schema
|
2 |
| - @link(url: "https://specs.apollo.dev/link/v1.0") |
3 |
| - @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) { |
| 2 | + @core(feature: "https://specs.apollo.dev/core/v0.2") |
| 3 | + @core(feature: "https://specs.apollo.dev/join/v0.1", for: EXECUTION) { |
4 | 4 | query: Query
|
5 | 5 | }
|
6 | 6 |
|
7 |
| -directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE |
| 7 | +directive @core(as: String, feature: String!, for: core__Purpose) repeatable on SCHEMA |
8 | 8 |
|
9 | 9 | directive @join__field(
|
10 | 10 | graph: join__Graph
|
11 |
| - requires: join__FieldSet |
12 | 11 | provides: join__FieldSet
|
13 |
| - type: String |
14 |
| - external: Boolean |
15 |
| - override: String |
16 |
| - usedOverridden: Boolean |
17 |
| -) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION |
| 12 | + requires: join__FieldSet |
| 13 | +) on FIELD_DEFINITION |
18 | 14 |
|
19 | 15 | directive @join__graph(name: String!, url: String!) on ENUM_VALUE
|
20 | 16 |
|
21 |
| -directive @join__implements( |
22 |
| - graph: join__Graph! |
23 |
| - interface: String! |
24 |
| -) repeatable on OBJECT | INTERFACE |
25 |
| - |
26 |
| -directive @join__type( |
27 |
| - graph: join__Graph! |
28 |
| - key: join__FieldSet |
29 |
| - extension: Boolean! = false |
30 |
| - resolvable: Boolean! = true |
31 |
| - isInterfaceObject: Boolean! = false |
32 |
| -) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR |
33 |
| - |
34 |
| -directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION |
35 |
| - |
36 |
| -directive @link( |
37 |
| - url: String |
38 |
| - as: String |
39 |
| - for: link__Purpose |
40 |
| - import: [link__Import] |
41 |
| -) repeatable on SCHEMA |
| 17 | +directive @join__owner(graph: join__Graph!) on INTERFACE | OBJECT |
42 | 18 |
|
43 |
| -scalar join__FieldSet |
| 19 | +directive @join__type(graph: join__Graph!, key: join__FieldSet) repeatable on INTERFACE | OBJECT |
44 | 20 |
|
45 |
| -enum join__Graph { |
46 |
| - accounts @join__graph(name: "accounts", url: "http://accounts:4001/graphql") |
47 |
| - inventory @join__graph(name: "inventory", url: "http://inventory:4002/graphql") |
48 |
| - products @join__graph(name: "products", url: "http://products:4003/graphql") |
49 |
| - reviews @join__graph(name: "reviews", url: "http://reviews:4004/graphql") |
| 21 | +type Category |
| 22 | + @join__owner(graph: products) |
| 23 | + @join__type(graph: products, key: "id") |
| 24 | + @join__type(graph: discount, key: "id") { |
| 25 | + discounts: [Discount!]! @join__field(graph: discount) |
| 26 | + id: ID! @join__field(graph: products) |
| 27 | + name: String! @join__field(graph: products) |
50 | 28 | }
|
51 | 29 |
|
52 |
| -scalar link__Import |
53 |
| - |
54 |
| -enum link__Purpose { |
55 |
| - """ |
56 |
| - `SECURITY` features provide metadata necessary to securely resolve fields. |
57 |
| - """ |
58 |
| - SECURITY |
59 |
| - |
60 |
| - """ |
61 |
| - `EXECUTION` features provide metadata necessary for operation execution. |
62 |
| - """ |
63 |
| - EXECUTION |
| 30 | +type Discount @join__owner(graph: discount) @join__type(graph: discount, key: "id") { |
| 31 | + discount: Int! @join__field(graph: discount) |
| 32 | + id: ID! @join__field(graph: discount) |
64 | 33 | }
|
65 | 34 |
|
66 | 35 | type Product
|
67 |
| - @join__type(graph: inventory, key: "upc") |
| 36 | + @join__owner(graph: products) |
68 | 37 | @join__type(graph: products, key: "upc")
|
| 38 | + @join__type(graph: discount, key: "upc") |
| 39 | + @join__type(graph: inventory, key: "upc") |
69 | 40 | @join__type(graph: reviews, key: "upc") {
|
70 |
| - upc: String! |
71 |
| - weight: Int @join__field(graph: inventory, external: true) @join__field(graph: products) |
72 |
| - price: Int @join__field(graph: inventory, external: true) @join__field(graph: products) |
| 41 | + categories: [Category!]! @join__field(graph: products) |
| 42 | + discounts: [Discount!]! @join__field(graph: discount) |
73 | 43 | inStock: Boolean @join__field(graph: inventory)
|
74 |
| - shippingEstimate: Int @join__field(graph: inventory, requires: "price weight") |
75 | 44 | name: String @join__field(graph: products)
|
| 45 | + price: Int @join__field(graph: products) |
76 | 46 | reviews: [Review] @join__field(graph: reviews)
|
| 47 | + shippingEstimate: Int @join__field(graph: inventory, requires: "price weight") |
| 48 | + upc: String! @join__field(graph: products) |
| 49 | + weight: Int @join__field(graph: products) |
77 | 50 | }
|
78 | 51 |
|
79 |
| -type Query |
80 |
| - @join__type(graph: accounts) |
81 |
| - @join__type(graph: inventory) |
82 |
| - @join__type(graph: products) |
83 |
| - @join__type(graph: reviews) { |
| 52 | +type Query { |
| 53 | + discounts(first: Int = 5): [Discount] @join__field(graph: discount) |
84 | 54 | me: User @join__field(graph: accounts)
|
85 |
| - users: [User] @join__field(graph: accounts) |
86 | 55 | topProducts(first: Int): [Product] @join__field(graph: products)
|
| 56 | + users: [User] @join__field(graph: accounts) |
87 | 57 | }
|
88 | 58 |
|
89 |
| -type Review @join__type(graph: reviews, key: "id") { |
90 |
| - id: ID! |
91 |
| - body: String |
92 |
| - product: Product |
| 59 | +type Review @join__owner(graph: reviews) @join__type(graph: reviews, key: "id") { |
93 | 60 | author: User @join__field(graph: reviews, provides: "username")
|
| 61 | + body: String @join__field(graph: reviews) |
| 62 | + id: ID! @join__field(graph: reviews) |
| 63 | + product: Product @join__field(graph: reviews) |
94 | 64 | }
|
95 | 65 |
|
96 |
| -type User @join__type(graph: accounts, key: "id") @join__type(graph: reviews, key: "id") { |
97 |
| - id: ID! |
98 |
| - name: String @join__field(graph: accounts) |
99 |
| - username: String @join__field(graph: accounts) @join__field(graph: reviews, external: true) |
| 66 | +type User |
| 67 | + @join__owner(graph: accounts) |
| 68 | + @join__type(graph: accounts, key: "id") |
| 69 | + @join__type(graph: reviews, key: "id") { |
100 | 70 | birthDate: String @join__field(graph: accounts)
|
| 71 | + id: ID! @join__field(graph: accounts) |
| 72 | + name: String @join__field(graph: accounts) |
101 | 73 | numberOfReviews: Int @join__field(graph: reviews)
|
102 | 74 | reviews: [Review] @join__field(graph: reviews)
|
| 75 | + username: String @join__field(graph: accounts) |
| 76 | +} |
| 77 | + |
| 78 | +enum core__Purpose { |
| 79 | + """ |
| 80 | + `EXECUTION` features provide metadata necessary to for operation execution. |
| 81 | + """ |
| 82 | + EXECUTION |
| 83 | + |
| 84 | + """ |
| 85 | + `SECURITY` features provide metadata necessary to securely resolve fields. |
| 86 | + """ |
| 87 | + SECURITY |
| 88 | +} |
| 89 | + |
| 90 | +scalar join__FieldSet |
| 91 | + |
| 92 | +enum join__Graph { |
| 93 | + accounts @join__graph(name: "accounts", url: "http://www.accounts.com") |
| 94 | + discount @join__graph(name: "discount", url: "http://www.discount.com") |
| 95 | + inventory @join__graph(name: "inventory", url: "http://www.inventory.com") |
| 96 | + products @join__graph(name: "products", url: "http://www.products.com") |
| 97 | + reviews @join__graph(name: "reviews", url: "http://www.reviews.com") |
103 | 98 | }
|
0 commit comments