-
Notifications
You must be signed in to change notification settings - Fork 15
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
Support ScalaSerialDescriptor composite case classes #99
Support ScalaSerialDescriptor composite case classes #99
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @necosta , looks great!, Left a comment around the use of strings for the match, hoping we can change that if it makes sense.
case _: (h *: t) => summonInline[ClassTag[h]] :: getElemTypes[t] | ||
case _: (h *: t) => | ||
summonInline[ClassTag[h]].runtimeClass.toString match { | ||
case s if s.toLowerCase.contains("boolean") => KotlinXSerializers.boolean.getDescriptor :: getElemTypes[t] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all these cases, what happens if a type is called something like MyCustomBoolean
? I think it's going to use the KotlinXSerializers.boolean.getDescriptor
, which is not the right serializer. We should be matching against precise class names and not String contents.
case klass if s == summonInline[ClassTag[Boolean]].runtimeClass =>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point. Will get it fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beyond Raul's comment, this pull request is a great improvement. Thanks, @necosta!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing PR! Thanks @necosta
We can now serialise case classes containing case classes members. 🎉 (see unit-tests)
Notes:
derived
methods had theoverride
keyword and some not, I set all withoverride
.Ready for review.