From fdeaa2c5dc3dd927c36a98f4e9beef19298555b2 Mon Sep 17 00:00:00 2001 From: Jordan Phillips Date: Tue, 7 Jul 2026 12:55:54 +1000 Subject: [PATCH 1/4] fix: flags enums not recognized on source-generator resolver methods --- .../Helpers/TypeReferenceBuilder.cs | 28 ++++++++ .../Types.Analyzers/WellKnownAttributes.cs | 1 + .../FlagsEnumMethodBindingProbe.cs | 36 ++++++++++ .../FlagsEnumMethodBindingTests.cs | 71 +++++++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs create mode 100644 src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs index b18135c9d79..219c57be811 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs @@ -174,6 +174,16 @@ private static (string TypeStructure, string TypeDefinition, string? Nullability } var typeName = GetFullyQualifiedTypeName(underlyingType); + + if (IsFlagsEnumType(underlyingType)) + { + return ( + string.Empty, + typeName, + CreateNullabilityLiteral(underlyingType, isNullable), + IsSimpleType: true); + } + var compliantTypeName = MakeGraphQLCompliant(typeName); var nullability = ShouldPreserveNullability(underlyingType) ? CreateNullabilityLiteral(underlyingType, isNullable) @@ -328,6 +338,24 @@ private static bool IsArrayType(ITypeSymbol namedType, [NotNullWhen(true)] out I return false; } + private static bool IsFlagsEnumType(ITypeSymbol typeSymbol) + { + if (typeSymbol.TypeKind != TypeKind.Enum) + { + return false; + } + + foreach (var attribute in typeSymbol.GetAttributes()) + { + if (attribute.AttributeClass?.ToDisplayString() == WellKnownAttributes.FlagsAttribute) + { + return true; + } + } + + return false; + } + private static bool TryGetListElementType( INamedTypeSymbol namedType, [NotNullWhen(true)] out ITypeSymbol? elementType) diff --git a/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs b/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs index 28208bd4833..e2efaccae0c 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/WellKnownAttributes.cs @@ -38,6 +38,7 @@ public static class WellKnownAttributes public const string DescriptorAttribute = "HotChocolate.Types.DescriptorAttribute"; public const string GraphQLDeprecatedAttribute = "HotChocolate.GraphQLDeprecatedAttribute"; public const string ObsoleteAttribute = "System.ObsoleteAttribute"; + public const string FlagsAttribute = "System.FlagsAttribute"; public const string BatchResolverAttribute = "HotChocolate.Types.BatchResolverAttribute"; public const string GraphQLTypeAttribute = "HotChocolate.GraphQLTypeAttribute"; public const string IsSelectedAttribute = "HotChocolate.Types.IsSelectedAttribute"; diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs new file mode 100644 index 00000000000..4ab7b4798f7 --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs @@ -0,0 +1,36 @@ +namespace HotChocolate.Types; + +[Flags] +public enum AnimalKind +{ + Dog = 1, + Cat = 2 +} + +public class Animal +{ + public required string Id { get; set; } + + public required AnimalKind Kind { get; set; } +} + +public class Zoo +{ + public required string Id { get; set; } +} + +[ObjectType] +public static partial class ZooType +{ + public static AnimalKind GetAnimals([Parent] Zoo zoo) + => AnimalKind.Dog | AnimalKind.Cat; +} + +public static partial class Query +{ + public static Animal GetAnimal() + => new() { Id = "1", Kind = AnimalKind.Dog | AnimalKind.Cat }; + + public static Zoo GetZoo() + => new() { Id = "1" }; +} diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs new file mode 100644 index 00000000000..9f708bcc919 --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs @@ -0,0 +1,71 @@ +using HotChocolate.Execution; +using Microsoft.Extensions.DependencyInjection; + +namespace HotChocolate.Types; + +public class FlagsEnumMethodBindingTests +{ + [Fact] + public async Task FlagsEnum_Should_CoerceToFlagsObject_When_ReturnedFromPropertyBoundField() + { + // arrange + var executor = await new ServiceCollection() + .AddGraphQLServer() + .AddIntegrationTestTypes() + .AddPagingArguments() + .ModifyOptions(o => o.EnableFlagEnums = true) + .BuildRequestExecutorAsync(cancellationToken: TestContext.Current.CancellationToken); + + // act + var result = await executor.ExecuteAsync( + "{ animal { kind { isDog isCat } } }", + TestContext.Current.CancellationToken); + + // assert + result.MatchInlineSnapshot( + """ + { + "data": { + "animal": { + "kind": { + "isDog": true, + "isCat": true + } + } + } + } + """); + } + + [Fact] + public async Task FlagsEnum_Should_CoerceToFlagsObject_When_ReturnedFromMethodBoundField() + { + // arrange + var executor = await new ServiceCollection() + .AddGraphQLServer() + .AddIntegrationTestTypes() + .AddPagingArguments() + .ModifyOptions(o => o.EnableFlagEnums = true) + .BuildRequestExecutorAsync(cancellationToken: TestContext.Current.CancellationToken); + + // act + var result = await executor.ExecuteAsync( + "{ zoo { animals { isDog isCat } } }", + TestContext.Current.CancellationToken); + + // assert + result.MatchInlineSnapshot( + """ + { + "data": { + "zoo": { + "animals": { + "isDog": true, + "isCat": true + } + } + } + } + """); + } +} From ef9f3ac1dda28df29e6704f0e1ee5ed31601e292 Mon Sep 17 00:00:00 2001 From: Jordan Phillips Date: Fri, 10 Jul 2026 17:48:00 +1000 Subject: [PATCH 2/4] test: update snapshots --- .../IntegrationTests.Schema_Snapshot.snap | 17 +++++++++++++++++ ...apshot_Without_ConnectionName_Inference.snap | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap index d7146718e61..e11e16a026a 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap @@ -59,6 +59,8 @@ type Query { requireOneSlicingArgument: false ) @cost(weight: "10") + animal: Animal! + zoo: Zoo! isSelectedTest: IsSelectedNode! """ Gets the product. @@ -161,6 +163,11 @@ type Subscription { onProductPriceChanged(productId: Int!): Int! @cost(weight: "10") } +type Animal { + id: String! + kind: AnimalKind! +} + type Author { books( "Returns the first _n_ elements from the list." @@ -391,6 +398,11 @@ type Television implements Product { kind: String! } +type Zoo { + animals: AnimalKind! + id: String! +} + "The node interface is implemented by entities that have a global unique identifier." interface Node { id: ID! @@ -406,6 +418,11 @@ input ShapeInput { name: String! } +enum AnimalKind { + DOG + CAT +} + scalar Version scalar Version2 diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap index 477a35b15b9..94fba334b38 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap @@ -39,6 +39,8 @@ type Query { "Returns the elements in the list that come before the specified cursor." before: String ): PublisherConnection + animal: Animal! + zoo: Zoo! isSelectedTest: IsSelectedNode! """ Gets the product. @@ -112,6 +114,11 @@ type Subscription { onProductPriceChanged(productId: Int!): Int! } +type Animal { + id: String! + kind: AnimalKind! +} + type Author { books( "Returns the first _n_ elements from the list." @@ -290,6 +297,11 @@ type Television implements Product { kind: String! } +type Zoo { + animals: AnimalKind! + id: String! +} + "The node interface is implemented by entities that have a global unique identifier." interface Node { id: ID! @@ -305,6 +317,11 @@ input ShapeInput { name: String! } +enum AnimalKind { + DOG + CAT +} + scalar Version scalar Version2 From bf55ec3077560c323e6b09b1f11739e7a899c5d4 Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Sat, 11 Jul 2026 08:03:22 +0200 Subject: [PATCH 3/4] Handle generated flags enum type shapes --- .../Helpers/TypeReferenceBuilder.cs | 53 +++++-- .../FlagsEnumMethodBindingProbe.cs | 56 ++++++- .../FlagsEnumMethodBindingTests.cs | 149 ++++++++++++++++++ .../IntegrationTests.Schema_Snapshot.snap | 18 +++ ...shot_Without_ConnectionName_Inference.snap | 18 +++ 5 files changed, 280 insertions(+), 14 deletions(-) diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs index 219c57be811..ab7098b8418 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Helpers/TypeReferenceBuilder.cs @@ -82,6 +82,15 @@ public static SchemaTypeReference CreateTypeReference( unwrapped = UnwrapListElementType(unwrapped) ?? unwrapped; } + var flagsAttribute = compilation.GetTypeByMetadataName(WellKnownAttributes.FlagsAttribute); + if (flagsAttribute is not null && ContainsFlagsEnum(unwrapped, flagsAttribute)) + { + return new SchemaTypeReference( + SchemaTypeReferenceKind.ExtendedTypeReference, + GetFullyQualifiedTypeName(unwrapped), + nullability: CreateNullabilityLiteral(unwrapped, IsNullable(unwrapped))); + } + // Next, we create a key that describes the type and ensures we are only executing the type factory once. var (typeStructure, typeDefinition, nullability, isSimpleType) = CreateTypeKey(unwrapped); @@ -174,16 +183,6 @@ private static (string TypeStructure, string TypeDefinition, string? Nullability } var typeName = GetFullyQualifiedTypeName(underlyingType); - - if (IsFlagsEnumType(underlyingType)) - { - return ( - string.Empty, - typeName, - CreateNullabilityLiteral(underlyingType, isNullable), - IsSimpleType: true); - } - var compliantTypeName = MakeGraphQLCompliant(typeName); var nullability = ShouldPreserveNullability(underlyingType) ? CreateNullabilityLiteral(underlyingType, isNullable) @@ -230,6 +229,15 @@ private static void CollectNullability( { flags.Add(isNullable ? "true" : "false"); + if (typeSymbol is IArrayTypeSymbol arrayType) + { + CollectNullability( + arrayType.ElementType, + IsNullable(arrayType.ElementType), + flags); + return; + } + if (typeSymbol is not INamedTypeSymbol namedType || !namedType.IsGenericType) { return; @@ -338,16 +346,35 @@ private static bool IsArrayType(ITypeSymbol namedType, [NotNullWhen(true)] out I return false; } - private static bool IsFlagsEnumType(ITypeSymbol typeSymbol) + private static bool ContainsFlagsEnum( + ITypeSymbol typeSymbol, + INamedTypeSymbol flagsAttribute) { - if (typeSymbol.TypeKind != TypeKind.Enum) + if (typeSymbol is INamedTypeSymbol nullableType + && nullableType.OriginalDefinition.SpecialType is SpecialType.System_Nullable_T) + { + return ContainsFlagsEnum(nullableType.TypeArguments[0], flagsAttribute); + } + + if (typeSymbol is IArrayTypeSymbol arrayType) + { + return ContainsFlagsEnum(arrayType.ElementType, flagsAttribute); + } + + if (typeSymbol is INamedTypeSymbol namedType + && TryGetListElementType(namedType, out var elementType)) + { + return ContainsFlagsEnum(elementType, flagsAttribute); + } + + if (typeSymbol.TypeKind is not TypeKind.Enum) { return false; } foreach (var attribute in typeSymbol.GetAttributes()) { - if (attribute.AttributeClass?.ToDisplayString() == WellKnownAttributes.FlagsAttribute) + if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, flagsAttribute)) { return true; } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs index 4ab7b4798f7..e0e71656085 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs @@ -1,12 +1,25 @@ +using SystemFlags = System.FlagsAttribute; + namespace HotChocolate.Types; -[Flags] +[SystemFlags] public enum AnimalKind { Dog = 1, Cat = 2 } +[Flags] +public enum FauxFlagsKind +{ + First = 1, + Second = 2 +} + +public sealed class FlagsAttribute : Attribute +{ +} + public class Animal { public required string Id { get; set; } @@ -22,8 +35,40 @@ public class Zoo [ObjectType] public static partial class ZooType { + public static AnimalKind PropertyAnimals + => AnimalKind.Dog | AnimalKind.Cat; + public static AnimalKind GetAnimals([Parent] Zoo zoo) => AnimalKind.Dog | AnimalKind.Cat; + + public static AnimalKind? GetNullableAnimals([Parent] Zoo zoo) + => null; + + public static Task GetTaskAnimalsAsync([Parent] Zoo zoo) + => Task.FromResult(AnimalKind.Dog | AnimalKind.Cat); + + public static ValueTask GetValueTaskAnimalsAsync([Parent] Zoo zoo) + => ValueTask.FromResult(AnimalKind.Dog | AnimalKind.Cat); + + public static AnimalKind?[]? GetAnimalArray([Parent] Zoo zoo) + => [AnimalKind.Dog | AnimalKind.Cat, null]; + + public static List GetAnimalList([Parent] Zoo zoo) + => [AnimalKind.Dog | AnimalKind.Cat]; + + public static List> GetNestedAnimalList([Parent] Zoo zoo) + => [[AnimalKind.Dog | AnimalKind.Cat]]; + + public static Task> GetTaskAnimalListAsync([Parent] Zoo zoo) + => Task.FromResult>([AnimalKind.Dog | AnimalKind.Cat]); + + [BatchResolver] + public static ValueTask> GetBatchAnimalsAsync([Parent] List zoos) + => ValueTask.FromResult>( + zoos.Select(_ => AnimalKind.Dog | AnimalKind.Cat).ToList()); + + public static FauxFlagsKind GetFauxFlags([Parent] Zoo zoo) + => FauxFlagsKind.First; } public static partial class Query @@ -33,4 +78,13 @@ public static Animal GetAnimal() public static Zoo GetZoo() => new() { Id = "1" }; + + public static string FormatAnimalKinds(AnimalKind kinds) + => kinds.ToString(); + + public static string FormatNullableAnimalKinds(AnimalKind? kinds) + => kinds?.ToString() ?? "null"; + + public static string FormatAnimalKindList(List kinds) + => string.Join(",", kinds.Select(t => t?.ToString() ?? "null")); } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs index 9f708bcc919..72c0fb4fab6 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingTests.cs @@ -68,4 +68,153 @@ public async Task FlagsEnum_Should_CoerceToFlagsObject_When_ReturnedFromMethodBo } """); } + + [Fact] + public async Task FlagsEnum_Should_PreserveWrappers_When_ReturnedFromMethodBoundFields() + { + var executor = await new ServiceCollection() + .AddGraphQLServer() + .AddIntegrationTestTypes() + .AddPagingArguments() + .ModifyOptions(o => o.EnableFlagEnums = true) + .BuildRequestExecutorAsync(cancellationToken: TestContext.Current.CancellationToken); + + var result = await executor.ExecuteAsync( + """ + { + zoo { + propertyAnimals { + isDog + isCat + } + nullableAnimals { + isDog + isCat + } + taskAnimals { + isDog + isCat + } + valueTaskAnimals { + isDog + isCat + } + animalArray { + isDog + isCat + } + animalList { + isDog + isCat + } + nestedAnimalList { + isDog + isCat + } + taskAnimalList { + isDog + isCat + } + batchAnimals { + isDog + isCat + } + fauxFlags + } + } + """, + TestContext.Current.CancellationToken); + + result.MatchInlineSnapshot( + """ + { + "data": { + "zoo": { + "propertyAnimals": { + "isDog": true, + "isCat": true + }, + "nullableAnimals": null, + "taskAnimals": { + "isDog": true, + "isCat": true + }, + "valueTaskAnimals": { + "isDog": true, + "isCat": true + }, + "animalArray": [ + { + "isDog": true, + "isCat": true + }, + null + ], + "animalList": [ + { + "isDog": true, + "isCat": true + } + ], + "nestedAnimalList": [ + [ + { + "isDog": true, + "isCat": true + } + ] + ], + "taskAnimalList": [ + { + "isDog": true, + "isCat": true + } + ], + "batchAnimals": { + "isDog": true, + "isCat": true + }, + "fauxFlags": "FIRST" + } + } + } + """); + } + + [Fact] + public async Task FlagsEnum_Should_CoerceInput_When_UsedByGeneratedResolverMethods() + { + var executor = await new ServiceCollection() + .AddGraphQLServer() + .AddIntegrationTestTypes() + .AddPagingArguments() + .ModifyOptions(o => o.EnableFlagEnums = true) + .BuildRequestExecutorAsync(cancellationToken: TestContext.Current.CancellationToken); + + var result = await executor.ExecuteAsync( + """ + { + formatAnimalKinds(kinds: { isDog: true, isCat: true }) + formatNullableAnimalKinds + formatAnimalKindList( + kinds: [ + { isDog: true, isCat: false } + null + { isDog: false, isCat: true } + ]) + } + """, + TestContext.Current.CancellationToken); + + result.MatchInlineSnapshot( + """ + { + "data": { + "formatAnimalKinds": "Dog, Cat", + "formatNullableAnimalKinds": "null", + "formatAnimalKindList": "Dog,null,Cat" + } + } + """); + } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap index e11e16a026a..27ae96676e8 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot.snap @@ -61,6 +61,9 @@ type Query { @cost(weight: "10") animal: Animal! zoo: Zoo! + formatAnimalKinds(kinds: AnimalKind!): String! + formatNullableAnimalKinds(kinds: AnimalKind): String! + formatAnimalKindList(kinds: [AnimalKind]!): String! isSelectedTest: IsSelectedNode! """ Gets the product. @@ -399,7 +402,17 @@ type Television implements Product { } type Zoo { + propertyAnimals: AnimalKind! animals: AnimalKind! + nullableAnimals: AnimalKind + taskAnimals: AnimalKind! @cost(weight: "10") + valueTaskAnimals: AnimalKind! @cost(weight: "10") + animalArray: [AnimalKind] + animalList: [AnimalKind!]! + nestedAnimalList: [[AnimalKind!]!]! + taskAnimalList: [AnimalKind!]! @cost(weight: "10") + batchAnimals: AnimalKind! @cost(weight: "10") + fauxFlags: FauxFlagsKind! id: String! } @@ -423,6 +436,11 @@ enum AnimalKind { CAT } +enum FauxFlagsKind { + FIRST + SECOND +} + scalar Version scalar Version2 diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap index 94fba334b38..19cea87e0e8 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/__snapshots__/IntegrationTests.Schema_Snapshot_Without_ConnectionName_Inference.snap @@ -41,6 +41,9 @@ type Query { ): PublisherConnection animal: Animal! zoo: Zoo! + formatAnimalKinds(kinds: AnimalKind!): String! + formatNullableAnimalKinds(kinds: AnimalKind): String! + formatAnimalKindList(kinds: [AnimalKind]!): String! isSelectedTest: IsSelectedNode! """ Gets the product. @@ -298,7 +301,17 @@ type Television implements Product { } type Zoo { + propertyAnimals: AnimalKind! animals: AnimalKind! + nullableAnimals: AnimalKind + taskAnimals: AnimalKind! + valueTaskAnimals: AnimalKind! + animalArray: [AnimalKind] + animalList: [AnimalKind!]! + nestedAnimalList: [[AnimalKind!]!]! + taskAnimalList: [AnimalKind!]! + batchAnimals: AnimalKind! + fauxFlags: FauxFlagsKind! id: String! } @@ -322,6 +335,11 @@ enum AnimalKind { CAT } +enum FauxFlagsKind { + FIRST + SECOND +} + scalar Version scalar Version2 From 8b2dbe52d434b35328273608a4b8371391b33dcc Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Sat, 11 Jul 2026 08:46:37 +0200 Subject: [PATCH 4/4] Fix flags probe analyzer warnings --- .../FlagsEnumMethodBindingProbe.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs index e0e71656085..b760ad4ee27 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Integration.Tests/FlagsEnumMethodBindingProbe.cs @@ -16,9 +16,8 @@ public enum FauxFlagsKind Second = 2 } -public sealed class FlagsAttribute : Attribute -{ -} +[AttributeUsage(AttributeTargets.Enum)] +public sealed class FlagsAttribute : Attribute; public class Animal {