Azure / Azure/azure-functions-openapi-extension
Range Attribute too strictly applied
- Dominant language
- C#
- Stars
- 388
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
I have a model like this:
```csharp
TokenRequestModel {
//Shortened for brevity
[Range(0, int.MaxValue)]
public int? TokenExpirationInMinutes { get; set; }
}
```
When I open the Swagger UI and try to post values like `-1` or `null`, no loading animation is shown and not any request is made. Furthermore, no indication is shown (visually or in the console) that the request could not be made.
I do not think this is expected behaviour, as when I annotate an emailaddress with `[EmailAddress]` I am still able to post wrongly formatted email addresses.
Contributor guide
Research direction
Start by reproducing the TokenRequestModel example in Swagger UI with -1, null, and an invalid email address, then trace where Range validation prevents the request. No file or test is named in the issue; done means the behavior is consistent with the intended validation rules and gives visible feedback when a request cannot be made.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100