public static List ToOpenApiIntegerCollection()

in src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/TypeExtensions.cs [266:296]


        public static List<IOpenApiAny> ToOpenApiIntegerCollection(this Type type)
        {
            if (!type.IsUnflaggedEnumType())
            {
                return null;
            }

            var values = Enum.GetValues(type);
            if (type.GetEnumUnderlyingType() == typeof(short))
            {
                return values.Cast<short>()
                             .Select(p => (IOpenApiAny)new OpenApiInteger(p))
                             .ToList();
            }

            if (type.GetEnumUnderlyingType() == typeof(int))
            {
                return values.Cast<int>()
                             .Select(p => (IOpenApiAny)new OpenApiInteger(p))
                             .ToList();
            }

            if (type.GetEnumUnderlyingType() == typeof(long))
            {
                return values.Cast<long>()
                             .Select(p => (IOpenApiAny)new OpenApiLong(p))
                             .ToList();
            }

            return null;
        }