Skip to content

Commit

Permalink
Remove extend keyword to make examples less confusing.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed May 2, 2024
1 parent 5766888 commit a5d8a5e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions spec/Section 2 -- Source Schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ resolved with the `personById` field or the `personByName` field on the `Query`
type. Both fields can resolve the same entity but do so with different keys.

```graphql example
extend type Query {
type Query {
version: Int # NOT a lookup field.
personById(id: ID!): Person @lookup
personByName(name: String!): Person @lookup
}

extend type Person @key(fields "id") @key(fields "name") {
type Person @key(fields "id") @key(fields "name") {
id: ID!
name: String!
}
Expand All @@ -39,7 +39,7 @@ The arguments of a lookup field must correspond to fields specified by a `@key`
directive annotated on the return type of the lookup field.

```graphql example
extend type Query {
type Query {
node(id: ID!): Node @lookup
}

Expand All @@ -54,18 +54,18 @@ considered entities and must have keys that correspond with the fields argument
signature.

```graphql example
extend type Query {
type Query {
entityById(id: ID!, categoryId: Int): Entity @lookup
}

union Entity = Cat | Dog

extend type Dog @key(fields "id categoryId") {
type Dog @key(fields "id categoryId") {
id: ID!
categoryId: Int
}

extend type Cat @key(fields "id categoryId") {
type Cat @key(fields "id categoryId") {
id: ID!
categoryId: Int
}
Expand All @@ -75,18 +75,18 @@ The following example shows an invalid lookup field as the `Cat` type does not
declare a key that corresponds with the lookup fields argument signature.

```graphql counter-example
extend type Query {
type Query {
entityById(id: ID!, categoryId: Int): Entity @lookup
}

union Entity = Cat | Dog

extend type Dog @key(fields "id categoryId") {
type Dog @key(fields "id categoryId") {
id: ID!
categoryId: Int
}

extend type Cat @key(fields "id") {
type Cat @key(fields "id") {
id: ID!
}
```
Expand All @@ -105,15 +105,15 @@ Query type, they must be accessible via fields that do not require arguments,
starting from the Query root type.

```graphql example
extend type Query {
type Query {
lookups: Lookups!
}

type Lookups {
personById(id: ID!): Person @lookup
}

extend type Person @key(fields "id") {
type Person @key(fields "id") {
id: ID!
}
```
Expand Down

0 comments on commit a5d8a5e

Please sign in to comment.