Skip to content

Commit

Permalink
Allow root fields to be colocated. (#6890)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib authored Feb 14, 2024
1 parent 3592a19 commit 8717279
Show file tree
Hide file tree
Showing 28 changed files with 1,474 additions and 932 deletions.
9 changes: 2 additions & 7 deletions src/HotChocolate/Core/src/Abstractions/DataLoaderAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ namespace HotChocolate;
/// types source generator to generate necessary code around this method.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class DataLoaderAttribute : Attribute
public sealed class DataLoaderAttribute(string? name = null) : Attribute
{
public DataLoaderAttribute(string? name = null)
{
Name = name;
}

/// <summary>
/// Gets the name override for the DataLoader or <c>null</c>.
/// </summary>
public string? Name { get; }
public string? Name { get; } = name;

/// <summary>
/// Specifies how services by default are handled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
namespace HotChocolate;

[AttributeUsage(AttributeTargets.Parameter)]
public sealed class EventMessageAttribute
: Attribute
{
}
public sealed class EventMessageAttribute : Attribute;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System;

namespace HotChocolate;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
public sealed class MutationFieldAttribute : Attribute;
6 changes: 6 additions & 0 deletions src/HotChocolate/Core/src/Abstractions/QueryFieldAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System;

namespace HotChocolate;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
public sealed class QueryFieldAttribute : Attribute;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System;

namespace HotChocolate;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
public sealed class SubscriptionFieldAttribute : Attribute;
27 changes: 27 additions & 0 deletions src/HotChocolate/Core/src/Types.Analyzers/Errors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using HotChocolate.Types.Analyzers.Properties;
using Microsoft.CodeAnalysis;

namespace HotChocolate.Types.Analyzers;

public static class Errors
{
public static readonly DiagnosticDescriptor KeyParameterMissing =
new(
id: "HC0074",
title: "Parameter Missing.",
messageFormat:
SourceGenResources.DataLoader_KeyParameterMissing,
category: "DataLoader",
DiagnosticSeverity.Error,
isEnabledByDefault: true);

public static readonly DiagnosticDescriptor MethodAccessModifierInvalid =
new(
id: "HC0075",
title: "Access Modifier Invalid.",
messageFormat:
SourceGenResources.DataLoader_InvalidAccessModifier,
category: "DataLoader",
DiagnosticSeverity.Error,
isEnabledByDefault: true);
}
Loading

0 comments on commit 8717279

Please sign in to comment.