dapr / dapr/dotnet-sdk

[Question] api routes and versioning

Open
#977 2 comments 0 reactions 0 assignees View on GitHub
area/actor/client area/aspnetcore question
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
1d 22h
Merged PRs (30d)
5

Description

What is the best practice to implement route versioning in asp.net core and dapr?
When using route versioning in aps.net core, you typically have the following routes:
/api/v1.0/controller/action
/api/v2.0/controller/action
Dapr also has route versioning:
/v1.0/invoke/appid/method/action

Above example would lead to
/v1.0/invoke/appid/method/api/v1.0/controller/action
Not so clean....
and when using the dapr sdk:
dapr.InvokeMethodAsync(appId, "api/v1/controller/action");

What I'm missing is a dapr attribute or extension that can be added to the controller and action, the same you do today with a topic:

For example, in the minimal api notation for a subscription to a topic, you write:

` endpoints.MapPost(.....).WithTopic("pubsub", "someTopic")`

It would be interesting to do the same with service invocation like this:

` endpoints.MapPost(.....).WithMethod("MethodName", "v1")`

and in the client:

` dapr.InvokeMethodAsync("appId", "MethodName", "v1");`

As a bonus the full route is abstracted away in the client implementation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.