From bd12e286e86a574b9a2cd075988d55e31ac32b26 Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 22 Nov 2024 15:29:18 +0200 Subject: [PATCH] Added failing test for issue #7609 --- .../Types.Tests/Types/InterfaceTypeTests.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs index d77c9e67109..25d574187c7 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs @@ -758,6 +758,27 @@ public async Task StripLeadingIFromInterface() .MatchSnapshotAsync(); } + [Fact] + public async Task InterfaceType_ReuseImplementingObjectType_InInputType() + { + // arrange + static async Task BuildSchemaAsync() + => await new ServiceCollection() + .AddGraphQL() + .AddQueryType() + .AddMutationType() + .AddType() + .AddType() + .ModifyOptions(o => o.EnableOneOf = true) + .BuildSchemaAsync(); + + // act + var exception = await Record.ExceptionAsync(BuildSchemaAsync); + + // assert + Assert.Null(exception); + } + private sealed class SnakeCaseNamingConventions : DefaultNamingConventions { public override string GetMemberName(MemberInfo member, MemberKind kind) @@ -889,4 +910,20 @@ public class Canine : Pet public class Dog : Canine { } + + public class PetMutation + { + public bool AddPet(PetInput pet) + { + return true; + } + } + + [OneOf] + public class PetInput + { + public Dog Dog { get; set; } + } + + public class DogInput : InputObjectType; }