dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

[Topic] Attribute doesn't support dynamic routes

Open fabistb opened this issue 1 year ago • 4 comments

Currently the [Topic] cant be used if the route contains a dynamic part. A example here is a version in the route.

Example dynamic route:

[ApiController]
[ApiVersion("1.0")]
[Route("api/v{v:apiVersion}/example]
public class ExampleController : ControllerBase
{
  [HttpPost()]
  [Topic("messagebus", "topic")
  public async Task<IActionResult> PubSub([FromBody] object message)
  {
  ...
  }
}

Example static route:

[ApiController]
[Route("api/v1.0/example]
public class ExampleController : ControllerBase
{
  [HttpPost()]
  [Topic("messagebus", "topic")
  public async Task<IActionResult> PubSub([FromBody] object message)
  {
  ...
  }
}

Is their a specific reason why the dynamic routes aren't supported?

fabistb avatar Aug 01 '23 09:08 fabistb