Skip to content

Commit bf2d0fe

Browse files
committed
Only add the available operations types if they are present in the postman collection
1 parent d0312ac commit bf2d0fe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Microsoft.OpenApi/Services/OpenApiFilterService.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -84,16 +84,20 @@ public static class OpenApiFilterService
8484
continue;
8585
}
8686

87+
// Add the available ops if they are in the postman collection. See path.Value
8788
foreach (var ops in openApiOperations)
8889
{
89-
operationTypes.Add(ops.Key + url);
90+
if (path.Value.Contains(ops.Key.ToString().ToUpper()))
91+
{
92+
operationTypes.Add(ops.Key + url);
93+
}
9094
}
9195
}
9296
}
9397

9498
if (!operationTypes.Any())
9599
{
96-
throw new ArgumentException("The urls in the postman collection supplied could not be found.");
100+
throw new ArgumentException("The urls in the Postman collection supplied could not be found.");
97101
}
98102

99103
// predicate for matching url and operationTypes

0 commit comments

Comments
 (0)