Skip to content

Commit a731be6

Browse files
Update src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs
Co-authored-by: Vincent Biret <[email protected]>
1 parent 3c927e9 commit a731be6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,8 @@ public static Type MapOpenApiPrimitiveTypeToSimpleType(this OpenApiSchema schema
169169
{
170170
throw new ArgumentNullException(nameof(schema));
171171
}
172-
var typeIdentifier = schema.Type.ToIdentifier();
173-
var isNullable = typeIdentifier.Contains("null");
174-
var nonNullable = typeIdentifier.FirstOrDefault(t => t != "null");
172+
var isNullable = (schema.Type & JsonSchemaType.Null) == JsonSchemaType.Null;
173+
var nonNullable = (schema.Type & ~JsonSchemaType.Null).ToIdentifier().FirstOrDefault();
175174

176175
var type = (nonNullable, schema.Format?.ToLowerInvariant(), isNullable) switch
177176
{

0 commit comments

Comments
 (0)