[Feature request]: Support new .NET 8 Model State attributes
bkoelman opened this issue · 4 comments
Is your feature request related to a specific problem? Or an existing feature?
Support for [Length]
was recently added in #2882. There are more Model State attributes in .NET 8 that Swashbuckle could potentially support:
ASP.NET | .NET Types | OpenAPI |
---|---|---|
[Base64String] |
string |
"format": "byte" |
[Range(..., MinimumIsExclusive = true, MaximumIsExclusive = true)] |
int , double , IComparable |
"exclusiveMinimum": true, "exclusiveMaximum": true |
[AllowedValues] |
any (uses object.Equals ) |
anyOf maybe? |
[DeniedValues] |
any (uses object.Equals ) |
pattern maybe? (tricky to get the escaping right) |
Describe the solution you'd like
Please take the entries in the table above into consideration.
Additional context
No response
I am working on it :)
I have doubts regarding AllowedValues.
I think that in the Spec we can see that for AllowedValues this is done with the enum keyWord:
https://swagger.io/docs/specification/describing-parameters/
The DeniedValues could be done with a Regex but I prefer waiting for it to be a built in function, on the OpenApi spec
That's understandable. It highly depends on how the popular client generators and SwaggerUI interpret these constructs. Enum values aren't quoted in the spec, so I wonder how strings containing whitespace would work.
I'm fine with leaving them out, I just listed them for completeness.
Ok then so I am removing the draft from the PR :)