armeria icon indicating copy to clipboard operation
armeria copied to clipboard

Consider dropping `:` from path pattern

Open ikhoon opened this issue 1 year ago • 0 comments

: is useful to bind a path variable. However, : is a variable character for a path. If a path variable :foo is mixed with a literal :, it is ambiguous and difficult to know the exact scope of the variable, e.g. /api/v1/:project:get.

Currently, project:get is regarded as a path variable. It makes no sense because I believe most people intend to use project as the path variable and :get is an exact path match.

I don't see that it is inconvenient to only use {project} in a path pattern. Excluding : from path variables and using it only as literals would be a way to eliminate ambiguity and simplify our logic.

Instead, : could be used as a special character within {} to indicate the type of the parameter. https://github.com/line/armeria/blob/2112f50524cf9568ead7e2929fe6cb6f76e2c645/core/src/main/java/com/linecorp/armeria/server/ParameterizedPathMapping.java#L146

ikhoon avatar May 31 '24 07:05 ikhoon