Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: detect mismatched route parameters at compile time #214

Open
Diggsey opened this issue Jun 3, 2019 · 3 comments
Open

Feature: detect mismatched route parameters at compile time #214

Diggsey opened this issue Jun 3, 2019 · 3 comments

Comments

@Diggsey
Copy link
Contributor

Diggsey commented Jun 3, 2019

At the moment, the route handler will panic if it can't find a matching name for a route parameter, with the error Unable to match url parameter name ....

It would be an improvement if the router macro caught this at compile time.

@tomaka
Copy link
Owner

tomaka commented Jun 8, 2019

The panicking shouldn't happen.

@tommilligan
Copy link

Are you using string-style invocation? The docs state:

When using URL parameters with string-style syntax, the parameter names in the URL and identity: type pairs must be the same, e.g. ... ["/users/{name}", name: String] ... . This can't be checked at compile time so bad route definitions will cause a runtime panic.

If not, could you provide a minimal example?

@Diggsey
Copy link
Contributor Author

Diggsey commented Jun 9, 2019

Sorry yes I should have made that clear. This feature request is to check that at compile time, which is definitely possible given the stabilisation of procedural macros and other meta-programming features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants