-
Notifications
You must be signed in to change notification settings - Fork 140
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
Aliases #866
Aliases #866
Conversation
Research into implementing aliases defined from an annotation. This does the minimum possible (only scala 2.x for now). Any hints on how to improve the idea are welcome.
This looks promising. Can you lint the code so that we can see whether tests pass? |
@fsvehla The tests pass now. I will add some unit tests to see how the new feature works. I am particularly interested to see what error messages will look like. |
@fsvehla Can you take another look? As far as I can see it is complete now (except for Scala 3). |
Is Scala 3 support something you can tackle? |
Sure. Just not today anymore. |
…add test for `StringMatrix.first`
@fsvehla I can't get the scala 3 tests to pass on my machine (tried with The StringMatrix unit tests now take quite a long time (~150 seconds on my machine). I think that the complex generator expression is to blame. I wanted to add a unit test that asserts that code with an alias containing the name of an already defined field fails to compile. Something like:
Any idea on how to do achieve this? Otherwise, I think this feature is good to go. Any comments and feedback is welcome. |
I see some more tests are failing. Any help to fix those is appreciated. |
In the end it was a silly mistake. The scala 3 tests pass now. I would still like to introduce a test like: "case class Person(@jsonAliases("n") name: String, n: Int)" shouldNot compile I tried to use |
@fsvehla could you start the build again please? |
I suspect that Magnolia doesn't actually evaluate the |
@fsvehla All cleaned up and ready for a full review and merging... |
@fsvehla Sorry, I forgot to run the tests for scala 3 locally. Should be fixed now. |
Its not fixed though. Scala 3 uses different class names then scala 2. I'll have to be smart with the test assertions... I will fix it tomorrow. |
Okay, should be fine now for Scala 2 and 3 on the JVM. Let's see how all the different versions and platforms do... |
Aaarrggh, now I forgot the formatting. All other jobs are green! :) |
All green! 😄 |
Great work, thanks! |
Add support for aliases by defining an annotation.
Solves #864.