Skip to content

Commit 9ae9565

Browse files
committed
fix: add support for casting type array to a flaggable enum
1 parent f9f3a94 commit 9ae9565

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ public static JsonSchemaType ToJsonSchemaType(this string identifier)
7272
};
7373
}
7474

75+
/// <summary>
76+
/// Converts a schema type's identifier into the enum equivalent
77+
/// </summary>
78+
/// <param name="identifier"></param>
79+
/// <returns></returns>
80+
public static JsonSchemaType ToJsonSchemaType(this string[] identifier)
81+
{
82+
JsonSchemaType type = 0;
83+
foreach (var id in identifier)
84+
{
85+
type |= id.ToJsonSchemaType();
86+
}
87+
return type;
88+
}
89+
7590
private static readonly Dictionary<Type, Func<OpenApiSchema>> _simpleTypeToOpenApiSchema = new()
7691
{
7792
[typeof(bool)] = () => new() { Type = JsonSchemaType.Boolean },

0 commit comments

Comments
 (0)