Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added failing test for issue #7609 #7756

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/HotChocolate/Core/test/Types.Tests/Types/InterfaceTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PetQuery>()
.AddMutationType<PetMutation>()
.AddType<Dog>()
.AddType<DogInput>()
.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)
Expand Down Expand Up @@ -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<Dog>;
}
Loading