From 9ffaf1dbd61b0e41829996ae0f49e2eab513957c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 11 May 2022 18:41:06 +0300 Subject: [PATCH 01/19] Update ci-build.yml for Azure Pipelines --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 616776585..345d50af9 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -287,7 +287,7 @@ stages: nuGetFeedType: external publishFeedCredentials: 'OpenAPI Nuget Connection' - task: GitHubRelease@1 - displayName: 'GitHub release (create)' + displayName: 'GitHub release (edit)' inputs: gitHubConnection: 'Github-MaggieKimani1' tagSource: userSpecifiedTag From b83b2cca62a9273c5c40d4e24fad28d7918c2bcb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jun 2022 21:09:52 +0000 Subject: [PATCH 02/19] Bump Verify from 17.1.4 to 17.1.6 Bumps [Verify](https://github.com/VerifyTests/Verify) from 17.1.4 to 17.1.6. - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/compare/17.1.4...17.1.6) --- updated-dependencies: - dependency-name: Verify dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index 60bf287cc..f1694736e 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -20,7 +20,7 @@ - + From bfac4a72b9dd6075f8790e3263ccc85140538151 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Jun 2022 00:55:35 +0000 Subject: [PATCH 03/19] Bump Verify.Xunit from 17.1.4 to 17.1.6 Bumps [Verify.Xunit](https://github.com/VerifyTests/Verify) from 17.1.4 to 17.1.6. - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/compare/17.1.4...17.1.6) --- updated-dependencies: - dependency-name: Verify.Xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index f1694736e..56ac8e941 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -21,7 +21,7 @@ - + all From 673440ef36843caddbfdcb9f26ad0caf5d4c2e46 Mon Sep 17 00:00:00 2001 From: Mustafa Zengin Date: Tue, 28 Jun 2022 23:27:14 -0700 Subject: [PATCH 04/19] remove explicit nuget reference to Verify --- test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index 56ac8e941..a7259e3f8 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -20,7 +20,6 @@ - From ddee0b22fa6ba9b35db78d7a41910a227b2ef622 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 3 Jul 2022 18:38:26 -0400 Subject: [PATCH 05/19] Fixed reading v2 with path parameters that are form data --- .../V2/OpenApiPathItemDeserializer.cs | 55 ++++++++++++++++++- .../Microsoft.OpenApi.Readers.Tests.csproj | 4 ++ .../V2Tests/OpenApiPathItemTests.cs | 23 +++++++- .../pathItemWithFormDataPathParameter.yaml | 41 ++++++++++++++ 4 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithFormDataPathParameter.yaml diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index ba5707480..6134a4bc4 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers.ParseNodes; @@ -32,7 +33,7 @@ internal static partial class OpenApiV2Deserializer { "parameters", (o, n) => { - o.Parameters = n.CreateList(LoadParameter); + LoadPathParameters(o,n); } }, }; @@ -53,5 +54,57 @@ public static OpenApiPathItem LoadPathItem(ParseNode node) return pathItem; } + + private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node) + { + node.Context.SetTempStorage(TempStorageKeys.BodyParameter, null); + node.Context.SetTempStorage(TempStorageKeys.FormParameters, null); + + pathItem.Parameters = node.CreateList(LoadParameter); + + // Build request body based on information determined while parsing OpenApiOperation + var bodyParameter = node.Context.GetFromTempStorage(TempStorageKeys.BodyParameter); + if (bodyParameter != null) + { + var requestBody = CreateRequestBody(node.Context, bodyParameter); + foreach(var opPair in pathItem.Operations) + { + if (opPair.Value.RequestBody == null) + { + switch (opPair.Key) + { + case OperationType.Post: + case OperationType.Put: + case OperationType.Patch: + opPair.Value.RequestBody = requestBody; + break; + } + } + } + } + else + { + var formParameters = node.Context.GetFromTempStorage>(TempStorageKeys.FormParameters); + if (formParameters != null) + { + var requestBody = CreateFormBody(node.Context, formParameters); + foreach (var opPair in pathItem.Operations) + { + if (opPair.Value.RequestBody == null) + { + switch (opPair.Key) + { + case OperationType.Post: + case OperationType.Put: + case OperationType.Patch: + opPair.Value.RequestBody = requestBody; + break; + } + } + } + } + } + + } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj index e1ec38f8f..fda5ed842 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj +++ b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj @@ -14,6 +14,7 @@ + @@ -85,6 +86,9 @@ Never + + Never + Never diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index 5d3331207..ffa788bf2 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using FluentAssertions; using Microsoft.OpenApi.Extensions; @@ -253,10 +254,28 @@ public void ParseBasicPathItemWithFormDataShouldSucceed() } // Act - var operation = OpenApiV2Deserializer.LoadPathItem(node); + var pathItem = OpenApiV2Deserializer.LoadPathItem(node); // Assert - operation.Should().BeEquivalentTo(_basicPathItemWithFormData); + pathItem.Should().BeEquivalentTo(_basicPathItemWithFormData); + } + + [Fact] + public void ParsePathItemWithFormDataPathParameterShouldSucceed() + { + // Arrange + MapNode node; + using (var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "pathItemWithFormDataPathParameter.yaml"))) + { + node = TestHelper.CreateYamlMapNode(stream); + } + + // Act + var pathItem = OpenApiV2Deserializer.LoadPathItem(node); + + // Assert + // FormData parameters at in the path level are pushed into Operation request bodies. + Assert.True(pathItem.Operations.All(o => o.Value.RequestBody != null)); } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithFormDataPathParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithFormDataPathParameter.yaml new file mode 100644 index 000000000..57178b4ba --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithFormDataPathParameter.yaml @@ -0,0 +1,41 @@ +put: + summary: Puts a pet in the store with form data + description: "" + responses: + '200': + description: Pet updated. + '405': + description: Invalid input + x-http-tests: + - parameterValues: + petId: 10 + name: Milo + status: Happy + expectedRequest: + href: /pathitem-form-parameter/10 + headers: + Content-Type: multipart/form-data + content: name=Milo&status=Happy +post: + summary: Posts a pet in the store with form data + description: "" + responses: + '200': + description: Pet updated. +parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: string + - name: name + in: formData + description: Updated name of the pet + required: true + type: string + - name: status + in: formData + description: Updated status of the pet + required: false + type: string From 3dbe5d8040a7c64db0e4c62425c74703f2fc800d Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 4 Jul 2022 09:29:28 -0400 Subject: [PATCH 06/19] Fixed reading v2 with path parameter that is a body --- .../Microsoft.OpenApi.Readers.Tests.csproj | 4 +++ .../V2Tests/OpenApiPathItemTests.cs | 24 +++++++++++++- .../pathItemWithBodyPathParameter.yaml | 31 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithBodyPathParameter.yaml diff --git a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj index fda5ed842..c04eb7fd2 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj +++ b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj @@ -14,6 +14,7 @@ + @@ -89,6 +90,9 @@ Never + + Never + Never diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index ffa788bf2..a11497cdf 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs @@ -275,7 +275,29 @@ public void ParsePathItemWithFormDataPathParameterShouldSucceed() // Assert // FormData parameters at in the path level are pushed into Operation request bodies. - Assert.True(pathItem.Operations.All(o => o.Value.RequestBody != null)); + Assert.True(pathItem.Operations[OperationType.Put].RequestBody != null); + Assert.True(pathItem.Operations[OperationType.Post].RequestBody != null); + Assert.Equal(2, pathItem.Operations.Count(o => o.Value.RequestBody != null)); } + [Fact] + public void ParsePathItemBodyDataPathParameterShouldSucceed() + { + // Arrange + MapNode node; + using (var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "pathItemWithBodyPathParameter.yaml"))) + { + node = TestHelper.CreateYamlMapNode(stream); + } + + // Act + var pathItem = OpenApiV2Deserializer.LoadPathItem(node); + + // Assert + // FormData parameters at in the path level are pushed into Operation request bodies. + Assert.True(pathItem.Operations[OperationType.Put].RequestBody != null); + Assert.True(pathItem.Operations[OperationType.Post].RequestBody != null); + Assert.Equal(2, pathItem.Operations.Count(o => o.Value.RequestBody != null)); + } + } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithBodyPathParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithBodyPathParameter.yaml new file mode 100644 index 000000000..c17f4c54e --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiPathItem/pathItemWithBodyPathParameter.yaml @@ -0,0 +1,31 @@ +put: + summary: Puts a pet in the store with form data + description: "" + responses: + '200': + description: Pet updated. + '405': + description: Invalid input +post: + summary: Posts a pet in the store with form data + description: "" + responses: + '200': + description: Pet updated. +parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: string + - name: name + in: body + description: Updated pet body + required: true + type: object + properties: + name: + type: string + status: + type: string \ No newline at end of file From ea83688677d3c54e2ff3fcc9389187e2e10593db Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 4 Jul 2022 15:18:39 -0400 Subject: [PATCH 07/19] Update src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs Co-authored-by: Vincent Biret --- src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index 6134a4bc4..b04eae319 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -88,7 +88,7 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node) if (formParameters != null) { var requestBody = CreateFormBody(node.Context, formParameters); - foreach (var opPair in pathItem.Operations) + foreach (var opPair in pathItem.Operations.Where(x => x.Value.RequestBody is null)) { if (opPair.Value.RequestBody == null) { From 364952b423861b6b79d04efbf92de858ee0f7e4d Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 4 Jul 2022 15:19:11 -0400 Subject: [PATCH 08/19] Update src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs Co-authored-by: Vincent Biret --- .../V2/OpenApiPathItemDeserializer.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index b04eae319..4828f541d 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -90,16 +90,13 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node) var requestBody = CreateFormBody(node.Context, formParameters); foreach (var opPair in pathItem.Operations.Where(x => x.Value.RequestBody is null)) { - if (opPair.Value.RequestBody == null) + switch (opPair.Key) { - switch (opPair.Key) - { - case OperationType.Post: - case OperationType.Put: - case OperationType.Patch: - opPair.Value.RequestBody = requestBody; - break; - } + case OperationType.Post: + case OperationType.Put: + case OperationType.Patch: + opPair.Value.RequestBody = requestBody; + break; } } } From bbb6ae068240922755cce73fccef744ef244453d Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 4 Jul 2022 15:19:36 -0400 Subject: [PATCH 09/19] Update src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs Co-authored-by: Vincent Biret --- .../V2/OpenApiPathItemDeserializer.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index 4828f541d..64252571f 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -69,16 +69,13 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node) var requestBody = CreateRequestBody(node.Context, bodyParameter); foreach(var opPair in pathItem.Operations) { - if (opPair.Value.RequestBody == null) + switch (opPair.Key) { - switch (opPair.Key) - { - case OperationType.Post: - case OperationType.Put: - case OperationType.Patch: - opPair.Value.RequestBody = requestBody; - break; - } + case OperationType.Post: + case OperationType.Put: + case OperationType.Patch: + opPair.Value.RequestBody = requestBody; + break; } } } From 8d28c5a587b36a0f63b3c8b7013c95b7c7f1cb30 Mon Sep 17 00:00:00 2001 From: Darrel Date: Mon, 4 Jul 2022 15:20:04 -0400 Subject: [PATCH 10/19] Update src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs Co-authored-by: Vincent Biret --- src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index 64252571f..a2179b31f 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -67,7 +67,7 @@ private static void LoadPathParameters(OpenApiPathItem pathItem, ParseNode node) if (bodyParameter != null) { var requestBody = CreateRequestBody(node.Context, bodyParameter); - foreach(var opPair in pathItem.Operations) + foreach(var opPair in pathItem.Operations.Where(x => x.Value.RequestBody is null)) { switch (opPair.Key) { From d4b2c7bd3701c67f3f58048fd13d920850598f9c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Jul 2022 15:23:06 -0400 Subject: [PATCH 11/19] - adds missing using for linq --- src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index a2179b31f..d905ea42e 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System.Collections.Generic; +using System.Linq; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers.ParseNodes; From b6b71b750cda88e29dcdb2629d30f17259a97ba2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Jul 2022 21:19:14 +0000 Subject: [PATCH 12/19] Bump Verify.Xunit from 17.1.6 to 17.2.1 Bumps [Verify.Xunit](https://github.com/VerifyTests/Verify) from 17.1.6 to 17.2.1. - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/commits) --- updated-dependencies: - dependency-name: Verify.Xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index a7259e3f8..9e1cb4f75 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -20,7 +20,7 @@ - + all From 45d7ab1b765cee7376565a858dba00d2ba4cbd0d Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 4 Jul 2022 19:00:09 -0400 Subject: [PATCH 13/19] Added fix to handle case where produces or consumes is explicitly set as an empty array --- .../V2/OpenApiDocumentDeserializer.cs | 17 ++++++++++++++--- .../V2/OpenApiOperationDeserializer.cs | 19 +++++++++++++------ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs index 6302eaf84..02e868412 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs @@ -36,11 +36,22 @@ internal static partial class OpenApiV2Deserializer }, { "consumes", - (o, n) => n.Context.SetTempStorage(TempStorageKeys.GlobalConsumes, n.CreateSimpleList(s => s.GetScalarValue())) + (o, n) => { + var consumes = n.CreateSimpleList(s => s.GetScalarValue()); + if (consumes.Count > 0) + { + n.Context.SetTempStorage(TempStorageKeys.GlobalConsumes, consumes); + } + } }, { - "produces", - (o, n) => n.Context.SetTempStorage(TempStorageKeys.GlobalProduces, n.CreateSimpleList(s => s.GetScalarValue())) + "produces", (o, n) => { + var produces = n.CreateSimpleList(s => s.GetScalarValue()); + if (produces.Count > 0) + { + n.Context.SetTempStorage(TempStorageKeys.GlobalProduces, produces); + } + } }, {"paths", (o, n) => o.Paths = LoadPaths(n)}, { diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs index 45d076370..f9a6357f8 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using System.Xml.Schema; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; @@ -57,14 +58,20 @@ internal static partial class OpenApiV2Deserializer } }, { - "consumes", (o, n) => n.Context.SetTempStorage( - TempStorageKeys.OperationConsumes, - n.CreateSimpleList(s => s.GetScalarValue())) + "consumes", (o, n) => { + var consumes = n.CreateSimpleList(s => s.GetScalarValue()); + if (consumes.Count > 0) { + n.Context.SetTempStorage(TempStorageKeys.OperationConsumes,consumes); + } + } }, { - "produces", (o, n) => n.Context.SetTempStorage( - TempStorageKeys.OperationProduces, - n.CreateSimpleList(s => s.GetScalarValue())) + "produces", (o, n) => { + var produces = n.CreateSimpleList(s => s.GetScalarValue()); + if (produces.Count > 0) { + n.Context.SetTempStorage(TempStorageKeys.OperationProduces, produces); + } + } }, { "responses", (o, n) => From ccbf9eba3431e4c28e1f3de6989f7ea983e2baa8 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 6 Jul 2022 12:55:20 +0300 Subject: [PATCH 14/19] Updates csproj release notes to point to Github release notes --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f885e8d6f..27bf00b5b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -20,11 +20,7 @@ © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - -- Bumps up the Microsoft.OpenAPI library to v1.3.2 -- Bumps up the Microsoft.OData library to v7.12.0 -- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview3 - + https://github.com/microsoft/OpenAPI.NET/releases/tag/1.3.3 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi true From 99c384f56ca54253e3b12101587c705f8e212a1c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 6 Jul 2022 08:21:59 -0400 Subject: [PATCH 15/19] - releases hidi with discriminator fix Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f885e8d6f..c5d6562aa 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,15 +15,13 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview6 + 1.0.0-preview7 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET -- Bumps up the Microsoft.OpenAPI library to v1.3.2 -- Bumps up the Microsoft.OData library to v7.12.0 -- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview3 +- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview4 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi @@ -47,7 +45,7 @@ - + From 1e83b7424944269b0a582674c1a28ee59c62e9e7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 6 Jul 2022 08:27:16 -0400 Subject: [PATCH 16/19] - adds code owner configuration to the repository Signed-off-by: Vincent Biret --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..7cb46ae19 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @irvinesunday @darrelmiller @peombwa @zengin @baywet @millicentachieng @MaggieKimani1 From 6cf6f511c6b295b3aa2b35d987fbf9621660588b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 6 Jul 2022 08:45:04 -0400 Subject: [PATCH 17/19] - review suggestions Co-authored-by: Millicent Achieng --- src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs index f9a6357f8..a3bda05e1 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using System.Xml.Schema; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; From 404be88345e3ce519fc89ad5c6ce863fc3fdaf96 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 6 Jul 2022 15:47:03 +0300 Subject: [PATCH 18/19] Add a Github release notes link to csproj --- .../Microsoft.OpenApi.Readers.csproj | 4 +--- src/Microsoft.OpenApi/Microsoft.OpenApi.csproj | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj index 8835b373c..3009dc24f 100644 --- a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj +++ b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj @@ -15,9 +15,7 @@ © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - -- Fixed a bug where contact information would not read properly. #892 - + https://github.com/microsoft/OpenAPI.NET/releases/tag/1.3.3 Microsoft.OpenApi.Readers Microsoft.OpenApi.Readers true diff --git a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj index 980265e98..e78dd9fee 100644 --- a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj +++ b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj @@ -16,9 +16,7 @@ © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - -- Adds support for c-style hex notation strings. #908 - + https://github.com/microsoft/OpenAPI.NET/releases/tag/1.3.3 Microsoft.OpenApi Microsoft.OpenApi true From f07f345acefb73f1f2c9ae69a213fe86f0a6541d Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 6 Jul 2022 16:03:00 +0300 Subject: [PATCH 19/19] Clean up --- src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj | 2 +- src/Microsoft.OpenApi/Microsoft.OpenApi.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj index 3009dc24f..e9d3ba283 100644 --- a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj +++ b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj @@ -15,7 +15,7 @@ © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - https://github.com/microsoft/OpenAPI.NET/releases/tag/1.3.3 + https://github.com/microsoft/OpenAPI.NET/releases Microsoft.OpenApi.Readers Microsoft.OpenApi.Readers true diff --git a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj index e78dd9fee..933b2bdb2 100644 --- a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj +++ b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj @@ -16,7 +16,7 @@ © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - https://github.com/microsoft/OpenAPI.NET/releases/tag/1.3.3 + https://github.com/microsoft/OpenAPI.NET/releases Microsoft.OpenApi Microsoft.OpenApi true