Open brettveenstra opened 8 years ago
That's a good catch and honestly I can't remember why I restricted to integer's. It seems like the maximum and minimum fields on the Schema
class could be changed - "object" seems to be the most appropriate type.
However, I'm not understanding your point around enum's. I can't see where maximum / minimum are being used for enum's. I think the two are mutually exclusive.
It's also worth noting that right now, I'm putting most of my energy into the next generation of SB (6.0.0) that targets AspNet Core. I'll definitely get this fixed for that version. I do plan on making one or two more releases for the 5.x line, addressing critical fixes / feature requests, but I'm not sure if this fits that bill. Perhaps a PR (with tests included) would help :)
I think the Enum listing I was referring to was: https://github.com/domaindrivendev/Swashbuckle/blob/fd2a7e9e9f01a3fa1ad4403c5a5d4b6f5c54f0b4/Swashbuckle.Tests/Swagger/SchemaTests.cs#L55
I'll have to find my edits again for more specifics. As I remember, it wasn't until I tried to work it out in the existing tests that the Enum problem occurred and I was confused how to proceed.
Will this add support for setting min/max values for parameters of long type as well.
/* snip */
if (swaggerParam is NonBodyParameter)
{
((NonBodyParameter)swaggerParam).Minimum = long.MinValue;
((NonBodyParameter)swaggerParam).Maximum = long.MaxValue;
}
/* snip */
Inside
SchemaExtensions
, theRangeAttribute
handling only supportsint
values (range.OperandType == typeof(int)
) so have to useint
for all Range declarations which is limiting.Tried to implement a fix but
Schema
class is also usingmaximum
andminimum
for Enum listing so modifying the type for those fields is not straightforward ... perhaps one of the following:SchemaExtensions
, a workaround at least but not very robustCan you advise a workaround or how to separate handling of the Enum and RangeAttributes?