Skip to content

Commit

Permalink
chore: code linting
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Feb 4, 2025
1 parent be3c552 commit e0aba68
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,12 @@ public T LoadElement<T>(ParseNode node, OpenApiDocument doc) where T : IOpenApiE
/// <inheritdoc />
public string GetReferenceScalarValues(MapNode mapNode, string scalarValue)
{
if (mapNode.Any(static x => !"$ref".Equals(x.Name, StringComparison.OrdinalIgnoreCase)))
if (mapNode.Any(static x => !"$ref".Equals(x.Name, StringComparison.OrdinalIgnoreCase)) &&
mapNode
.Where(x => x.Name.Equals(scalarValue))
.Select(static x => x.Value)
.OfType<ValueNode>().FirstOrDefault() is {} valueNode)
{
var valueNode = mapNode.Where(x => x.Name.Equals(scalarValue))
.Select(static x => x.Value).OfType<ValueNode>().FirstOrDefault();

return valueNode.GetScalarValue();
}

Expand Down

0 comments on commit e0aba68

Please sign in to comment.