We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5d9330 commit 6ce3214Copy full SHA for 6ce3214
src/Microsoft.OpenApi/JsonNullSentinel.cs
@@ -33,9 +33,9 @@ public static class JsonNullSentinel
33
public static bool IsJsonNullSentinel(this JsonNode? node)
34
{
35
return node == SentinelJsonValue ||
36
- node is JsonValue jsonValue &&
37
- jsonValue.GetValueKind() == JsonValueKind.String &&
38
- jsonValue.TryGetValue<string>(out var value) &&
39
- SentinelValue.Equals(value, StringComparison.Ordinal);
+ node is not null &&
+ node.GetValueKind() == JsonValueKind.String &&
+ // using deep equals here results in fewer allocations than TryGetValue
+ JsonNode.DeepEquals(SentinelJsonValue, node);
40
}
41
0 commit comments