From e3181203ddbd34bc8bb7bd873132651028ef8264 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 1 Sep 2023 09:39:08 +0300 Subject: [PATCH] Final cleanup --- .../OpenApiExtensions/OpenApiEnumFlagsExtension.cs | 5 +---- .../OpenApiExtensions/OpenApiEnumFlagsExtensionTests.cs | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.OData.Reader/OpenApiExtensions/OpenApiEnumFlagsExtension.cs b/src/Microsoft.OpenApi.OData.Reader/OpenApiExtensions/OpenApiEnumFlagsExtension.cs index ef633234..cc8dd86e 100644 --- a/src/Microsoft.OpenApi.OData.Reader/OpenApiExtensions/OpenApiEnumFlagsExtension.cs +++ b/src/Microsoft.OpenApi.OData.Reader/OpenApiExtensions/OpenApiEnumFlagsExtension.cs @@ -35,10 +35,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion) writer.WriteStartObject(); writer.WriteProperty(nameof(IsFlags).ToFirstCharacterLowerCase(), IsFlags); - if(IsFlags)// only write style IsFlags is true - { - writer.WriteProperty(nameof(Style).ToFirstCharacterLowerCase(),string.IsNullOrEmpty(Style) ? "form" : Style);// default to `form` - } + writer.WriteProperty(nameof(Style).ToFirstCharacterLowerCase(),Style); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiEnumFlagsExtensionTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiEnumFlagsExtensionTests.cs index 62217128..e78de144 100644 --- a/test/Microsoft.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiEnumFlagsExtensionTests.cs +++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiEnumFlagsExtensionTests.cs @@ -63,7 +63,7 @@ public void WritesAllDefaultValues() Assert.True(extension.IsFlags); Assert.Null(extension.Style); Assert.Contains("\"isFlags\": true", result); - Assert.Contains("\"style\": \"form\"", result);// writes form for unspecified style. + Assert.DoesNotContain("\"style\":", result); } [Fact]