Skip to content

Commit c703d46

Browse files
committed
Minor corrections (part 5)
1 parent f2b3740 commit c703d46

File tree

1 file changed

+65
-24
lines changed

1 file changed

+65
-24
lines changed

spec/Section 4 -- Composition.md

Lines changed: 65 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,13 @@ type Query {
552552
```
553553

554554
In this example, the `name` field is marked with `@external` but is not used by
555-
the `@provides` directive, violating the rule:
555+
a `@provides` directive, violating the rule:
556556

557557
```graphql counter-example
558558
# Source schema A
559559
type Product {
560-
title: String @external
561-
author: Author
560+
id: ID
561+
name: String @external
562562
}
563563
```
564564

@@ -4894,8 +4894,8 @@ considering `@inaccessible` annotations, is considered empty and invalid.
48944894

48954895
**Examples**
48964896

4897-
In the following example, the merged object type `Author` is valid. It includes
4898-
all fields from both source schemas, with `age` being hidden due to the
4897+
In the following example, the merged object type `Product` is valid. It includes
4898+
all fields from both source schemas, with `price` being hidden due to the
48994899
`@inaccessible` directive in one of the source schemas:
49004900

49014901
```graphql
@@ -4907,7 +4907,7 @@ interface Product {
49074907

49084908
# Schema B
49094909
interface Product {
4910-
name: Int
4910+
name: String
49114911
inStock: Boolean
49124912
}
49134913
```
@@ -4918,15 +4918,14 @@ and it is not required to contain any fields.
49184918

49194919
```graphql
49204920
# Schema A
4921-
49224921
interface Product @inaccessible {
49234922
name: String
49244923
price: Int
49254924
}
49264925

49274926
# Schema B
49284927
interface Product {
4929-
name: Int
4928+
name: String
49304929
inStock: Boolean
49314930
}
49324931
```
@@ -5430,11 +5429,12 @@ ERROR
54305429
- Let {values} be a set of all values in {enumType}.
54315430
- {values} must not be empty.
54325431

5433-
**Explanatory Text** Enum values have to be an exact match across all source
5434-
schemas. If an enum value only exists in one source schema, it has to be marked
5435-
as `@inaccessible`. Enum members that are marked as `@inaccessible` are not
5436-
included in the merged enum type. An enum type with no values is considered
5437-
empty and invalid.
5432+
**Explanatory Text**
5433+
5434+
Enum values have to be an exact match across all source schemas. If an enum
5435+
value only exists in one source schema, it has to be marked as `@inaccessible`.
5436+
Enum members that are marked as `@inaccessible` are not included in the merged
5437+
enum type. An enum type with no values is considered empty and invalid.
54385438

54395439
**Examples**
54405440

@@ -5624,16 +5624,19 @@ ERROR
56245624
- Let {members} be a set of all member types in {unionType}.
56255625
- {members} must not be empty.
56265626

5627-
**Explanatory Text** For union types defined across multiple source schemas, the
5628-
merged union type is the union of all member types defined in these source
5629-
schemas. However, any member type marked with `@inaccessible` in any source
5630-
schema is hidden and not included in the merged union type. A union type with no
5631-
members, after considering `@inaccessible` annotations, is considered empty and
5632-
invalid.
5627+
**Explanatory Text**
56335628

5634-
**Examples** In the following example, the merged union type `SearchResult` is
5635-
valid. It includes all member types from both source schemas, with `User` being
5636-
hidden due to the `@inaccessible` directive in one of the source schemas:
5629+
For union types defined across multiple source schemas, the merged union type is
5630+
the union of all member types defined in these source schemas. However, any
5631+
member type marked with `@inaccessible` in any source schema is hidden and not
5632+
included in the merged union type. A union type with no members, after
5633+
considering `@inaccessible` annotations, is considered empty and invalid.
5634+
5635+
**Examples**
5636+
5637+
In the following example, the merged union type `SearchResult` is valid. It
5638+
includes all member types from both source schemas, with `User` being hidden due
5639+
to the `@inaccessible` directive in one of the source schemas:
56375640

56385641
```graphql
56395642
# Schema A
@@ -5643,9 +5646,21 @@ type User @inaccessible {
56435646
id: ID!
56445647
}
56455648

5649+
type Product {
5650+
id: ID!
5651+
}
5652+
56465653
# Schema B
56475654
union SearchResult = Product | Order
56485655

5656+
type Product {
5657+
id: ID!
5658+
}
5659+
5660+
type Order {
5661+
id: ID!
5662+
}
5663+
56495664
# Composite Schema
56505665
union SearchResult = Product | Order
56515666
```
@@ -5658,8 +5673,24 @@ required to contain any members.
56585673
# Schema A
56595674
union SearchResult @inaccessible = User | Product
56605675

5676+
type User {
5677+
id: ID!
5678+
}
5679+
5680+
type Product {
5681+
id: ID!
5682+
}
5683+
56615684
# Schema B
56625685
union SearchResult = Product | Order
5686+
5687+
type Product {
5688+
id: ID!
5689+
}
5690+
5691+
type Order {
5692+
id: ID!
5693+
}
56635694
```
56645695

56655696
This counter-example demonstrates an invalid merged union type. In this case,
@@ -5670,12 +5701,22 @@ merged union type:
56705701
```graphql counter-example
56715702
# Schema A
56725703
union SearchResult = User | Product
5704+
56735705
type User @inaccessible {
56745706
id: ID!
56755707
}
56765708

5709+
type Product {
5710+
id: ID!
5711+
}
5712+
56775713
# Schema B
56785714
union SearchResult = User | Product
5715+
5716+
type User {
5717+
id: ID!
5718+
}
5719+
56795720
type Product @inaccessible {
56805721
id: ID!
56815722
}
@@ -5724,8 +5765,8 @@ ValidateSelectionSet(selectionSet, parentType):
57245765

57255766
Even if the `@provides(fields: "")` argument is well-formed syntactically, the
57265767
selected fields must actually exist on the return type of the field. Invalid
5727-
field references- e.g., selecting non-existent fields, referencing fields on the
5728-
wrong type, or incorrectly omitting required nested selections-lead to a
5768+
field referencese.g., selecting non-existent fields, referencing fields on the
5769+
wrong type, or incorrectly omitting required nested selectionslead to a
57295770
`PROVIDES_INVALID_FIELDS` error.
57305771

57315772
**Examples**

0 commit comments

Comments
 (0)