File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
test/Types.Tests/Configuration Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,8 @@ public void Register(RegisteredType registeredType)
162
162
_nameRefs . Add ( typeDef . Name , registeredType . References [ 0 ] ) ;
163
163
}
164
164
else if ( registeredType . Kind == TypeKind . Scalar &&
165
- registeredType . Type is ScalarType scalar )
165
+ registeredType . Type is ScalarType scalar &&
166
+ ! _nameRefs . ContainsKey ( scalar . Name ) )
166
167
{
167
168
_nameRefs . Add ( scalar . Name , registeredType . References [ 0 ] ) ;
168
169
}
Original file line number Diff line number Diff line change @@ -54,6 +54,19 @@ public void InferInputTypeWithComputedProperty()
54
54
. MatchSnapshot ( ) ;
55
55
}
56
56
57
+ [ Fact ]
58
+ public void Custom_LocalDate_Should_Throw_SchemaException_When_Not_Bound ( )
59
+ {
60
+ static void Act ( ) =>
61
+ SchemaBuilder . New ( )
62
+ . AddQueryType < QueryTypeWithCustomLocalDate > ( )
63
+ . Create ( ) ;
64
+
65
+ Assert . Equal (
66
+ "The name `LocalDate` was already registered by another type." ,
67
+ Assert . Throws < SchemaException > ( Act ) . Errors [ 0 ] . Message ) ;
68
+ }
69
+
57
70
public class QueryWithDateTime
58
71
{
59
72
public DateTimeOffset DateTimeOffset ( DateTimeOffset time ) => time ;
@@ -153,4 +166,14 @@ public class QueryTypeWithComputedProperty
153
166
{
154
167
public int Foo ( InputTypeWithReadOnlyProperties arg ) => arg . Property1 ;
155
168
}
169
+
170
+ public class QueryTypeWithCustomLocalDate
171
+ {
172
+ public LocalDate Foo ( ) => new ( ) ;
173
+ }
174
+
175
+ public class LocalDate
176
+ {
177
+ public DateOnly Date { get ; set ; } = new ( ) ;
178
+ }
156
179
}
You can’t perform that action at this time.
0 commit comments