Skip to content

Commit d19e4c2

Browse files
committed
Support TimeSpans, dictionaries, and forms
1 parent 17e1ffb commit d19e4c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/OpenApi/src/OpenApiSchemaGenerator.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ internal static class OpenApiSchemaGenerator
2424
[typeof(decimal)] = ("number", "double"),
2525
[typeof(DateTime)] = ("string", "date-time"),
2626
[typeof(DateTimeOffset)] = ("string", "date-time"),
27+
[typeof(TimeSpan)] = ("string", "date-span"),
2728
[typeof(Guid)] = ("string", "uuid"),
2829
[typeof(char)] = ("string", null),
2930
[typeof(Uri)] = ("string", "uri"),
@@ -56,7 +57,12 @@ private static (string, string?) GetTypeAndFormatProperties(Type type)
5657
return typeAndFormat;
5758
}
5859

59-
if (type == typeof(IFormFileCollection) || type == typeof(FormFile))
60+
if (type == typeof(IFormFileCollection) || type == typeof(IFormFile))
61+
{
62+
return ("object", null);
63+
}
64+
65+
if (typeof(IDictionary).IsAssignableFrom(type))
6066
{
6167
return ("object", null);
6268
}

0 commit comments

Comments
 (0)