Azure / Azure/azure-functions-host
Add ability to define route order/priority
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Imagine there are two functions in the same app, both have a GET verb and both have defined routes:
```csharp
[FunctionName("GetRecent")]
public static IActionResult GetRecent(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "items/recent")]HttpRequest req)
{ ... }
[FunctionName("GetItem")]
public static IActionResult Get(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "items/{id}")]HttpRequest req,
string id)
{ ... }
```
As you can see, these routes overlap when `id` equals `recent`. To avoid these issues, ASP.NET MVC would let us define a route order/priority. Azure Functions needs to have this functionality as well.
Workaround: Add constraints to `id` like
```csharp
Route = "items/{id:minlength:10}"
```
or
```csharp
Route = "items/{id:int}"
```
Contributor guide
Research direction
Start with the HTTP trigger route definitions in the issue and inspect how Azure Functions currently resolves overlapping routes. Compare the requested route order or priority with the documented constraint workarounds. Done means overlapping routes have a defined, testable precedence without requiring parameter constraints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100