Skip to content

Commit 95b2abd

Browse files
authored
Fix issue 6970 repro (#9287)
1 parent 55a6a78 commit 95b2abd

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ public static class Scalars
1717
{ typeof(DateOnly), typeof(LocalDateType) },
1818
{ typeof(DateTime), typeof(DateTimeType) },
1919
{ typeof(DateTimeOffset), typeof(DateTimeType) },
20-
{ typeof(Dictionary<string, object>), typeof(AnyType) },
2120
{ typeof(decimal), typeof(DecimalType) },
2221
{ typeof(double), typeof(FloatType) },
2322
{ typeof(float), typeof(FloatType) },
2423
{ typeof(Guid), typeof(UuidType) },
25-
{ typeof(IDictionary<string, object>), typeof(AnyType) },
2624
{ typeof(int), typeof(IntType) },
27-
{ typeof(IReadOnlyDictionary<string, object>), typeof(AnyType) },
2825
{ typeof(JsonElement), typeof(AnyType) },
2926
{ typeof(long), typeof(LongType) },
3027
{ typeof(object), typeof(AnyType) },

src/HotChocolate/Core/test/Types.Tests/Types/Scalars/Issue6970ReproTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using HotChocolate.Execution;
2+
using HotChocolate.Tests;
23
using Microsoft.Extensions.DependencyInjection;
34

45
namespace HotChocolate.Types;
@@ -8,13 +9,11 @@ public class Issue6970ReproTests
89
[Fact]
910
public async Task Schema_With_IDictionary_String_Object_Output_Field_Builds()
1011
{
11-
var exception = await Record.ExceptionAsync(async () =>
12-
await new ServiceCollection()
13-
.AddGraphQLServer()
14-
.AddQueryType<Query>()
15-
.BuildSchemaAsync());
16-
17-
Assert.Null(exception);
12+
await new ServiceCollection()
13+
.AddGraphQLServer()
14+
.AddQueryType<Query>()
15+
.BuildSchemaAsync()
16+
.MatchSnapshotAsync();
1817
}
1918

2019
public sealed class Query
@@ -24,6 +23,7 @@ public sealed class Query
2423

2524
public sealed class PageVOAllergyIntolerance
2625
{
26+
[GraphQLType<NonNullType<AnyType>>]
2727
public IDictionary<string, object> Extension { get; } =
2828
new Dictionary<string, object>
2929
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
schema {
2+
query: Query
3+
}
4+
5+
type PageVOAllergyIntolerance {
6+
extension: Any!
7+
}
8+
9+
type Query {
10+
item: PageVOAllergyIntolerance!
11+
}
12+
13+
"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
14+
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR
15+
16+
"The `Any` scalar type represents any valid GraphQL value."
17+
scalar Any @specifiedBy(url: "https://scalars.graphql.org/chillicream/any.html")

0 commit comments

Comments
 (0)