Skip to content

Commit 3a8f7e2

Browse files
chore: adding nit suggested
1 parent 5267b64 commit 3a8f7e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version
437437
});
438438

439439
// enum
440-
var enumValue = (Enum == null || Enum.Count == 0)
440+
var enumValue = Enum is not { Count: > 0 }
441441
&& !string.IsNullOrEmpty(Const)
442442
&& version < OpenApiSpecVersion.OpenApi3_1
443443
? new List<JsonNode> { JsonValue.Create(Const)! }
@@ -692,7 +692,7 @@ private void SerializeAsV2(
692692
});
693693

694694
// enum
695-
var enumValue = (Enum == null || Enum.Count == 0) && !string.IsNullOrEmpty(Const)
695+
var enumValue = Enum is not { Count: > 0 } && !string.IsNullOrEmpty(Const)
696696
? new List<JsonNode> { JsonValue.Create(Const)! }
697697
: Enum;
698698
writer.WriteOptionalCollection(OpenApiConstants.Enum, enumValue, (nodeWriter, s) => nodeWriter.WriteAny(s));

0 commit comments

Comments
 (0)