-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleAttributes.cs
More file actions
49 lines (43 loc) · 1.73 KB
/
ModuleAttributes.cs
File metadata and controls
49 lines (43 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using HotChocolate.Execution.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Modulight.Modules.Server.GraphQL
{
/// <summary>
/// Specifies the object types for GraphQL server.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class GraphQLModuleTypeAttribute : Attribute
{
/// <summary>
/// Specifies the object types for GraphQL server.
/// </summary>
/// <param name="schemaName">Schema name.</param>
/// <param name="queryType">Query type.</param>
public GraphQLModuleTypeAttribute(string schemaName, Type queryType)
{
SchemaName = schemaName;
Endpoint = $"/graphql/{SchemaName}";
QueryType = queryType;
}
/// <summary>
/// Schema name.
/// </summary>
public string SchemaName { get; }
/// <summary>
/// Endpoint (default as /graphql/<see cref="SchemaName"/>).
/// </summary>
public string Endpoint { get; init; }
/// <summary>
/// Query type for <see cref="SchemaRequestExecutorBuilderExtensions.AddQueryType(IRequestExecutorBuilder, Type)"/>.
/// </summary>
public Type? QueryType { get; }
/// <summary>
/// Mutation type for <see cref="SchemaRequestExecutorBuilderExtensions.AddMutationType(IRequestExecutorBuilder, Type)"/>.
/// </summary>
public Type? MutationType { get; init; }
/// <summary>
/// Subscription type for <see cref="SchemaRequestExecutorBuilderExtensions.AddSubscriptionType(IRequestExecutorBuilder, Type)"/>.
/// </summary>
public Type? SubscriptionType { get; init; }
}
}