Azure / Azure/azure-functions-core-tools

Convention-based FunctionName & HttpTrigger Routes

Open
#257 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

To enable MVC-like conventions within functions, I wish:

there was a parameter-less version of the FunctionNameAttribute that would default the name to:
`$"{typeof().Namespace}.{nameof()}"`

the HttpTriggerAttribute Route property was optional and would default to:
`$"{typeof().Namespace}.{nameof()}".Replace('.', '/');`

The goal would be so that these two would produce the same result.

![image](https://user-images.githubusercontent.com/1781802/30878138-c7d709f2-a2b0-11e7-905f-76352ac54fc0.png)

![image](https://user-images.githubusercontent.com/1781802/30878161-dbbea02e-a2b0-11e7-97b0-9c591bbbc3b9.png)

Note: I think the snippets above might need more logic. For example, I'd prefer to not include the first namespace if there is more than one (eg: "Service" from the screenshot above). The first namespace is often just the solution name or something that you don't necessarily want reflected in the route.

Contributor guide

Open the contributing guide

Research direction

Start with the FunctionNameAttribute and HttpTriggerAttribute behavior described in the issue, including how namespaces are represented in names and routes. Define the convention and namespace-exclusion rules, then verify that both attributes produce the same result for the examples and for nested namespaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.