File tree Expand file tree Collapse file tree
src/FSharp.Data.GraphQL.Shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ module SchemaId =
2121 let private formatByteAsLowerHex ( value : byte ) =
2222 value.ToString( " x2" , System.Globalization.CultureInfo.InvariantCulture)
2323
24+ // Note: UnsafeRelaxedJsonEscaping is used here only for deterministic hashing,
25+ // not for output to untrusted contexts. The JSON is never exposed externally.
2426 let private jsonOptions = JsonSerializerOptions(
2527 WriteIndented = false ,
2628 DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.Never,
@@ -36,6 +38,8 @@ module SchemaId =
3638 let fromIntrospectionSchema ( introspectionSchema : IntrospectionSchema ) =
3739 let json = JsonSerializer.Serialize( introspectionSchema, jsonOptions)
3840 let jsonBytes = Encoding.UTF8.GetBytes json
41+ // Note: Creating SHA256 instance per call is acceptable since schema ID computation
42+ // happens infrequently (typically once per schema during validation cache key creation)
3943 use sha256 = SHA256.Create()
4044 let hash = sha256.ComputeHash jsonBytes
4145 hash
You can’t perform that action at this time.
0 commit comments