@@ -3416,18 +3416,18 @@ MergeInterfaceTypes(types):
3416
3416
- Let {firstType} be the first type in {types}.
3417
3417
- Let {typeName} be the name of {firstType}.
3418
3418
- Let {description} be the description of {firstType}.
3419
- - Let {fields } be an empty set.
3419
+ - Let {mergedFields } be an empty set.
3420
3420
- For each {type} in {types}:
3421
3421
- If {description} is {null}:
3422
3422
- Set {description} to the description of {type}.
3423
3423
- Let {fieldNames} be the set of all field names in {types}.
3424
3424
- For each {fieldName} in {fieldNames}:
3425
- - Let {field } be the set of fields with the name {fieldName} in {types}.
3426
- - Let {mergedField} be the result of {MergeFieldDefinitions (fields)}.
3425
+ - Let {fields } be the set of fields with the name {fieldName} in {types}.
3426
+ - Let {mergedField} be the result of {MergeOutputFields (fields)}.
3427
3427
- If {mergedField} is not {null}:
3428
- - Add {mergedField} to {fields }.
3428
+ - Add {mergedField} to {mergedFields }.
3429
3429
- Return a new interface type with the name of {typeName}, description of
3430
- {description}, and fields of {fields }.
3430
+ {description}, and fields of {mergedFields }.
3431
3431
3432
3432
** Explanatory Text**
3433
3433
@@ -3450,9 +3450,9 @@ interface has none.
3450
3450
_ Merging Fields_
3451
3451
3452
3452
Each interface contributes its fields. Those fields that share the same name
3453
- across multiple interfaces are reconciled via {MergeFieldDefinitions (fields)}.
3454
- This ensures any differences in type, nullability, or other constraints are
3455
- resolved before appearing in the final interface.
3453
+ across multiple interfaces are reconciled via {MergeOutputFields (fields)}. This
3454
+ ensures any differences in type, nullability, or other constraints are resolved
3455
+ before appearing in the final interface.
3456
3456
3457
3457
By applying these steps, {MergeInterfaceTypes(types)} produces a coherent
3458
3458
interface type definition that reflects the fields from all compatible sources
@@ -3480,7 +3480,7 @@ interface Product {
3480
3480
3481
3481
# Composed Result
3482
3482
3483
- interface Entity {
3483
+ interface Product {
3484
3484
id : ID !
3485
3485
name : String
3486
3486
createdAt : String
@@ -3742,16 +3742,18 @@ MergeInputTypes(types):
3742
3742
- Let {firstType } be the first type in {types}.
3743
3743
- Let {typeName } be the name of {firstType }.
3744
3744
- Let {description } be the description of {firstType }.
3745
- - Let {fields } be an empty set .
3745
+ - Let {mergedFields } be an empty set .
3746
3746
- For each {type } in {types }:
3747
3747
- If {description } is {null }:
3748
3748
- Set {description } to the description of {type }.
3749
3749
- Let {fieldNames } be the set of all field names in {types }.
3750
3750
- For each {fieldName } in {fieldNames }:
3751
- - Let {field } be the set of fields with the name {fieldName } in {types }.
3752
- - Let {mergedField } be the result of {MergeInputField (fields)}.
3751
+ - Let {fields } be the set of fields with the name {fieldName } in {types }.
3752
+ - Let {mergedField } be the result of {MergeInputFields (fields)}.
3753
3753
- If {mergedField } is not {null }:
3754
- - Add {mergedField } to {fields }.
3754
+ - Add {mergedField } to {mergedFields }.
3755
+ - Return a new input object type with the name of {typeName }, description of
3756
+ {description }, fields of {mergedFields }.
3755
3757
3756
3758
**Explanatory Text **
3757
3759
@@ -3776,12 +3778,12 @@ definition has no description.
3776
3778
_Merging Fields_
3777
3779
3778
3780
After filtering out inaccessible types, the algorithm merges each input field
3779
- name found across the remaining types. For each field, { MergeInputField ( fields )}
3780
- is called to reconcile differences in type , nullability , default values , etc ..
3781
- If a merged field ends up being `null ` - for instance , because one of its
3782
- underlying definitions was inaccessible - that field is not included in the
3783
- final definition . The end result is a single input type that correctly unifies
3784
- every compatible field from the various sources .
3781
+ name found across the remaining types. For each field,
3782
+ { MergeInputFields ( fields )} is called to reconcile differences in type ,
3783
+ nullability , default values , etc .. If a merged field ends up being `null ` - for
3784
+ instance , because one of its underlying definitions was inaccessible - that
3785
+ field is not included in the final definition . The end result is a single input
3786
+ type that correctly unifies every compatible field from the various sources .
3785
3787
3786
3788
**Examples **
3787
3789
@@ -3860,21 +3862,23 @@ MergeObjectTypes(types):
3860
3862
- If any {type} in {types } is marked with `@inaccessible `
3861
3863
- Return {null }
3862
3864
- Remove all types marked with `@internal ` from {types }.
3865
+ - If {types } is empty :
3866
+ - Return {null }
3863
3867
- Let {firstType } be the first type in {types}.
3864
3868
- Let {typeName } be the name of {firstType }.
3865
3869
- Let {description } be the description of {firstType }.
3866
- - Let {fields } be an empty set .
3870
+ - Let {mergedFields } be an empty set .
3867
3871
- For each {type } in {types }:
3868
3872
- If {description } is {null }:
3869
3873
- Set {description } to the description of {type }.
3870
3874
- Let {fieldNames } be the set of all field names in {types }.
3871
3875
- For each {fieldName } in {fieldNames }:
3872
- - Let {field } be the set of fields with the name {fieldName } in {types }.
3873
- - Let {mergedField } be the result of {MergeOutputField (fields)}.
3876
+ - Let {fields } be the set of fields with the name {fieldName } in {types }.
3877
+ - Let {mergedField } be the result of {MergeOutputFields (fields)}.
3874
3878
- If {mergedField } is not {null }:
3875
- - Add {mergedField } to {fields }.
3879
+ - Add {mergedField } to {mergedFields }.
3876
3880
- Return a new object type with the name of {typeName }, description of
3877
- {description }, fields of {fields }.
3881
+ {description }, fields of {mergedFields }.
3878
3882
3879
3883
**Explanatory Text **
3880
3884
@@ -3904,8 +3908,8 @@ simply has no description.
3904
3908
_Merging Fields_
3905
3909
3906
3910
All remaining object types contribute their fields. The algorithm gathers every
3907
- field name across these types, then calls {MergeOutputField (fields )} for each
3908
- name to reconcile any differences . If {MergeOutputField (fields)} returns {null }
3911
+ field name across these types, then calls {MergeOutputFields (fields )} for each
3912
+ name to reconcile any differences . If {MergeOutputFields (fields)} returns {null }
3909
3913
(for instance, because a field is marked `@inaccessible`), that field is
3910
3914
excluded from the final object type . The result is a unified set of fields that
3911
3915
reflects each source definition while maintaining compatibility across them .
@@ -4006,11 +4010,11 @@ type Product {
4006
4010
}
4007
4011
```
4008
4012
4009
- #### Merge Output Field
4013
+ #### Merge Output Fields
4010
4014
4011
4015
**Formal Specification **
4012
4016
4013
- MergeOutputField (fields):
4017
+ MergeOutputFields (fields):
4014
4018
4015
4019
- If any {field } in {fields } is marked with `@inaccessible `
4016
4020
- Return {null }
@@ -4022,23 +4026,24 @@ MergeOutputField(fields):
4022
4026
- Let {fieldType } be the type of {firstField}.
4023
4027
- Let {description } be the description of {firstField }.
4024
4028
- For each {field } in {fields }:
4029
+ - Let {type } be the type of {field}.
4025
4030
- Set {fieldType } to be the result of {LeastRestrictiveType (fieldType, type)}.
4026
4031
- If {description } is {null }:
4027
4032
- Let {description } be the description of {field }.
4028
- - Let {arguments } be an empty set .
4033
+ - Let {mergedArguments } be an empty set .
4029
4034
- Let {argumentNames } be the set of all argument names in {fields }.
4030
4035
- For each {argumentName } in {argumentNames }:
4031
4036
- Let {arguments } be the set of arguments with the name {argumentName } in
4032
4037
{fields }.
4033
4038
- Let {mergedArgument } be the result of {MergeArgumentDefinitions (arguments)}.
4034
- - If {mergedArguments } is not {null }:
4035
- - Add {mergedArgument } to {arguments }.
4039
+ - If {mergedArgument } is not {null }:
4040
+ - Add {mergedArgument } to {mergedArguments }.
4036
4041
- Return a new field with the name of {fieldName }, type of {fieldType},
4037
- arguments of {arguments }, and description of {description }.
4042
+ arguments of {mergedArguments }, and description of {description }.
4038
4043
4039
4044
**Explanatory Text **
4040
4045
4041
- The {MergeOutputField (fields)} algorithm is used when multiple fields across
4046
+ The {MergeOutputFields (fields)} algorithm is used when multiple fields across
4042
4047
different object or interface types share the same field name and must be merged
4043
4048
into a single composed field . This algorithm ensures that the final composed
4044
4049
schema has one definitive definition for that field, resolving differences in
@@ -4121,11 +4126,11 @@ type Product {
4121
4126
}
4122
4127
```
4123
4128
4124
- #### Merge Input Field
4129
+ #### Merge Input Fields
4125
4130
4126
4131
**Formal Specification **
4127
4132
4128
- MergeInputField (fields):
4133
+ MergeInputFields (fields):
4129
4134
4130
4135
- If any {field } in {fields } is marked with `@inaccessible `
4131
4136
- Return null
@@ -4136,22 +4141,23 @@ MergeInputField(fields):
4136
4141
- Let {defaultValue } be the default value of {firstField } or undefined if none
4137
4142
exists .
4138
4143
- For each {field } in {fields }:
4144
+ - Let {type } be the type of {field}.
4139
4145
- Set {fieldType } to be the result of {MostRestrictiveType (fieldType, type)}.
4146
+ - If {description } is null :
4147
+ - Let {description } be the description of {field }.
4140
4148
- If {defaultValue } is undefined :
4141
4149
- Set {defaultValue } to the default value of {field } or undefined if none
4142
4150
exists .
4143
- - If {description } is null :
4144
- - Let {description } be the description of {field }.
4145
4151
- Return a new input field with the name of {fieldName }, type of {fieldType},
4146
4152
and description of {description } and default value of {defaultValue }.
4147
4153
4148
4154
**Explanatory Text **
4149
4155
4150
- The {MergeInputField (fields)} algorithm merges multiple input field definitions ,
4151
- all sharing the same field name , into a single composed input field . This
4152
- ensures the final input type in a composed schema maintains a consistent type,
4153
- description, and default value for that field. Below is a breakdown of how
4154
- { MergeInputField (fields )} operates :
4156
+ The {MergeInputFields (fields)} algorithm merges multiple input field
4157
+ definitions , all sharing the same field name , into a single composed input
4158
+ field . This ensures the final input type in a composed schema maintains a
4159
+ consistent type, description, and default value for that field. Below is a
4160
+ breakdown of how { MergeInputFields (fields )} operates :
4155
4161
4156
4162
_Inaccessible Fields_
4157
4163
@@ -4207,7 +4213,7 @@ input OrderFilter {
4207
4213
"""
4208
4214
Filter by the minimum order total
4209
4215
"""
4210
- minTotal : Int = 0
4216
+ minTotal : Int ! = 0
4211
4217
}
4212
4218
```
4213
4219
@@ -4230,7 +4236,7 @@ MergeArgumentDefinitions(arguments):
4230
4236
- For each {argument } in {arguments }:
4231
4237
- If {argument } is marked with `@require `
4232
4238
- Continue
4233
- - Set {mergedArgument } to the result of {MergeArgument (mergedArgument,
4239
+ - Set {mergedArgument } to the result of {MergeArguments (mergedArgument,
4234
4240
argument)}
4235
4241
- Return {mergedArgument }
4236
4242
@@ -4310,11 +4316,11 @@ In the merged schema, the `filter` argument is defined with the most restrictive
4310
4316
type (`ProductFilter!`), includes the description from the original field in
4311
4317
`Schema A`, and is marked as required.
4312
4318
4313
- #### Merge Argument
4319
+ #### Merge Arguments
4314
4320
4315
4321
**Formal Specification**
4316
4322
4317
- MergeArgument (argumentA, argumentB):
4323
+ MergeArguments (argumentA, argumentB):
4318
4324
4319
4325
- Let {typeA} be the type of {argumentA}.
4320
4326
- Let {typeB } be the type of {argumentB}.
@@ -4328,14 +4334,14 @@ MergeArgument(argumentA, argumentB):
4328
4334
- If {defaultValue } is undefined :
4329
4335
- Set {defaultValue } to the default value of {argumentB } or undefined if none
4330
4336
exists .
4331
- - Return a new argument with the name of {argumentA }, type of {type}, and
4332
- description of {description }.
4337
+ - Return a new argument with the name of {argumentA }, type of {type},
4338
+ description of {description }, and default value of { defaultValue } .
4333
4339
4334
4340
**Explanatory Text **
4335
4341
4336
- {MergeArgument (argumentA, argumentB)} takes two arguments with the same name but
4337
- possibly differing in type , description , or default value , and returns a single ,
4338
- unified argument definition .
4342
+ {MergeArguments (argumentA, argumentB)} takes two arguments with the same name
4343
+ but possibly differing in type , description , or default value , and returns a
4344
+ single , unified argument definition .
4339
4345
4340
4346
_Unifying the Type_
4341
4347
0 commit comments