diff --git a/src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs b/src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs index 0f1f23c93a5..e1773345fc9 100644 --- a/src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs +++ b/src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs @@ -17,13 +17,17 @@ public static class Scalars { typeof(DateOnly), typeof(LocalDateType) }, { typeof(DateTime), typeof(DateTimeType) }, { typeof(DateTimeOffset), typeof(DateTimeType) }, + { typeof(Dictionary), typeof(AnyType) }, { typeof(decimal), typeof(DecimalType) }, { typeof(double), typeof(FloatType) }, { typeof(float), typeof(FloatType) }, { typeof(Guid), typeof(UuidType) }, + { typeof(IDictionary), typeof(AnyType) }, { typeof(int), typeof(IntType) }, + { typeof(IReadOnlyDictionary), typeof(AnyType) }, { typeof(JsonElement), typeof(AnyType) }, { typeof(long), typeof(LongType) }, + { typeof(object), typeof(AnyType) }, { typeof(sbyte), typeof(ByteType) }, { typeof(short), typeof(ShortType) }, { typeof(string), typeof(StringType) }, diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Scalars/Issue6970ReproTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/Scalars/Issue6970ReproTests.cs new file mode 100644 index 00000000000..88ebad4fa0e --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Scalars/Issue6970ReproTests.cs @@ -0,0 +1,33 @@ +using HotChocolate.Execution; +using Microsoft.Extensions.DependencyInjection; + +namespace HotChocolate.Types; + +public class Issue6970ReproTests +{ + [Fact] + public async Task Schema_With_IDictionary_String_Object_Output_Field_Builds() + { + var exception = await Record.ExceptionAsync(async () => + await new ServiceCollection() + .AddGraphQLServer() + .AddQueryType() + .BuildSchemaAsync()); + + Assert.Null(exception); + } + + public sealed class Query + { + public PageVOAllergyIntolerance Item => new(); + } + + public sealed class PageVOAllergyIntolerance + { + public IDictionary Extension { get; } = + new Dictionary + { + ["foo"] = "bar" + }; + } +}