-
Notifications
You must be signed in to change notification settings - Fork 783
Add Support for Jackson 3 and use it by default #742
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
|
@filiphr I was about to submit such PR, so thanks for creating it. I think I would prefer to have consistency between |
|
Thanks for your comment @sdeleuze. I've read your comment #562 (comment) and I've added an alternative idea in #562 (comment). In any case, I stumbled onto this since I wanted to contribute Jackson 3 support for Spring AI, but that depends on this project, so I started here first. |
|
@filiphr Thanks, just be aware I am already working on the Jackson 3 support for Spring AI, and have it pretty advanced locally, so no need to contribute it. That said, I will welcome your review on my upcoming PR. |
|
After the discussion on #562, my proposal is the following: 0.18:
0.19:
@filiphr @tzolov @chemicL @graemerocher @sdelamo Are you ok with that? If we are, this PR could be refined with the proposed |
|
I'm OK with your proposal @sdeleuze. In an hour or two I can adjust this PR and the the changes in relation to
Thanks for letting me know @sdeleuze. I have not spend a lot of time on it anyways, I stumbled fast on the different dependencies. I would be happy to review your PR for Spring AI, feel free to ping me when you have it ready. |
This plan makes sense. Please go ahead |
It requires for now installing locally: - modelcontextprotocol/java-sdk#742 - https://github.com/victools/jsonschema-generator main branch JsonMapper is used instead of ObjectMapper, following Jackson 3 best practicies and the same pattern used by Spring Framework and Spring Boot. JacksonUtils#instantiateAvailableModules now leverages Jackson service loader based discovery of Jackson module. TODO: - Upgrade to com.github.victools:jsonschema-generator:5.0.0 - Upgrade to MCP Java SDK 0.18.0
It requires for now installing locally: - modelcontextprotocol/java-sdk#742 - https://github.com/victools/jsonschema-generator main branch JsonMapper is used instead of ObjectMapper, following Jackson 3 best practicies and the same pattern used by Spring Framework and Spring Boot. JacksonUtils#instantiateAvailableModules now leverages Jackson server loader based discovery of Jackson module. TODO: - Upgrade to com.github.victools:jsonschema-generator:5.0.0 - Upgrade to MCP Java SDK 0.18.0
chemicL
left a comment
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. I added a tiny javadoc remark, probably worth rebasing the PR against main and fixing that one.
As a follow up, we should look into unifying the tests between modules as currently they're a copy.
...ckson3/src/main/java/io/modelcontextprotocol/json/jackson3/JacksonMcpJsonMapperSupplier.java
Outdated
Show resolved
Hide resolved
It requires for now installing locally: - modelcontextprotocol/java-sdk#742 - https://github.com/victools/jsonschema-generator main branch JsonMapper is used instead of ObjectMapper, following Jackson 3 best practicies and the same pattern used by Spring Framework and Spring Boot. JacksonUtils#instantiateAvailableModules now leverages Jackson service loader based discovery of Jackson module. TODO: - Upgrade to com.github.victools:jsonschema-generator:5.0.0 - Upgrade to MCP Java SDK 0.18.0
It requires for now installing locally: - modelcontextprotocol/java-sdk#742 - https://github.com/victools/jsonschema-generator main branch JsonMapper is used instead of ObjectMapper, following Jackson 3 best practicies and the same pattern used by Spring Framework and Spring Boot. JacksonUtils#instantiateAvailableModules now leverages Jackson service loader based discovery of Jackson module. TODO: - Upgrade to com.github.victools:jsonschema-generator:5.0.0 - Upgrade to MCP Java SDK 0.18.0 Signed-off-by: Sébastien Deleuze <[email protected]>
It requires for now installing locally: - modelcontextprotocol/java-sdk#742 - https://github.com/victools/jsonschema-generator main branch JsonMapper is used instead of ObjectMapper, following Jackson 3 best practices and the same pattern used by Spring Framework and Spring Boot. JacksonUtils#instantiateAvailableModules now leverages Jackson service loader based discovery of Jackson module. TODO: - Upgrade to com.github.victools:jsonschema-generator:5.0.0 - Upgrade to MCP Java SDK 0.18.0 Signed-off-by: Sébastien Deleuze <[email protected]>
sdelamo
left a comment
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.
it looks good to me.
ced8b81 to
c4617ac
Compare
deprecate classes for removal in `io.modelcontextprotocol.json.jackson`/`io.modelcontextprotocol.json.schema.jackson` and copy them to `io.modelcontextprotocol.json.jackson2`/`io.modelcontextprotocol.json.schema.jackson2` in non-deprecated form.
|
Thanks everyone for the review. I had to do some additional changes to make sure everything works with Jackson 3.
I agree with you @chemicL it would be good to have some unified tests, maybe tests where all the different json mappers are tested. Btw, I also had some problems with some of the tests in |
The goal of this PR is to add support for Jackson 3.
Motivation and Context
Jackson 3 is the latest version from Jackson and it is the next iteration of Jackson.
How Has This Been Tested?
The existing tests were enough
Breaking Changes
The Java MCP SDK now pulls in Jackson 3 instead of Jackson 2. This can be potentially a breaking change in case someone was using
io.modelcontextprotocol.json.jackson.JacksonMcpJsonMapperthen they would need to switch toio.modelcontextprotocol.json.jackson3.JacksonMcpJsonMapperand / or adjust the dependencies so that they pullmcp-coreandmcp-json-jackson3Types of changes
Checklist
Additional context