Skip to content

Commit

Permalink
Register Root Type
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Feb 14, 2024
1 parent 86f58f2 commit f70f076
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f70f076

Please sign in to comment.