Skip to content

Commit a06ab0c

Browse files
committed
replace verbose if statement with ternary operator
1 parent 4e0639f commit a06ab0c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,7 @@ internal static void ValidateOpenApiDocument(string input)
204204

205205
private static OpenApiFormat GetOpenApiFormat(string input)
206206
{
207-
if (!input.StartsWith("http") && Path.GetExtension(input) == ".json")
208-
{
209-
return OpenApiFormat.Json;
210-
}
211-
else
212-
{
213-
return OpenApiFormat.Yaml;
214-
}
207+
return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml;
215208
}
216209
}
217210
}

0 commit comments

Comments
 (0)