Skip to content

Commit 8db16f9

Browse files
committed
Cleanup
1 parent eb2baed commit 8db16f9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,20 +1017,18 @@ private bool TrySerializeTypeProperty(IOpenApiWriter writer, OpenApiSpecVersion
10171017
return false;
10181018
}
10191019

1020-
var unifiedType = IsNullable ? typeToUse.Value | JsonSchemaType.Null : typeToUse.Value;
1021-
var typeWithoutNull = unifiedType & ~JsonSchemaType.Null;
1022-
10231020
switch (version)
10241021
{
10251022
case OpenApiSpecVersion.OpenApi2_0 or OpenApiSpecVersion.OpenApi3_0:
1023+
var typeWithoutNull = typeToUse.Value & ~JsonSchemaType.Null;
10261024
if (typeWithoutNull != 0 && !HasMultipleTypes(typeWithoutNull))
10271025
{
10281026
writer.WriteProperty(OpenApiConstants.Type, typeWithoutNull.ToFirstIdentifier());
10291027
return true;
10301028
}
10311029
break;
10321030
default:
1033-
WriteUnifiedSchemaType(unifiedType, writer);
1031+
WriteUnifiedSchemaType(IsNullable ? typeToUse.Value | JsonSchemaType.Null : typeToUse.Value, writer);
10341032
return true;
10351033
}
10361034

0 commit comments

Comments
 (0)