Skip to content

Commit

Permalink
Address #630
Browse files Browse the repository at this point in the history
  • Loading branch information
lol768 committed Apr 3, 2024
1 parent 3e06275 commit b41ead5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/GraphQL.Primitives/GraphQLRequest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics.CodeAnalysis;

namespace GraphQL;

/// <summary>
Expand All @@ -13,6 +15,7 @@ public class GraphQLRequest : Dictionary<string, object>, IEquatable<GraphQLRequ
/// <summary>
/// The Query
/// </summary>
[StringSyntax("GraphQL")]
public string Query
{
get => TryGetValue(QUERY_KEY, out object value) ? (string)value : null;
Expand Down Expand Up @@ -48,7 +51,7 @@ public object? Variables

public GraphQLRequest() { }

public GraphQLRequest(string query, object? variables = null, string? operationName = null, Dictionary<string, object?>? extensions = null)
public GraphQLRequest([StringSyntax("GraphQL")] string query, object? variables = null, string? operationName = null, Dictionary<string, object?>? extensions = null)
{
Query = query;
Variables = variables;
Expand Down
17 changes: 17 additions & 0 deletions src/GraphQL.Primitives/StringSyntaxAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#if !NET7_0_OR_GREATER

namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Stub
/// </summary>
public sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = nameof(CompositeFormat);

public StringSyntaxAttribute(string syntax)
{
}

}
#endif

0 comments on commit b41ead5

Please sign in to comment.