We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b448384 commit ab5f73bCopy full SHA for ab5f73b
1 file changed
src/Microsoft.OpenApi.YamlReader/YamlConverter.cs
@@ -2,6 +2,7 @@
2
using System.Collections.Generic;
3
using System.Globalization;
4
using System.Linq;
5
+using System.Text.Json;
6
using System.Text.Json.Nodes;
7
using SharpYaml;
8
using SharpYaml.Serialization;
@@ -135,7 +136,8 @@ private static YamlScalarNode ToYamlScalar(this JsonValue val)
135
136
{
137
// Try to get the underlying value based on its actual type
138
// First try to get it as a string
- if (val.TryGetValue(out string? stringValue))
139
+ if (val.GetValueKind() == JsonValueKind.String &&
140
+ val.TryGetValue(out string? stringValue))
141
142
// For string values, we need to determine if they should be quoted in YAML
143
// Strings that look like numbers, booleans, or null need to be quoted
0 commit comments