Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v2 directive to spec code block #1865

Merged
merged 2 commits into from
Jul 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions docs/source/federation-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,23 @@ Federated services will need to implement the following additions to the schema
```graphql
scalar _Any
scalar _FieldSet
scalar link__Import

# a union of all types that use the @key directive
union _Entity

enum link__Purpose {
"""
`SECURITY` features provide metadata necessary to securely resolve fields.
"""
SECURITY

"""
`EXECUTION` features provide metadata necessary for operation execution.
"""
EXECUTION
}

type _Service {
sdl: String
}
Expand All @@ -37,7 +50,11 @@ extend type Query {
directive @external on FIELD_DEFINITION
directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
directive @key(fields: _FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA
directive @shareable on OBJECT | FIELD_DEFINITION
directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
directive @override(from: String!) on FIELD_DEFINITION

# this is an optional directive discussed below
directive @extends on OBJECT | INTERFACE
Expand Down Expand Up @@ -228,7 +245,7 @@ A new field must be added to the query root called `_entities`. This field must
### `@key`

```graphql
directive @key(fields: _FieldSet!) repeatable on OBJECT | INTERFACE
directive @key(fields: _FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
```

The `@key` directive is used to indicate a combination of fields that can be used to uniquely identify and fetch an object or interface.
Expand Down Expand Up @@ -393,4 +410,4 @@ type User @key(fields: "id") {
id: ID!
name: String @override(from: "SubgraphA")
}
```
```