-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7743e11
commit ba66806
Showing
1 changed file
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
schema @composeDirective(name: "@custom") @link(url: "https:\/\/myspecs.dev\/myCustomDirective\/v1.0", import: [ "@custom" ]) @link(url: "https:\/\/specs.apollo.dev\/federation\/v2.5", import: [ "@composeDirective", "@extends", "@external", "@key", "@inaccessible", "@interfaceObject", "@override", "@provides", "@requires", "@shareable", "@tag", "FieldSet" ]) { | ||
query: Query | ||
} | ||
|
||
type CaseStudy { | ||
caseNumber: ID! | ||
description: String | ||
} | ||
|
||
type DeprecatedProduct @key(fields: "sku package") { | ||
sku: String! | ||
package: String! | ||
reason: String | ||
createdBy: User | ||
} | ||
|
||
type Inventory @key(fields: "id") @interfaceObject { | ||
deprecatedProducts: [DeprecatedProduct!]! | ||
id: ID! | ||
} | ||
|
||
type Product @key(fields: "id") @key(fields: "sku package") @key(fields: "sku variation { id }") @custom { | ||
id: ID! | ||
sku: String | ||
package: String | ||
variation: ProductVariation | ||
dimensions: ProductDimension | ||
createdBy: User @provides(fields: "totalProductsCreated") | ||
notes: String @tag(name: "internal") | ||
research: [ProductResearch!]! | ||
} | ||
|
||
type ProductDimension @shareable { | ||
size: String | ||
weight: Float | ||
unit: String @inaccessible | ||
} | ||
|
||
type ProductResearch @key(fields: "study { caseNumber }") { | ||
study: CaseStudy! | ||
outcome: String | ||
} | ||
|
||
type ProductVariation { | ||
id: ID! | ||
} | ||
|
||
type Query { | ||
product(id: ID!): Product | ||
deprecatedProduct(sku: String! package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead") | ||
_service: _Service! | ||
_entities(representations: [_Any!]!): [_Entity]! | ||
} | ||
|
||
type User @key(fields: "email") @extends { | ||
averageProductsCreatedPerYear: Int @requires(fields: "totalProductsCreated yearsOfEmployment") | ||
yearsOfEmployment: Int! @external | ||
email: ID! @external | ||
name: String @override(from: "users") | ||
totalProductsCreated: Int @external | ||
} | ||
|
||
"This type provides a field named sdl: String! which exposes the SDL of the service's schema. This SDL (schema definition language) is a printed version of the service's schema including the annotations of federation directives. This SDL does not include the additions of the federation spec." | ||
type _Service { | ||
sdl: String! | ||
} | ||
|
||
"Union of all types that key directive applied. This information is needed by the Apollo federation gateway." | ||
union _Entity = Inventory | Product | DeprecatedProduct | User | ProductResearch | ||
|
||
"Marks underlying custom directive to be included in the Supergraph schema." | ||
directive @composeDirective(name: String!) on SCHEMA | ||
|
||
directive @custom on OBJECT | ||
|
||
"Directive to indicate that marks target object as extending part of the federated schema." | ||
directive @extends on OBJECT | INTERFACE | ||
|
||
"Directive to indicate that a field is owned by another service, for example via Apollo federation." | ||
directive @external on OBJECT | FIELD_DEFINITION | ||
|
||
"Marks location within schema as inaccessible from the GraphQL Gateway" | ||
directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
|
||
"Provides meta information to the router that this entity type is an interface in the supergraph." | ||
directive @interfaceObject on OBJECT | ||
|
||
"Used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface." | ||
directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE | ||
|
||
directive @link(url: String! import: [String]) repeatable on SCHEMA | ||
|
||
"Overrides fields resolution logic from other subgraph. Used for migrating fields from one subgraph to another." | ||
directive @override(from: String!) on FIELD_DEFINITION | ||
|
||
"Used to annotate the expected returned fieldset from a field on a base type that is guaranteed to be selectable by the federation gateway." | ||
directive @provides(fields: FieldSet!) on FIELD_DEFINITION | ||
|
||
"Used to annotate the required input fieldset from a base type for a resolver." | ||
directive @requires(fields: FieldSet!) on FIELD_DEFINITION | ||
|
||
"Indicates that given object and\/or field can be resolved by multiple subgraphs." | ||
directive @shareable repeatable on OBJECT | FIELD_DEFINITION | ||
|
||
"Allows users to annotate fields and types with additional metadata information." | ||
directive @tag(name: String!) on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
|
||
"Scalar representing a set of fields." | ||
scalar FieldSet | ||
|
||
"The _Any scalar is used to pass representations of entities from external services into the root _entities field for execution. Validation of the _Any scalar is done by matching the __typename and @external fields defined in the schema." | ||
scalar _Any |