Skip to content

Commit

Permalink
fix(cli): use UnsafeRelaxedJsonEscaping during json serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
NextFire committed Jul 17, 2024
1 parent 8c1bb0c commit 3606ca0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Criteo.OpenApi.Comparator.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -120,7 +121,8 @@ private static void DisplayOutput(IEnumerable<ComparisonMessage> differences, Ou
var serializerOptions = new JsonSerializerOptions
{
WriteIndented = true,
Converters = { new JsonStringEnumConverter() }
Converters = { new JsonStringEnumConverter() },
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};
Console.WriteLine(JsonSerializer.Serialize(differences, serializerOptions));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Criteo.OpenApi.Comparator.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Text.Encodings.Web;

namespace Criteo.OpenApi.Comparator.UTest;

Expand All @@ -30,7 +31,8 @@ public class OpenApiSpecificationsCompareTests
private static readonly JsonSerializerOptions serializerOptions = new()
{
WriteIndented = true,
Converters = { new JsonStringEnumConverter() }
Converters = { new JsonStringEnumConverter() },
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
};

[TestCaseSource(nameof(TestCases))]
Expand Down

0 comments on commit 3606ca0

Please sign in to comment.