Add StringSyntax to the RouteAttribute by IEvangelist · Pull Request #57369 · dotnet/aspnetcore (original) (raw)

Add StringSyntax to the RouteAttribute

Consistent syntax highlighting of template/patterns for routes.

Description

I noticed when using the [Route("/orders/{orderId:int}")] attribute, as an example, doesn't display the same as when using the EndpointRouteBuilderExtensions APIs for Map* that accept a template/pattern.

Example MapGet — includes string syntax:

image

Example Route — doesn't include string syntax:

image

I think it would be great if we could also highlight routes when using the attribute. This PR adds the StringSyntax to decorate the template parameter to be highlighted like the method APIs.

Contributes to #44535