You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this issue domaindrivendev/Swashbuckle.AspNetCore#3120 I thought at first of the RangeAttribute to specify the array min/maxLength, but I do not know if it's the right solution for this matter. I have tested with this property:
The issue at hand is that if you set the RangeAttribute over an array of integer then the model validation does not allow you to put any value:
{"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1","title": "One or more validation errors occurred.","status": 400,"errors": {"Array": ["The field Array must be between -1 and 2."]},"traceId": "00-2553c36e9a1043817d97dfe2746bbb9b-1404e652aadda666-00"}
And also the OpenApi spec generated by the package Microsoft.AspNetCore.OpenApi does not put the maximum or minimun over the items and it does it over the schema(It writes):
jgarciadelanoceda
changed the title
Range Attribute to specify a value inside an array max/min lenghts
Range Attribute to specify a value inside an array max/min lengths
Nov 15, 2024
Is there an existing issue for this?
Describe the bug
In this issue domaindrivendev/Swashbuckle.AspNetCore#3120 I thought at first of the RangeAttribute to specify the array min/maxLength, but I do not know if it's the right solution for this matter. I have tested with this property:
The issue at hand is that if you set the RangeAttribute over an array of integer then the model validation does not allow you to put any value:
And also the OpenApi spec generated by the package Microsoft.AspNetCore.OpenApi does not put the maximum or minimun over the items and it does it over the schema(It writes):
And I think it should write:
Expected Behavior
The validation of the Annotation to do not occur and also that the OpenApi spec would be the suggested one
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100
Anything else?
No response
The text was updated successfully, but these errors were encountered: