Skip to content

Commit

Permalink
Fix bug that causes the configuration version to go out of enum bound…
Browse files Browse the repository at this point in the history
… when reading from environment.
  • Loading branch information
xIceFox committed Oct 10, 2024
1 parent 877a1db commit 1ddd782
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ public static List<OpenApiServer> GetHostNames()
/// <returns>Returns the OpenAPI version.</returns>
public static OpenApiVersionType GetOpenApiVersion()
{
var version = Enum.TryParse<OpenApiVersionType>(
Environment.GetEnvironmentVariable(OpenApiVersionKey), ignoreCase: true, out var result)
var version = Enum.TryParse<OpenApiVersionType>(Environment.GetEnvironmentVariable(OpenApiVersionKey),
ignoreCase: true, out var result)
&& Enum.IsDefined(typeof(OpenApiVersionType), result)
? result
: DefaultOpenApiVersion();

Expand Down

0 comments on commit 1ddd782

Please sign in to comment.