From 1571457e3cd28e4f23ae5cca4515a077d7d501ae Mon Sep 17 00:00:00 2001 From: hyzx86 Date: Tue, 19 Mar 2024 09:02:03 +0800 Subject: [PATCH] update code --- .../GraphQLNamedQueryRequestJsonConverter.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs index 0f1d1e580b3..3db29857c7d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Json/GraphQLNamedQueryRequestJsonConverter.cs @@ -8,32 +8,32 @@ namespace OrchardCore.Apis.GraphQL.Json; public class GraphQLNamedQueryRequestJsonConverter : JsonConverter { public static readonly GraphQLNamedQueryRequestJsonConverter Instance = new(); - + /// /// Name for the operation name parameter. /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters /// - private const string OperationNameKey = "operationName"; + private const string _operationNameKey = "operationName"; /// /// Name for the query parameter. /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters /// - private const string QueryKey = "query"; + private const string _queryKey = "query"; /// /// Name for the variables parameter. /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters /// - private const string VariablesKey = "variables"; + private const string _variablesKey = "variables"; /// /// Name for the extensions parameter. /// See https://github.com/graphql/graphql-over-http/blob/master/spec/GraphQLOverHTTP.md#request-parameters /// - private const string ExtensionsKey = "extensions"; + private const string _extensionsKey = "extensions"; - private const string NamedQueryKey = "namedQuery"; + private const string _namedQueryKey = "namedQuery"; public override void Write(Utf8JsonWriter writer, GraphQLNamedQueryRequest value, JsonSerializerOptions options) @@ -41,27 +41,27 @@ public override void Write(Utf8JsonWriter writer, GraphQLNamedQueryRequest value writer.WriteStartObject(); if (value.Query != null) { - writer.WritePropertyName(QueryKey); + writer.WritePropertyName(_queryKey); writer.WriteStringValue(value.Query); } if (value.OperationName != null) { - writer.WritePropertyName(OperationNameKey); + writer.WritePropertyName(_operationNameKey); writer.WriteStringValue(value.OperationName); } if (value.Variables != null) { - writer.WritePropertyName(VariablesKey); + writer.WritePropertyName(_variablesKey); JsonSerializer.Serialize(writer, value.Variables, options); } if (value.Extensions != null) { - writer.WritePropertyName(ExtensionsKey); + writer.WritePropertyName(_extensionsKey); JsonSerializer.Serialize(writer, value.Extensions, options); } if (value.NamedQuery != null) { - writer.WritePropertyName(NamedQueryKey); + writer.WritePropertyName(_namedQueryKey); JsonSerializer.Serialize(writer, value.NamedQuery, options); } writer.WriteEndObject(); @@ -94,19 +94,19 @@ public override GraphQLNamedQueryRequest Read(ref Utf8JsonReader reader, Type ty switch (key) { - case QueryKey: + case _queryKey: request.Query = reader.GetString()!; break; - case OperationNameKey: + case _operationNameKey: request.OperationName = reader.GetString()!; break; - case NamedQueryKey: + case _namedQueryKey: request.NamedQuery = reader.GetString(); break; - case VariablesKey: + case _variablesKey: request.Variables = JsonSerializer.Deserialize(ref reader, options); break; - case ExtensionsKey: + case _extensionsKey: request.Extensions = JsonSerializer.Deserialize(ref reader, options); break; default: