in src/Microsoft.Health.Dicom.Api/Features/Swagger/ReflectionTypeFilter.cs [71:97]
private static bool IsBuiltInType(Type t)
=> (t.IsPrimitive && t != typeof(IntPtr) && t != typeof(UIntPtr))
|| t == typeof(string)
|| t == typeof(TimeSpan)
|| t == typeof(DateTime)
|| t == typeof(DateTimeOffset)
|| t == typeof(Guid);
private static Type GetExposedType(Type t)
{
// If we're serializing a collection to JSON, it will be represented as a JSON array.
// So the type we're really concerned with is the element type contained in the collection.
if (t.IsArray)
{
t = t.GetElementType();
}
else if (t.IsGenericType && CollectionTypes.Contains(t.GetGenericTypeDefinition()))
{
Type enumerableType = t.GetGenericTypeDefinition() != typeof(IEnumerable<>)
? t.GetInterfaces().Single(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IEnumerable<>))
: t;
t = enumerableType.GetGenericArguments()[0];
}
return t;
}