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

Code is not compiling after aliases were added to projections #681

Closed
njuro opened this issue Apr 22, 2024 · 3 comments
Closed

Code is not compiling after aliases were added to projections #681

njuro opened this issue Apr 22, 2024 · 3 comments

Comments

@njuro
Copy link

njuro commented Apr 22, 2024

Hi, in patch update 6.1.7, support for aliases was added to query projections (#676).

This seems like an innocent change, since the _alias parameter has default value (null), however it will cause problems when the projection is used in user code without explicitly named arguments. That's caused by the fact that the _alias parameter was added to the beginning of the parameter list, not to the end. Example:

Before 6.1.7:
Generated projection(foo: String), called in user code as projection("bar") - compiles

After 6.1.7.:
Generated projection(_alias: String = null, foo: String), called in code as projection("bar") - won't compile, because bar will be passed as _alias, leaving the required parameter foo undefined.

The fix on the user side is simple, we just need to use named argument like this: projection(foo = "bar") and everything works again. But for larger projects it can be quite annoying, especially since this isn't something that can be mass replaced and you need to fix it case by case.

Therefore I propose to revert this update and either add the _alias parameter to the end of the parameter list, or to release it as major version change, not patch.

@srinivasankavitha
Copy link
Contributor

Thanks for flagging this @njuro.
@mbossenbroek - what do you think? I can revert or if you are ok with moving the _alias to the end, we can go with that so it's not a breaking change.

@srinivasankavitha
Copy link
Contributor

#682 (review)

@njuro
Copy link
Author

njuro commented Apr 23, 2024

That fixes it, thank you

@njuro njuro closed this as completed Apr 23, 2024
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

2 participants