diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 25767c5b8..f96928d1e 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -397,24 +397,47 @@ public static Dictionary> ParseJsonCollectionFile(Stream st logger.LogTrace("Parsing the json collection file into a JsonDocument"); using var document = JsonDocument.Parse(stream); var root = document.RootElement; - var itemElement = root.GetProperty("item"); - foreach (var requestObject in itemElement.EnumerateArray().Select(item => item.GetProperty("request"))) - { - // Fetch list of methods and urls from collection, store them in a dictionary - var path = requestObject.GetProperty("url").GetProperty("raw").ToString(); - var method = requestObject.GetProperty("method").ToString(); - if (!requestUrls.ContainsKey(path)) + requestUrls = EnumerateJsonDocument(root, requestUrls); + logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); + + return requestUrls; + } + + private static Dictionary> EnumerateJsonDocument(JsonElement itemElement, Dictionary> paths) + { + var itemsArray = itemElement.GetProperty("item"); + + foreach (var item in itemsArray.EnumerateArray()) + { + if(item.ValueKind == JsonValueKind.Object) { - requestUrls.Add(path, new List { method }); + if(item.TryGetProperty("request", out var request)) + { + // Fetch list of methods and urls from collection, store them in a dictionary + var path = request.GetProperty("url").GetProperty("raw").ToString(); + var method = request.GetProperty("method").ToString(); + if (!paths.ContainsKey(path)) + { + paths.Add(path, new List { method }); + } + else + { + paths[path].Add(method); + } + } + else + { + EnumerateJsonDocument(item, paths); + } } else { - requestUrls[path].Add(method); + EnumerateJsonDocument(item, paths); } } - logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); - return requestUrls; + + return paths; } /// diff --git a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs index 7b9111e4d..11dcaec14 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs @@ -73,23 +73,24 @@ public static class OpenApiFilterService var rootNode = CreateOpenApiUrlTreeNode(sources); // Iterate through urls dictionary and fetch operations for each url - foreach (var path in requestUrls) + foreach (var url in requestUrls) { var serverList = source.Servers; - var url = FormatUrlString(path.Key, serverList); + var path = ExtractPath(url.Key, serverList); - var openApiOperations = GetOpenApiOperations(rootNode, url, apiVersion); + var openApiOperations = GetOpenApiOperations(rootNode, path, apiVersion); if (openApiOperations == null) { + Console.WriteLine($"The url {url.Key} could not be found in the OpenApi description"); continue; } // Add the available ops if they are in the postman collection. See path.Value foreach (var ops in openApiOperations) { - if (path.Value.Contains(ops.Key.ToString().ToUpper())) + if (url.Value.Contains(ops.Key.ToString().ToUpper())) { - operationTypes.Add(ops.Key + url); + operationTypes.Add(ops.Key + path); } } } @@ -322,7 +323,7 @@ private static bool AddReferences(OpenApiComponents newComponents, OpenApiCompon return moreStuff; } - private static string FormatUrlString(string url, IList serverList) + private static string ExtractPath(string url, IList serverList) { var queryPath = string.Empty; foreach (var server in serverList) @@ -333,8 +334,8 @@ private static string FormatUrlString(string url, IList serverLis continue; } - var querySegments = url.Split(new[]{ serverUrl }, StringSplitOptions.None); - queryPath = querySegments[1]; + var urlComponents = url.Split(new[]{ serverUrl }, StringSplitOptions.None); + queryPath = urlComponents[1]; } return queryPath; diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index 16e89bc60..066d20658 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -44,6 +44,12 @@ Always + + Always + + + Always + Always diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 78f8ec048..29cb684d2 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -69,6 +69,23 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() Assert.Equal(3, subsetOpenApiDocument.Paths.Count); } + [Fact] + public void ShouldParseNestedPostmanCollection() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver3.json"); + var fileInput = new FileInfo(filePath); + var stream = fileInput.OpenRead(); + + // Act + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream, _logger); + var pathCount = requestUrls.Count; + + // Assert + Assert.NotNull(requestUrls); + Assert.Equal(30, pathCount); + } + [Fact] public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() { @@ -86,6 +103,28 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() Assert.Equal("The urls in the Postman collection supplied could not be found.", message); } + [Fact] + public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver4.json"); + var fileInput = new FileInfo(filePath); + var stream = fileInput.OpenRead(); + + // Act + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream, _logger); + var pathCount = requestUrls.Count; + var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); + var subsetPathCount = subsetOpenApiDocument.Paths.Count; + + // Assert + Assert.NotNull(subsetOpenApiDocument); + Assert.NotEmpty(subsetOpenApiDocument.Paths); + Assert.Equal(2, subsetPathCount); + Assert.NotEqual(pathCount, subsetPathCount); + } + [Fact] public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArgumentsArePassed() { diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json new file mode 100644 index 000000000..2c7637ed7 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json @@ -0,0 +1,1382 @@ +{ + "info": { + "_postman_id": "6281bdba-62b8-2276-a5d6-268e87f48c89", + "name": "Graph-Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "admin", + "item": [ + { + "name": "/admin", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin" + ] + } + } + }, + { + "name": "/admin", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}", + "microsoft.graph.incidentReport()" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}", + "microsoft.graph.incidentReport()" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.archive", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.archive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.archive" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.favorite", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.favorite", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.favorite" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.markRead", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.markRead", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.markRead" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.markUnread", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.markUnread", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.markUnread" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.unarchive", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.unarchive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.unarchive" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.unfavorite", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.unfavorite", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.unfavorite" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}", + "content" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}", + "content" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachmentsArchive" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachmentsArchive" + ] + } + } + } + ] + }, + { + "name": "agreementAcceptances", + "item": [ + { + "name": "/agreementAcceptances", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances" + ] + } + } + }, + { + "name": "/agreementAcceptances", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances" + ] + } + } + }, + { + "name": "/agreementAcceptances/{agreementAcceptance-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + }, + { + "name": "/agreementAcceptances/{agreementAcceptance-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + }, + { + "name": "/agreementAcceptances/{agreementAcceptance-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + } + ] + }, + { + "name": "appCatalogs", + "item": [ + { + "name": "/appCatalogs", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs" + ] + } + } + }, + { + "name": "/appCatalogs", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}", + "bot" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}", + "bot" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}", + "bot" + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json new file mode 100644 index 000000000..edafeb0bd --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json @@ -0,0 +1,145 @@ +{ + "info": { + "_postman_id": "43402ca3-f018-7c9b-2315-f176d9b171a3", + "name": "Graph-Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "users-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users" + ] + } + } + }, + { + "name": "users-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users" + ] + } + } + }, + { + "name": "/appCatalogs", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs" + ] + } + } + }, + { + "name": "/agreementAcceptances", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances" + ] + } + } + }, + { + "name": "{user-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "{user-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "{user-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + } + ] +} \ No newline at end of file