Skip to content

Commit 9d49a8b

Browse files
committed
Replace GetValue<string> with ToString() to correctly parse other primitive types
1 parent 3c944e1 commit 9d49a8b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Microsoft.OpenApi.Readers/ParseNodes/ValueNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public ValueNode(ParsingContext context, JsonNode node) : base(
2222

2323
public override string GetScalarValue()
2424
{
25-
return _node.GetValue<string>();
25+
return _node.GetScalarValue();
2626
}
2727

2828
/// <summary>

src/Microsoft.OpenApi.Readers/ParsingContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ internal OpenApiDocument Parse(JsonNode jsonNode)
8383
/// <summary>
8484
/// Initiates the parsing process of a fragment. Not thread safe and should only be called once on a parsing context
8585
/// </summary>
86-
/// <param name="jsonDocument"></param>
86+
/// <param name="jsonNode"></param>
8787
/// <param name="version">OpenAPI version of the fragment</param>
8888
/// <returns>An OpenApiDocument populated based on the passed yamlDocument </returns>
8989
internal T ParseFragment<T>(JsonNode jsonNode, OpenApiSpecVersion version) where T : IOpenApiElement

src/Microsoft.OpenApi.Readers/YamlHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public static string GetScalarValue(this JsonNode node)
1717
if (node == null)
1818
{
1919
//throw new OpenApiException($"Expected scalar at line {node.Start.Line}");
20-
}
20+
}
2121

22-
return scalarNode?.GetValue<string>();
22+
return scalarNode?.GetScalarValue();
2323
}
2424

2525
public static JsonNode ParseJsonString(string yamlString)

0 commit comments

Comments
 (0)