File tree 3 files changed +34
-1
lines changed
src/HotChocolate/Fusion-vnext
test/Fusion.Composition.Tests
3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change
1
+ using static HotChocolate . Fusion . WellKnownTypeNames ;
2
+
3
+ namespace HotChocolate . Fusion ;
4
+
5
+ internal static class FusionBuiltIns
6
+ {
7
+ public static bool IsBuiltInSourceSchemaScalar ( string typeName )
8
+ {
9
+ return typeName switch
10
+ {
11
+ FieldSelectionMap or FieldSelectionSet => true ,
12
+ _ => false
13
+ } ;
14
+ }
15
+ }
Original file line number Diff line number Diff line change @@ -574,12 +574,19 @@ .. typeGroup.Where(
574
574
/// <seealso href="https://graphql.github.io/composite-schemas-spec/draft/#sec-Merge-Scalar-Types">
575
575
/// Specification
576
576
/// </seealso>
577
- private MutableScalarTypeDefinition MergeScalarTypes (
577
+ private MutableScalarTypeDefinition ? MergeScalarTypes (
578
578
ImmutableArray < TypeInfo > typeGroup ,
579
579
MutableSchemaDefinition mergedSchema )
580
580
{
581
581
var firstScalar = typeGroup [ 0 ] . Type ;
582
582
var typeName = firstScalar . Name ;
583
+
584
+ // Built-in Fusion scalar types should not be merged.
585
+ if ( FusionBuiltIns . IsBuiltInSourceSchemaScalar ( typeName ) )
586
+ {
587
+ return null ;
588
+ }
589
+
583
590
var description = firstScalar . Description ;
584
591
var scalarType = GetOrCreateType < MutableScalarTypeDefinition > ( mergedSchema , typeName ) ;
585
592
Original file line number Diff line number Diff line change @@ -107,6 +107,17 @@ scalar Date
107
107
@fusion__type(schema: A)
108
108
@fusion__type(schema: B)
109
109
"""
110
+ } ,
111
+ // Built-in Fusion scalar types should not be merged (FieldSelectionSet/Map).
112
+ {
113
+ [
114
+ """
115
+ # Schema A
116
+ directive @provides(fields: FieldSelectionSet!) on FIELD_DEFINITION
117
+ directive @require(field: FieldSelectionMap!) on ARGUMENT_DEFINITION
118
+ """
119
+ ] ,
120
+ ""
110
121
}
111
122
} ;
112
123
}
You can’t perform that action at this time.
0 commit comments