@@ -1100,23 +1100,21 @@ private static (IList<IOpenApiSchema>? effective, JsonSchemaType? inferredType,
11001100 }
11011101 else if ( schema . Enum is { Count : > 0 } )
11021102 {
1103- foreach ( var enumValue in schema . Enum )
1103+ foreach ( var enumValue in schema . Enum . Where ( x => x is not null ) )
11041104 {
1105- if ( enumValue is not null )
1105+ var currentType = enumValue . GetValueKind ( ) switch
11061106 {
1107- var currentType = enumValue . GetValueKind ( ) switch
1108- {
1109- JsonValueKind . Array => JsonSchemaType . Array ,
1110- JsonValueKind . String => JsonSchemaType . String ,
1111- JsonValueKind . Number => JsonSchemaType . Number ,
1112- JsonValueKind . True or JsonValueKind . False => JsonSchemaType . Boolean ,
1113- JsonValueKind . Null => ( JsonSchemaType ) 0 ,
1114- _ => JsonSchemaType . Object ,
1115- } ;
1116-
1117- commonType |= currentType ;
1118- }
1107+ JsonValueKind . Array => JsonSchemaType . Array ,
1108+ JsonValueKind . String => JsonSchemaType . String ,
1109+ JsonValueKind . Number => JsonSchemaType . Number ,
1110+ JsonValueKind . True or JsonValueKind . False => JsonSchemaType . Boolean ,
1111+ JsonValueKind . Null => ( JsonSchemaType ) 0 ,
1112+ _ => JsonSchemaType . Object ,
1113+ } ;
1114+
1115+ commonType |= currentType ;
11191116 }
1117+
11201118 commonType |= JsonSchemaType . String ;
11211119 }
11221120 }
0 commit comments