Skip to content

Commit b41ead5

Browse files
committed
Address #630
1 parent 3e06275 commit b41ead5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/GraphQL.Primitives/GraphQLRequest.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
13
namespace GraphQL;
24

35
/// <summary>
@@ -13,6 +15,7 @@ public class GraphQLRequest : Dictionary<string, object>, IEquatable<GraphQLRequ
1315
/// <summary>
1416
/// The Query
1517
/// </summary>
18+
[StringSyntax("GraphQL")]
1619
public string Query
1720
{
1821
get => TryGetValue(QUERY_KEY, out object value) ? (string)value : null;
@@ -48,7 +51,7 @@ public object? Variables
4851

4952
public GraphQLRequest() { }
5053

51-
public GraphQLRequest(string query, object? variables = null, string? operationName = null, Dictionary<string, object?>? extensions = null)
54+
public GraphQLRequest([StringSyntax("GraphQL")] string query, object? variables = null, string? operationName = null, Dictionary<string, object?>? extensions = null)
5255
{
5356
Query = query;
5457
Variables = variables;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#if !NET7_0_OR_GREATER
2+
3+
namespace System.Diagnostics.CodeAnalysis;
4+
5+
/// <summary>
6+
/// Stub
7+
/// </summary>
8+
public sealed class StringSyntaxAttribute : Attribute
9+
{
10+
public const string CompositeFormat = nameof(CompositeFormat);
11+
12+
public StringSyntaxAttribute(string syntax)
13+
{
14+
}
15+
16+
}
17+
#endif

0 commit comments

Comments
 (0)