Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Dec 27, 2024
1 parent c45666f commit e837469
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions spec/Section 2 -- Source Schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,10 @@ type Query {
}
```

When a field annotated with `@provides` returns an object, interface or union type that may also be contributed by
other source schemas, this directive declares which of that types subfields
the current source schema can resolve directly.
When a field annotated with `@provides` returns an object, interface or union
type that may also be contributed by other source schemas, this directive
declares which of that types subfields the current source schema can resolve
directly.

```graphql example
{
Expand All @@ -471,9 +472,9 @@ the current source schema can resolve directly.
}
```

If a client tries to fetch the same subfield (`User.email`) through
a different path (e.g., users query field), the source schema will not be able to
resolve it and will throw an error.
If a client tries to fetch the same subfield (`User.email`) through a different
path (e.g., users query field), the source schema will not be able to resolve it
and will throw an error.

```graphql counter-example
{
Expand All @@ -490,8 +491,7 @@ The `@provides` directive may reference multiple fields or nested fields:
```graphql example
type Review {
id: ID!
product: Product
@provides(fields: "sku variation { size }")
product: Product @provides(fields: "sku variation { size }")
}

type Product @key(fields: "sku variation { id }") {
Expand All @@ -506,7 +506,9 @@ type ProductVariation {
}
```

When a field annotated with the provides directive has an abstract return type the fields syntax can leverage inline fragments to express fields that can be resolved locally.
When a field annotated with the provides directive has an abstract return type
the fields syntax can leverage inline fragments to express fields that can be
resolved locally.

```graphql example
type Review {
Expand All @@ -516,8 +518,8 @@ type Review {
product: Product
@provides(
fields: """
... on Book { author }
... on Clothing { size }
... on Book { author }
... on Clothing { size }
"""
)
}
Expand Down

0 comments on commit e837469

Please sign in to comment.