From 913a369281139e52cb4d7337aec21dc868995942 Mon Sep 17 00:00:00 2001 From: Husqvik Date: Sat, 4 Feb 2023 21:11:54 +0100 Subject: [PATCH] missing GraphQL value escaping --- src/GraphQlClientGenerator/BaseClasses.cs | 2 +- .../ExpectedSingleFileGenerationContext/FullClientCSharpFile | 2 +- .../ExpectedSingleFileGenerationContext/SourceGeneratorResult | 2 +- .../SourceGeneratorResultWithFileScopedNamespaces | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GraphQlClientGenerator/BaseClasses.cs b/src/GraphQlClientGenerator/BaseClasses.cs index 218c22a..bb71def 100644 --- a/src/GraphQlClientGenerator/BaseClasses.cs +++ b/src/GraphQlClientGenerator/BaseClasses.cs @@ -193,7 +193,7 @@ value is IFormattable formattable if (value is short || value is ushort || value is byte || value is int || value is uint || value is long || value is ulong || value is float || value is double || value is decimal) return Convert.ToString(value, CultureInfo.InvariantCulture); - var argumentValue = Convert.ToString(value, CultureInfo.InvariantCulture); + var argumentValue = EscapeGraphQlStringValue(Convert.ToString(value, CultureInfo.InvariantCulture)); return $"\"{argumentValue}\""; } diff --git a/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/FullClientCSharpFile b/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/FullClientCSharpFile index e9cf87e..4745ba4 100644 --- a/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/FullClientCSharpFile +++ b/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/FullClientCSharpFile @@ -213,7 +213,7 @@ namespace GraphQlGenerator.Test if (value is short || value is ushort || value is byte || value is int || value is uint || value is long || value is ulong || value is float || value is double || value is decimal) return Convert.ToString(value, CultureInfo.InvariantCulture); - var argumentValue = Convert.ToString(value, CultureInfo.InvariantCulture); + var argumentValue = EscapeGraphQlStringValue(Convert.ToString(value, CultureInfo.InvariantCulture)); return $"\"{argumentValue}\""; } diff --git a/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResult b/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResult index 08df461..3682bf1 100644 --- a/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResult +++ b/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResult @@ -213,7 +213,7 @@ namespace SourceGeneratorTestAssembly if (value is short || value is ushort || value is byte || value is int || value is uint || value is long || value is ulong || value is float || value is double || value is decimal) return Convert.ToString(value, CultureInfo.InvariantCulture); - var argumentValue = Convert.ToString(value, CultureInfo.InvariantCulture); + var argumentValue = EscapeGraphQlStringValue(Convert.ToString(value, CultureInfo.InvariantCulture)); return $"\"{argumentValue}\""; } diff --git a/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResultWithFileScopedNamespaces b/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResultWithFileScopedNamespaces index 800e4ae..9dfd0e0 100644 --- a/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResultWithFileScopedNamespaces +++ b/test/GraphQlClientGenerator.Test/ExpectedSingleFileGenerationContext/SourceGeneratorResultWithFileScopedNamespaces @@ -213,7 +213,7 @@ internal static class GraphQlQueryHelper if (value is short || value is ushort || value is byte || value is int || value is uint || value is long || value is ulong || value is float || value is double || value is decimal) return Convert.ToString(value, CultureInfo.InvariantCulture); - var argumentValue = Convert.ToString(value, CultureInfo.InvariantCulture); + var argumentValue = EscapeGraphQlStringValue(Convert.ToString(value, CultureInfo.InvariantCulture)); return $"\"{argumentValue}\""; }