Skip to content

Commit 038a356

Browse files
peombwabaywet
andauthored
Apply is operation suggestion.
Co-authored-by: Vincent Biret <[email protected]>
1 parent 15b4c75 commit 038a356

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ internal static class OpenApiExtensibleExtensions
1414
/// <returns>A <see cref="string"/> value matching the provided extensionKey. Return null when extensionKey is not found. </returns>
1515
public static string GetExtension(this IDictionary<string, IOpenApiExtension> extensions, string extensionKey)
1616
{
17-
string extensionValue = null;
18-
if (extensions.TryGetValue(extensionKey, out var value) && value != null)
17+
if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiString castValue)
1918
{
20-
extensionValue = (value as OpenApiString)?.Value;
19+
return castValue.Value;
2120
}
22-
return extensionValue;
21+
return default;
2322
}
2423
}
2524
}

0 commit comments

Comments
 (0)