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

Introduce Key Directive #31

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/Section 2 -- Source Schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ extend type Review {
- `coordinate`: Represents a schema coordinate that refers to a type system
member.

### @key

The `@key` directive designates an object type as an entity and specifies its key fields (a set of fields that the _source schema_ can use to uniquely identify any instance of the entity).

```graphql
directive @key(fields: FieldSet!) repeatable on OBJECT | INTERFACE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should also support the semantics for marking type as non-resolvable (used for referencing entities without contributing fields)

In Federation we use optional resolvable: Boolean = true argument to indicate this but we could use different mechanism (different directive?).

```

**Arguments:**

- `fields`: Represents a GraphQL selections set syntax that refers to fields of the annotated type that represent a unique key to resolve the same type.

### @shareable

```graphql
Expand Down