Skip to content

Commit bf9a481

Browse files
committed
Use backing property to check whether user has explicitly set style, if not, we don't write it out.
1 parent 7637861 commit bf9a481

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Microsoft.OpenApi/Models/OpenApiParameter.cs

Lines changed: 6 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.Collections.Generic;
@@ -238,9 +238,12 @@ public void SerializeAsV3WithoutReference(IOpenApiWriter writer)
238238

239239
// allowEmptyValue
240240
writer.WriteProperty(OpenApiConstants.AllowEmptyValue, AllowEmptyValue, false);
241-
241+
242242
// style
243-
writer.WriteProperty(OpenApiConstants.Style, Style?.GetDisplayName());
243+
if (_style.HasValue)
244+
{
245+
writer.WriteProperty(OpenApiConstants.Style, Style.Value.GetDisplayName());
246+
}
244247

245248
// explode
246249
writer.WriteProperty(OpenApiConstants.Explode, Explode, Style.HasValue && Style.Value == ParameterStyle.Form);

0 commit comments

Comments
 (0)