Skip to content

Allow colons in bracket parameter syntax #748

@brjann

Description

@brjann

Reitit allows two syntaxes for path parameters, colon and bracket syntax

[["/users/:user-id" {:handler get-user}]
 ["/api/:version/ping" {:handler ping-version}]]
[["/users/{user-id}" {:handler get-user}]
 ["/files/file-{number}.pdf" {:handler get-pdf}]]

The bracket syntax is required for namespaced keywords, for example

[["/users/{user/id}" {:handler get-user}]
 ["/files/file-{file/number}.pdf" {:handler get-pdf}]]

However, when using the bracket syntax, you lose the correspondence between keywords in the route and keywords in the request map. I think it would be very helpful if also the bracket syntax would allow a colon, i.e.,

[["/users/{:user/id}" {:handler get-user}]
 ["/files/file-{:file/number}.pdf" {:handler get-pdf}]]

This gives you immediate visual recognition of keywords in the route.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Not right now

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions