Skip to content

Commit abed394

Browse files
Copilotxperiandri
andcommitted
Ensure deterministic JSON serialization and use lowercase hex for Unicode escapes
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/ce0fba11-9043-452f-b948-e03c8b644f26 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent db49c4f commit abed394

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/FSharp.Data.GraphQL.Shared/AstExtensions.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ type Document with
118118
| '\r' -> "\\r"
119119
| '\t' -> "\\t"
120120
| c when c < '\u0020' ->
121-
let hex = (int c).ToString("X4", CultureInfo.InvariantCulture)
121+
let hex = (int c).ToString("x4", CultureInfo.InvariantCulture)
122122
"\\u" + hex
123123
| c -> string c
124124
escaped.Append(appendStr) |> ignore

src/FSharp.Data.GraphQL.Shared/ValidationResultCache.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ module SchemaId =
2323

2424
let private jsonOptions = JsonSerializerOptions(
2525
WriteIndented = false,
26-
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.Never
26+
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.Never,
27+
PropertyNamingPolicy = null,
28+
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
2729
)
2830

2931
/// <summary>

0 commit comments

Comments
 (0)