Skip to content

fix McpSchema deserialization issues with Jackson3 while keeping Jackson2 behavior unchanged#979

Open
iuliiasobolevska wants to merge 1 commit into
modelcontextprotocol:mainfrom
iuliiasobolevska:fix/978
Open

fix McpSchema deserialization issues with Jackson3 while keeping Jackson2 behavior unchanged#979
iuliiasobolevska wants to merge 1 commit into
modelcontextprotocol:mainfrom
iuliiasobolevska:fix/978

Conversation

@iuliiasobolevska
Copy link
Copy Markdown

@iuliiasobolevska iuliiasobolevska commented May 21, 2026

Motivation and Context

Fixes #978

How Has This Been Tested?

Added unit tests utilizing both Jackson2 and Jackson3

Breaking Changes

I spent several cycles trying to find a solution that keeps behavior unchanged when Jackson2 is being used while fixing the deserialization issue for Jackson3:

  • Jackson 2: picks fromJson as before
  • Jackson 3: with @JsonCreator(mode = JsonCreator.Mode.DISABLED) on the canonical constructor, Jackson 3 no longer treats it as a candidate creator. It then falls back to the @JsonCreator-annotated static fromJson factory — the same creator used by Jackson 2. Both mappers now route deserialization through fromJson.
  • Programmatic Java with null: still throws IllegalArgumentException as before (backward compatible).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Several request records in io.modelcontextprotocol.spec.McpSchema cannot be deserialized correctly by the Jackson 3 mapper

1 participant