|
| 1 | +schema |
| 2 | + @link(url: "https://specs.apollo.dev/link/v1.0") |
| 3 | + @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) { |
| 4 | + query: Query |
| 5 | +} |
| 6 | + |
| 7 | +directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE |
| 8 | + |
| 9 | +directive @join__field( |
| 10 | + graph: join__Graph |
| 11 | + requires: join__FieldSet |
| 12 | + provides: join__FieldSet |
| 13 | + type: String |
| 14 | + external: Boolean |
| 15 | + override: String |
| 16 | + usedOverridden: Boolean |
| 17 | +) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION |
| 18 | + |
| 19 | +directive @join__graph(name: String!, url: String!) on ENUM_VALUE |
| 20 | + |
| 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( |
| 35 | + graph: join__Graph! |
| 36 | + member: String! |
| 37 | +) repeatable on UNION |
| 38 | + |
| 39 | +directive @link( |
| 40 | + url: String |
| 41 | + as: String |
| 42 | + for: link__Purpose |
| 43 | + import: [link__Import] |
| 44 | +) repeatable on SCHEMA |
| 45 | + |
| 46 | +scalar join__FieldSet |
| 47 | + |
| 48 | +enum join__Graph { |
| 49 | + ACCOUNTS |
| 50 | + @join__graph(name: "accounts", url: "https://accounts.demo.starstuff.dev/") |
| 51 | + INVENTORY |
| 52 | + @join__graph( |
| 53 | + name: "inventory" |
| 54 | + url: "https://inventory.demo.starstuff.dev/" |
| 55 | + ) |
| 56 | + PRODUCTS |
| 57 | + @join__graph(name: "products", url: "https://products.demo.starstuff.dev/") |
| 58 | + REVIEWS |
| 59 | + @join__graph(name: "reviews", url: "https://reviews.demo.starstuff.dev/") |
| 60 | +} |
| 61 | + |
| 62 | +scalar link__Import |
| 63 | + |
| 64 | +enum link__Purpose { |
| 65 | + SECURITY |
| 66 | + EXECUTION |
| 67 | +} |
| 68 | + |
| 69 | +type Product |
| 70 | + @join__type(graph: INVENTORY, key: "upc") |
| 71 | + @join__type(graph: INVENTORY, key: "upc inStock") |
| 72 | + @join__type(graph: PRODUCTS, key: "upc") |
| 73 | + @join__type(graph: REVIEWS, key: "upc") { |
| 74 | + upc: String! |
| 75 | + weight: Int |
| 76 | + @join__field(graph: INVENTORY, external: true) |
| 77 | + @join__field(graph: PRODUCTS) |
| 78 | + price: Int |
| 79 | + @join__field(graph: INVENTORY, external: true) |
| 80 | + @join__field(graph: PRODUCTS) |
| 81 | + inStock: Boolean @join__field(graph: INVENTORY) |
| 82 | + shippingEstimate: Int @join__field(graph: INVENTORY, requires: "price weight") |
| 83 | + name: String @join__field(graph: PRODUCTS) |
| 84 | + reviews: [Review] @join__field(graph: REVIEWS) |
| 85 | +} |
| 86 | + |
| 87 | +type Query |
| 88 | + @join__type(graph: ACCOUNTS) |
| 89 | + @join__type(graph: INVENTORY) |
| 90 | + @join__type(graph: PRODUCTS) |
| 91 | + @join__type(graph: REVIEWS) { |
| 92 | + me: User @join__field(graph: ACCOUNTS) |
| 93 | + topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCTS) |
| 94 | +} |
| 95 | + |
| 96 | +type Review @join__type(graph: REVIEWS, key: "id") { |
| 97 | + id: ID! |
| 98 | + body: String |
| 99 | + author: User @join__field(graph: REVIEWS, provides: "username") |
| 100 | + product: Product @join__field(graph: REVIEWS) |
| 101 | +} |
| 102 | + |
| 103 | +type User |
| 104 | + @join__type(graph: ACCOUNTS, key: "id") |
| 105 | + @join__type(graph: REVIEWS, key: "id") { |
| 106 | + id: ID! |
| 107 | + name: String @join__field(graph: ACCOUNTS) |
| 108 | + username: String |
| 109 | + @join__field(graph: ACCOUNTS) |
| 110 | + @join__field(graph: REVIEWS, external: true) |
| 111 | + reviews: [Review] @join__field(graph: REVIEWS) |
| 112 | +} |
0 commit comments