Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow root fields to be colocated. #6890

Merged
merged 5 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading