@@ -552,13 +552,13 @@ type Query {
552
552
```
553
553
554
554
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 :
556
556
557
557
```graphql counter -example
558
558
# Source schema A
559
559
type Product {
560
- title : String @external
561
- author : Author
560
+ id : ID
561
+ name : String @external
562
562
}
563
563
```
564
564
@@ -4894,8 +4894,8 @@ considering `@inaccessible` annotations, is considered empty and invalid.
4894
4894
4895
4895
**Examples**
4896
4896
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
4899
4899
`@inaccessible ` directive in one of the source schemas:
4900
4900
4901
4901
```graphql
@@ -4907,7 +4907,7 @@ interface Product {
4907
4907
4908
4908
# Schema B
4909
4909
interface Product {
4910
- name : Int
4910
+ name : String
4911
4911
inStock : Boolean
4912
4912
}
4913
4913
```
@@ -4918,15 +4918,14 @@ and it is not required to contain any fields.
4918
4918
4919
4919
```graphql
4920
4920
# Schema A
4921
-
4922
4921
interface Product @inaccessible {
4923
4922
name : String
4924
4923
price : Int
4925
4924
}
4926
4925
4927
4926
# Schema B
4928
4927
interface Product {
4929
- name : Int
4928
+ name : String
4930
4929
inStock : Boolean
4931
4930
}
4932
4931
```
@@ -5430,11 +5429,12 @@ ERROR
5430
5429
- Let {values } be a set of all values in {enumType }.
5431
5430
- {values } must not be empty .
5432
5431
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.
5438
5438
5439
5439
**Examples**
5440
5440
@@ -5624,16 +5624,19 @@ ERROR
5624
5624
- Let {members } be a set of all member types in {unionType }.
5625
5625
- {members } must not be empty .
5626
5626
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 **
5633
5628
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:
5637
5640
5638
5641
```graphql
5639
5642
# Schema A
@@ -5643,9 +5646,21 @@ type User @inaccessible {
5643
5646
id : ID !
5644
5647
}
5645
5648
5649
+ type Product {
5650
+ id : ID !
5651
+ }
5652
+
5646
5653
# Schema B
5647
5654
union SearchResult = Product | Order
5648
5655
5656
+ type Product {
5657
+ id : ID !
5658
+ }
5659
+
5660
+ type Order {
5661
+ id : ID !
5662
+ }
5663
+
5649
5664
# Composite Schema
5650
5665
union SearchResult = Product | Order
5651
5666
```
@@ -5658,8 +5673,24 @@ required to contain any members.
5658
5673
# Schema A
5659
5674
union SearchResult @inaccessible = User | Product
5660
5675
5676
+ type User {
5677
+ id : ID !
5678
+ }
5679
+
5680
+ type Product {
5681
+ id : ID !
5682
+ }
5683
+
5661
5684
# Schema B
5662
5685
union SearchResult = Product | Order
5686
+
5687
+ type Product {
5688
+ id : ID !
5689
+ }
5690
+
5691
+ type Order {
5692
+ id : ID !
5693
+ }
5663
5694
```
5664
5695
5665
5696
This counter -example demonstrates an invalid merged union type . In this case ,
@@ -5670,12 +5701,22 @@ merged union type:
5670
5701
```graphql counter -example
5671
5702
# Schema A
5672
5703
union SearchResult = User | Product
5704
+
5673
5705
type User @inaccessible {
5674
5706
id : ID !
5675
5707
}
5676
5708
5709
+ type Product {
5710
+ id : ID !
5711
+ }
5712
+
5677
5713
# Schema B
5678
5714
union SearchResult = User | Product
5715
+
5716
+ type User {
5717
+ id : ID !
5718
+ }
5719
+
5679
5720
type Product @inaccessible {
5680
5721
id : ID !
5681
5722
}
@@ -5724,8 +5765,8 @@ ValidateSelectionSet(selectionSet, parentType):
5724
5765
5725
5766
Even if the `@provides (fields : " …" )` argument is well -formed syntactically , the
5726
5767
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 references — e .g ., selecting non -existent fields , referencing fields on the
5769
+ wrong type , or incorrectly omitting required nested selections — lead to a
5729
5770
`PROVIDES_INVALID_FIELDS ` error .
5730
5771
5731
5772
**Examples **
0 commit comments