diff --git a/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/OperationRegistrationInfo.cs b/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/OperationRegistrationInfo.cs index 4e970e5948e..2f7671c4c76 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/OperationRegistrationInfo.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/Inspectors/OperationRegistrationInfo.cs @@ -1,7 +1,9 @@ namespace HotChocolate.Types.Analyzers.Inspectors; -public sealed class OperationRegistrationInfo(string typeName) : ISyntaxInfo +public sealed class OperationRegistrationInfo(OperationType type, string typeName) : ISyntaxInfo { + public OperationType Type { get; } = type; + public string TypeName { get; } = typeName; public bool Equals(OperationRegistrationInfo? other) diff --git a/src/HotChocolate/Core/src/Types.Analyzers/TypeModuleGenerator.cs b/src/HotChocolate/Core/src/Types.Analyzers/TypeModuleGenerator.cs index 51ee560bd2b..821bafedb7e 100644 --- a/src/HotChocolate/Core/src/Types.Analyzers/TypeModuleGenerator.cs +++ b/src/HotChocolate/Core/src/Types.Analyzers/TypeModuleGenerator.cs @@ -163,6 +163,12 @@ private static void WriteConfiguration( ModuleOptions.RegisterTypes) { generator.WriteRegisterTypeExtension(operation.TypeName, false); + + if (operation.Type is not OperationType.No && + (operations & operation.Type) != operation.Type) + { + operations |= operation.Type; + } } break; } @@ -322,7 +328,9 @@ private static void WriteOperationTypes( generator.WriteConfigureMethod(group.Key, group); generator.WriteEndClass(); - syntaxInfos.Add(new OperationRegistrationInfo($"Microsoft.Extensions.DependencyInjection.{typeName}")); + syntaxInfos.Add(new OperationRegistrationInfo( + group.Key, + $"Microsoft.Extensions.DependencyInjection.{typeName}")); } generator.WriteEndNamespace();