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]