diff --git a/src/HotChocolate/Core/test/Types.Tests/CodeFirstTests.cs b/src/HotChocolate/Core/test/Types.Tests/CodeFirstTests.cs index 482bf451913..39a6dfcf5b4 100644 --- a/src/HotChocolate/Core/test/Types.Tests/CodeFirstTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/CodeFirstTests.cs @@ -149,6 +149,17 @@ public async Task Structural_Equality_Is_Ignored() schema.MatchSnapshot(); } + [Fact] + public async Task Comparison_Is_Ignored() + { + var schema = + await new ServiceCollection() + .AddGraphQL() + .AddQueryType() + .BuildSchemaAsync(); + + schema.MatchSnapshot(); + } [Fact] public async Task Allow_PascalCasedArguments_Schema() @@ -320,10 +331,10 @@ public interface IBar public class QueryStructEquals { - public Example Foo(Example example) => example; + public EquatableExample Foo(EquatableExample example) => example; } - public class Example : IStructuralEquatable + public class EquatableExample : IStructuralEquatable { public string Some { get; set; } = default!; @@ -332,6 +343,26 @@ public class Example : IStructuralEquatable public int GetHashCode(IEqualityComparer comparer) => throw new NotImplementedException(); } + public class QueryComparableEntity + { + public ComparableExample Foo(ComparableExample example) => example; + } + + public class ComparableExample : IComparable, IComparable + { + public string Some { get; set; } = default!; + + public int CompareTo(object? obj) + { + throw new NotImplementedException(); + } + + public int CompareTo(EquatableExample? other) + { + throw new NotImplementedException(); + } + } + public class PascalCaseQuery { public string TestResolver(string TestArgument) => "abc"; diff --git a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Comparison_Is_Ignored.graphql b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Comparison_Is_Ignored.graphql new file mode 100644 index 00000000000..4e9a06d546c --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Comparison_Is_Ignored.graphql @@ -0,0 +1,15 @@ +schema { + query: QueryComparableEntity +} + +type ComparableExample { + some: String! +} + +type QueryComparableEntity { + foo(example: ComparableExampleInput!): ComparableExample! +} + +input ComparableExampleInput { + some: String! +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Structural_Equality_Is_Ignored.graphql b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Structural_Equality_Is_Ignored.graphql index fd98e7b95b8..e7cd2134282 100644 --- a/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Structural_Equality_Is_Ignored.graphql +++ b/src/HotChocolate/Core/test/Types.Tests/__snapshots__/CodeFirstTests.Structural_Equality_Is_Ignored.graphql @@ -2,14 +2,14 @@ schema { query: QueryStructEquals } -type Example { +type EquatableExample { some: String! } type QueryStructEquals { - foo(example: ExampleInput!): Example! + foo(example: EquatableExampleInput!): EquatableExample! } -input ExampleInput { +input EquatableExampleInput { some: String! } \ No newline at end of file