Closed withinboredom closed 5 years ago
Seems like there's a bug with compiling the specific records classes. Looking into it.
Fixed the compilation issue, I guess the compiler considers names prefixed with _$$
as special.
I tested this with our code base and with the julianpeeters/sbt-avrohugger#72 tests added back in.
(1) I'd guess users might expect that the java avro convention was followed, however if something works better for your use case we could use your preference and then in the future add some configurability.
(2) Your concern is very appreciated, but I'm not too worried, avrohugger is ready for a refactor. However I'm strongly opposed to adding a body to the Standard
case class format. Could you add or share some scripted
tests (e.g. julianpeeters/sbt-avohugger#72) so I can better understand your use-case?
(3) > +publishLocal
of a bumped snapshot of avrohugger
will make the changes available for a bumped sbt-avrohugger
to depend on, from where you can then do > scripted
to test scavro etc. in real-world conditions
I'd guess users might expect that the java avro convention was followed
Ah, nice! Will reuse that.
However I'm strongly opposed to adding a body to the Standard case class format
I mostly did it because one would expect to be able to call myClass.type
(for example) and it just work without having to understand that it's mangled and how it's mangled.
Could you add or share some scripted tests
Will do
I changed the mangle function to be the same as the Java version. I also dropped the body from the case class. If it's added, it should probably happen in separately in a different PR.
Awesome, thank you @withinboredom! This is now out as RC18
Regarding the on the body -- I've got to get the testing situation in better control before new custom type options, or new formats, are added. I'd be looking for a more specific use case than reflection, tho (reflection is currently labelled "experimental", and in general is infeasible for avrohugger to support over time)
This changes the names of a parameter, such as
public
into a mangled parameter, such as_$$public
.For case classes: it adds a public
val
to access it by the name given in the schema For specific classes: the getter and setter should do the translating without changing the schema For scavro: I am honestly not sure how it works :) or if it works :DThere are a few questionable things going on here:
__
is a sufficient mangle or if it would be better to have something else.I'm not sure this actually works in real life, for all three cases. Yet.Appears to work as expected, but not sure how to use the scavro classes in a real-life case.This PR mostly exists to get your feedback on what I have.