- Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-10058: Add Jackson 3 (de)serializer support #10193
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
base: main
Are you sure you want to change the base?
Conversation
Related to: spring-projects#10058 * Add Jackson3-compatible messaging (de)serializers * Add Jackson 3 `messagingAwareMapper()` support * Maintain existing Jackson 2 functionality Signed-off-by: Jooyoung Pyoung <pyoungjy@gmail.com>
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.
*JacksonDeserializer → *Jackson2Deserializer
thank you for the effort !
I’ll take a look tommorow in details, but I think this is a wrong direction.
we develop here a library for target project to rely on the API. We cannot break anything just because. It could be possible in target product where no one depend on your public API. With frameworks and libraries we don’t have such a liberty.
Therefore renaming existing classes, or moving them to different packages is wrong direction for us.
my apologies that my comment about naming was not so clear. Let me try again!
We only deprecate existing classes. We name new classes without a number, as much as possible. No need in a new package since deprecated classes will be removed in next version.
Again: we need to keep in mind that our code is used to compile other projects: breaking an API so dramatically is not acceptable.
Please, revise your solution.
Thank you for taking the time to review this on the weekend ! I apologize for not fully considering that I'm contributing to a widely-used library. At my job, I work on middleware primarily focusing on backward compatibility for end-user functionality, but I hadn't deeply thought about the compatibility of public APIs that other projects depend on. I'll be much more careful to consider API dependencies and backward compatibility in my contributions. For easier review, I'll revert |
* Keep existing `*JacksonDeserializer` classes unchanged * Add new `*Jackson3Deserializer` classes for Jackson 3 support Signed-off-by: Jooyoung Pyoung <pyoungjy@gmail.com>
...ration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java Outdated Show resolved Hide resolved
...ration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java Outdated Show resolved Hide resolved
...ain/java/org/springframework/integration/support/json/AdviceMessageJackson3Deserializer.java Outdated Show resolved Hide resolved
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.
Thank you for the effort!
Please, keep in mind that Jackson 2 will be deprecated.
I even wonder if we should do that right now, so then it will become more clear what to implement and where to migrate in tests. I don't say to do that in your current PR, but just an idea for the next step (if any).
Thank you!
...ain/java/org/springframework/integration/support/json/AdviceMessageJackson3Deserializer.java Outdated Show resolved Hide resolved
...ain/java/org/springframework/integration/support/json/AdviceMessageJackson3Deserializer.java Outdated Show resolved Hide resolved
...ration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java Outdated Show resolved Hide resolved
...n-core/src/main/java/org/springframework/integration/support/json/JacksonMessagingUtils.java Outdated Show resolved Hide resolved
.../src/main/java/org/springframework/integration/support/json/MessageJackson3Deserializer.java Outdated Show resolved Hide resolved
...e/src/test/java/org/springframework/integration/support/json/JacksonMessagingUtilsTests.java Outdated Show resolved Hide resolved
* Remove `Jackson3` suffix from deserializer/serializer classes * Copy `DEFAULT_TRUSTED_PACKAGES` from `JacksonJsonUtils` for future deprecation * Inline dedicated method and constants in test Signed-off-by: Jooyoung Pyoung <pyoungjy@gmail.com>
Thank you for the guidance! It seems like we're getting closer to the point where Jackson 2 deprecation makes sense. I think we maybe need to add As you mentioned previously, we'll likely be blocked by Jackson 3 migration in other projects. I'm not entirely certain, but from what I've checked, it appears to be Spring Kafka's I see you're also a Spring Kafka maintainer. If needed, I'd be happy to help with migration in other projects too. Feel free to ping me on the relevant issues if my contribution would be helpful ! 😁 |
Sure thing, @anthologia ! Here is Spring Kafka part: spring-projects/spring-kafka#3930 |
I'm not entirely familiar with these projects, but I'd be happy to give both a shot based on what I've learned here! What's the expected release timeline for AMQP? |
For AMQP that was a PR from me to review. Thank you for your help with all of this! |
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.
Very good!
Just final nit-pick review.
Thank you!
...n-core/src/main/java/org/springframework/integration/support/json/JacksonMessagingUtils.java Outdated Show resolved Hide resolved
...n-core/src/main/java/org/springframework/integration/support/json/JacksonMessagingUtils.java Show resolved Hide resolved
...n-core/src/main/java/org/springframework/integration/support/json/JacksonMessagingUtils.java Outdated Show resolved Hide resolved
...n-core/src/main/java/org/springframework/integration/support/json/JacksonMessagingUtils.java Show resolved Hide resolved
* Configure checkstyle `NoWhitespaceBefore` tokens to allow varargs spacing * Add `@Nullable` for JSpecify nullability * Fix ClassLoader reference in `JacksonMessagingUtils` Signed-off-by: Jooyoung Pyoung <pyoungjy@gmail.com>
Signed-off-by: Jooyoung Pyoung <pyoungjy@gmail.com>
Related to: #10058
messagingAwareMapper()
supportI thought about splitting this into separate PRs (
(de)serializers
+messagingAwareMapper()
support), but figured it'd be easier to review as one. It's a bit large though - apologies for the extra work! 😅Now, I have a few questions..
Package Structure
With many Jackson 2 / Jackson 3 classes in the same package, how about reorganizing Jackson 2 into sub-package?
Copyright and Authors
When refactoring the classes, I moved existing impls and created new ones, following the team's previous decision:
E.g., :
*JacksonDeserializer
→*Jackson2Deserializer
(Jackson 2 support)*JacksonDeserializer
for Jackson 3 supportI've attempted to update
@author
and copyright year appropriately, but please review if they're handled correctly.Docs
Currently, Many docs (e.g., redis.adoc) references the default class names:
With this PR, we now have version-specific implementations:
MessageHeadersJackson2Serializer
MessageHeadersJacksonSerializer
Should we update docs to reflect current impl(Jackson 2) or keep it for 7.0 release since Jackson 3 will be the default?