Skip to content

Commit bc87d1e

Browse files
committed
Code refactoring
1 parent af25fe4 commit bc87d1e

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -314,20 +314,26 @@ private static Dictionary<string, List<string>> Enumerate(JsonElement itemElemen
314314

315315
foreach (var item in itemsArray.EnumerateArray())
316316
{
317-
if (item.TryGetProperty("request", out var request))
317+
if(item.ValueKind == JsonValueKind.Object)
318318
{
319-
// Fetch list of methods and urls from collection, store them in a dictionary
320-
var path = request.GetProperty("url").GetProperty("raw").ToString();
321-
var method = request.GetProperty("method").ToString();
322-
323-
if (!paths.ContainsKey(path))
324-
{
325-
paths.Add(path, new List<string> { method });
326-
}
327-
else
328-
{
329-
paths[path].Add(method);
330-
}
319+
if(item.TryGetProperty("request", out var request))
320+
{
321+
// Fetch list of methods and urls from collection, store them in a dictionary
322+
var path = request.GetProperty("url").GetProperty("raw").ToString();
323+
var method = request.GetProperty("method").ToString();
324+
if (!paths.ContainsKey(path))
325+
{
326+
paths.Add(path, new List<string> { method });
327+
}
328+
else
329+
{
330+
paths[path].Add(method);
331+
}
332+
}
333+
else
334+
{
335+
Enumerate(item, paths);
336+
}
331337
}
332338
else
333339
{

0 commit comments

Comments
 (0)