| 1 |
type Product @custom @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") { |
| 2 |
id: ID! |
| 3 |
sku: String |
| 4 |
package: String |
| 5 |
variation: ProductVariation |
| 6 |
dimensions: ProductDimension |
| 7 |
createdBy: User @provides(fields: "totalProductsCreated") |
| 8 |
notes: String @tag(name: "internal") |
| 9 |
research: [ProductResearch!]! |
| 10 |
} |
| 11 |
|
| 12 |
type DeprecatedProduct @key(fields: "sku package") { |
| 13 |
sku: String! |
| 14 |
package: String! |
| 15 |
reason: String |
| 16 |
createdBy: User |
| 17 |
} |
| 18 |
|
| 19 |
type ProductVariation { |
| 20 |
id: ID! |
| 21 |
} |
| 22 |
|
| 23 |
type ProductResearch @key(fields: "study { caseNumber }") { |
| 24 |
study: CaseStudy! |
| 25 |
outcome: String |
| 26 |
} |
| 27 |
|
| 28 |
type CaseStudy { |
| 29 |
caseNumber: ID! |
| 30 |
description: String |
| 31 |
} |
| 32 |
|
| 33 |
type ProductDimension @shareable { |
| 34 |
size: String |
| 35 |
weight: Float |
| 36 |
unit: String @inaccessible |
| 37 |
} |
| 38 |
|
| 39 |
type Query { |
| 40 |
product(id: ID!): Product |
| 41 |
deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead") |
| 42 |
} |
| 43 |
|
| 44 |
type User @extends @key(fields: "email") { |
| 45 |
averageProductsCreatedPerYear: Int @requires(fields: "totalProductsCreated yearsOfEmployment") |
| 46 |
email: ID! @external |
| 47 |
name: String @override(from: "users") |
| 48 |
totalProductsCreated: Int @external |
| 49 |
yearsOfEmployment: Int! @external |
| 50 |
} |
| 51 |
|
| 52 |
type Inventory @interfaceObject @key(fields: "id") { |
| 53 |
id: ID! |
| 54 |
deprecatedProducts: [DeprecatedProduct!]! |
| 55 |
} |
| 56 |
|
| 57 |
# |
| 58 |
# Apollo Federation schema |
| 59 |
# |
| 60 |
|
| 61 |
scalar FieldSet |
| 62 |
scalar link__Import |
| 63 |
scalar _Any |
| 64 |
|
| 65 |
union _Entity = Product | DeprecatedProduct | ProductResearch | User | Inventory |
| 66 |
|
| 67 |
enum link__Purpose { |
| 68 |
""" |
| 69 |
`SECURITY` features provide metadata necessary to securely resolve fields. |
| 70 |
""" |
| 71 |
SECURITY |
| 72 |
|
| 73 |
""" |
| 74 |
`EXECUTIO`N features provide metadata necessary for operation execution. |
| 75 |
""" |
| 76 |
EXECUTION |
| 77 |
} |
| 78 |
|
| 79 |
type _Service { |
| 80 |
sdl: String! |
| 81 |
} |
| 82 |
|
| 83 |
extend type Query { |
| 84 |
_service: _Service! |
| 85 |
_entities(representations: [_Any!]!): [_Entity]! |
| 86 |
} |
| 87 |
|
| 88 |
directive @composeDirective(name: String!) repeatable on SCHEMA |
| 89 |
directive @external on FIELD_DEFINITION | OBJECT |
| 90 |
directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION |
| 91 |
directive @interfaceObject on OBJECT |
| 92 |
directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE |
| 93 |
directive @link(url: String!, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA |
| 94 |
directive @override(from: String!) on FIELD_DEFINITION |
| 95 |
directive @provides(fields: FieldSet!) on FIELD_DEFINITION |
| 96 |
directive @requires(fields: FieldSet!) on FIELD_DEFINITION |
| 97 |
directive @shareable repeatable on OBJECT | FIELD_DEFINITION |
| 98 |
directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION |
| 99 |
|
| 100 |
# This definition is required only for libraries that don't support |
| 101 |
# GraphQL's built-in `extend` keyword |
| 102 |
directive @extends on OBJECT | INTERFACE |
| 103 |
|
| 104 |
directive @custom on OBJECT |
| 105 |
|
| 106 |
extend schema |
| 107 |
@link( |
| 108 |
url: "https://specs.apollo.dev/federation/v2.3", |
| 109 |
import: [ |
| 110 |
"@composeDirective", |
| 111 |
"@extends", |
| 112 |
"@external", |
| 113 |
"@inaccessible", |
| 114 |
"@interfaceObject", |
| 115 |
"@key", |
| 116 |
"@override", |
| 117 |
"@provides", |
| 118 |
"@requires", |
| 119 |
"@shareable", |
| 120 |
"@tag", |
| 121 |
"FieldSet" |
| 122 |
] |
| 123 |
) |
| 124 |
@link(url: "https://myspecs.dev/myCustomDirective/v1.0", import: ["@custom"]) |
| 125 |
@composeDirective(name: "@custom") |