Skip to content

Commit 79b8df9

Browse files
committed
chore: use linq where possible
Signed-off-by: Vincent Biret <[email protected]>
1 parent e29b387 commit 79b8df9

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,10 @@ internal static partial class OpenApiV31Deserializer
197197
{
198198
var list = n.CreateSimpleList((n2, p) => n2.GetScalarValue(), doc);
199199
JsonSchemaType combinedType = 0;
200-
foreach(var type in list)
200+
foreach(var type in list.Where(static t => t is not null))
201201
{
202-
if (type is not null)
203-
{
204-
var schemaType = type.ToJsonSchemaType();
205-
combinedType |= schemaType;
206-
}
202+
var schemaType = type.ToJsonSchemaType();
203+
combinedType |= schemaType;
207204
}
208205
o.Type = combinedType;
209206
}

src/Microsoft.OpenApi/Reader/V32/OpenApiSchemaDeserializer.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,10 @@ internal static partial class OpenApiV32Deserializer
197197
{
198198
var list = n.CreateSimpleList((n2, p) => n2.GetScalarValue(), doc);
199199
JsonSchemaType combinedType = 0;
200-
foreach(var type in list)
200+
foreach(var type in list.Where(static t => t is not null))
201201
{
202-
if (type is not null)
203-
{
204-
var schemaType = type.ToJsonSchemaType();
205-
combinedType |= schemaType;
206-
}
202+
var schemaType = type.ToJsonSchemaType();
203+
combinedType |= schemaType;
207204
}
208205
o.Type = combinedType;
209206
}

0 commit comments

Comments
 (0)