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

formData generator fails if only one parameter is present #127

Closed
blast-hardcheese opened this Issue Nov 1, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@blast-hardcheese
Collaborator

blast-hardcheese commented Nov 1, 2018

In AkkaHttpServerGenerator.scala#L610, we see:

p"(..${optionalTermPatterns.map(_.toPat)})"

If optionalTermPatterns is an empty list, we end up with a p"(), used as case () =>. In this case, it's actually a tuple pattern, not Unit, which is invalid due to syntactic ambiguity.

@blast-hardcheese

This comment has been minimized.

Collaborator

blast-hardcheese commented Nov 1, 2018

Just realized this is because the constraint in the error messages is p(..$xs) where xs.length > 1, instead of >= 1. This means this issue arises when there are fewer than two parameters.

This issue doesn't seem to manifest in the case of no parameters defined for a given route, so the real cause of this is only having one parameter.

A valid fix for this would be special-casing Tuple1 in these cases.

@blast-hardcheese blast-hardcheese changed the title from formData generator fails if all parameters are `required: true` to formData generator fails if only one parameter is present Nov 1, 2018

@blast-hardcheese

This comment has been minimized.

Collaborator

blast-hardcheese commented Nov 1, 2018

Resolved in #128

@blast-hardcheese blast-hardcheese self-assigned this Nov 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment