-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Generate Jackson deserializers #42954
Conversation
986e56b
to
fab69c6
Compare
Nice work! I assume you'll add some tests for this :) |
fab69c6
to
d2f8463
Compare
I added one very simple test that I had in my former pull request and for some reason missed to port on this one https://github.com/quarkusio/quarkus/pull/42954/files#diff-3364b502d76016d13fc343c40b2f921523fce303002673812ad65d9064c70b40R661 For the rest the deserialization is already tested by the other tests performing a POST in the |
This comment has been minimized.
This comment has been minimized.
|
||
String writtenType() { | ||
return switch (fieldType.name().toString()) { | ||
case "char", "java.lang.Character" -> "java.lang.String"; |
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.
This isn't supposed to map both to primitive char?
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.
No. Maybe the name of the method is misleading, anyway this is the type that has to be used when a field is written into json. In Jackson (and indeed in json) there's no notion of a single char, so it has to be written as a String.
Which other tests are you referring to here? Also, unless this feature is already being used in one of the integration tests, we have zero coverage for the native case. |
There are a few tests performing a POST in the Line 150 in d2f8463
Line 165 in d2f8463
and so on. For all of them when the test cases are executed within SimpleJsonWithReflectionFreeSerializersTest that extends it, all the deserializations are performed through these new generated deserializers.
This is true, and it's also true for the formerly introduced serializers. Can you please point me on where I could add those tests for native? |
Cool
Feel free to add the setting to any of the modules in |
move generated serializers registration in its own ObjectMapperCustomizer add test add integration tests
d2f8463
to
bd57e87
Compare
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.
💪🏽
@geoand as you already saw I added a couple of tests in the The tests are only 2 for now, but they cover both serialization and deserialization and also the problem that I had with the interface. I will incrementally add new tests there when we will add new features and/or fix other bugs. |
Status for workflow
|
case "java.lang.Short" -> "short"; | ||
case "java.lang.Long" -> "long"; | ||
case "java.lang.Double" -> "double"; | ||
case "java.lang.Float" -> "float"; |
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.
We are missing Boolean here =)
This pull request completes the work on Jackson's reflection-free serialization also implementing the deserialization part. I added a complete explanation of what this generates in the javadocs. it also moves the registration of the generated serializers in its own
ObjectMapperCustomizer
.Once this will be merged I believe that we could have some discussion on how to extend and generalize this work making this improvement available also to other parts of Quarkus that need to perform some sort of json serialization.
/cc @geoand @franz1981 @metacosm