Skip to content

feat!: migrate from Jackson 2 to Jackson 3 - #1571

Open
yvasyliev wants to merge 30 commits into
rubenlagus:devfrom
yvasyliev:feature/jackson3
Open

feat!: migrate from Jackson 2 to Jackson 3#1571
yvasyliev wants to merge 30 commits into
rubenlagus:devfrom
yvasyliev:feature/jackson3

Conversation

@yvasyliev

@yvasyliev yvasyliev commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Important

Please squash and merge this PR if it gets approved.

As part of #1561 suggestion, I'm creating this request to migrate TelegramBots from Jackson 2 to Jackson 3.

Changelist

Based on the Jackson 3 Migration Guide, the next changes were applied.

Cross-module

The following changes were applied to all modules:

  1. com.fasterxml.jackson.* Jackson 2 dependencies were replaced with a single tools.jackson.core Jackson 3 dependency.
  2. Bumped Lombok from 1.18.34 to 1.18.44 to make @Jacksonized annotation compatible with Jackson 3.
  3. Bumped JUnit from 5.12.2 to 6.0.3; added BOM import.
  4. Bumped Mockito from 5.12.0 to 5.21.0; added BOM import.
  5. Created lombok.config file to enable Jackson 3-compatible @Jacksonized configuration.
  6. Replaced com.fasterxml.jackson.* Jackson 2 package imports with tools.jackson.* Jackson 3 package imports where relevant across the code.
  7. Replaced Jackson 2 ObjectMapper with Jackson 3 JsonMapper (a core JSON reader/writer in Jackson 3) across the code.
  8. Replaced IOException with JacksonException (extends RuntimeException) in the throws lists and catch blocks where relevant across the code.
  9. Adjusted unit tests to work with Jackson 3 JsonMapper.

Module-specific

The following changes were applied to specific modules only:

telegrambots-meta

  1. Replaced org.telegram.telegrambots.meta.api.objects.InputFileSerializer with org.telegram.telegrambots.meta.api.objects.InputFileConverter.
  2. org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.serialization.InputMessageContentDeserializer was removed in favor of @com.fasterxml.jackson.annotation.JsonTypeInfo.
  3. Applied @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE) to org.telegram.telegrambots.meta.api.objects.Contact and org.telegram.telegrambots.meta.api.objects.stories.StoryAreaPosition to make Jackson 3 ignore getters during serialization. Without it, Jackson 3 will create an extra field in a serialized object (e.g., vcard and VCard).
  4. Removed unused fields from org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException.

telegrambots-webhook

  1. Bumped Javalin from 7.0.1 to 7.2.2.
  2. io.javalin.json.JavalinJackson3 is now used as Javalin's JSON mapper.

telegrambots-abilities

  1. Created explicit PolymorphicTypeValidator configuration, because the default one doesn't pass all tests.

Closes #1561

@yvasyliev

Copy link
Copy Markdown
Contributor Author

Hi @rubenlagus while we're waiting for the Lombok stable release, could you please start an initial review? Thank you!

yvasyliev and others added 5 commits July 21, 2026 12:38
# Conflicts:
#	pom.xml
#	telegrambots-abilities/pom.xml
#	telegrambots-client-jetty-adapter/pom.xml
#	telegrambots-client/pom.xml
#	telegrambots-extensions/README.md
#	telegrambots-extensions/pom.xml
#	telegrambots-longpolling/pom.xml
#	telegrambots-meta/pom.xml
#	telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/inputmessagecontent/serialization/InputMessageContentDeserializer.java
#	telegrambots-springboot-longpolling-starter/pom.xml
#	telegrambots-springboot-webhook-starter/pom.xml
#	telegrambots-test-reports/pom.xml
#	telegrambots-webhook/pom.xml
#	telegrambots-webhook/src/main/java/org/telegram/telegrambots/webhook/TelegramBotsWebhookApplication.java
@yvasyliev
yvasyliev marked this pull request as ready for review July 23, 2026 16:45
@yvasyliev

Copy link
Copy Markdown
Contributor Author

The PR is ready for the review

rubenlagus and others added 5 commits July 23, 2026 19:29
… cases

Add tests for the wire forms that caused webhook queue-poisoning and
long-polling retry loops: typed RichText objects (e.g. bold) whose
nested text field arrives as a bare JSON string rather than a typed
object, and the corresponding array/concat forms. Also adds an
end-to-end Message deserialization test reproducing the exact payload
from the issue report.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts:
#	telegrambots-meta/src/test/java/org/telegram/telegrambots/meta/api/objects/richtext/TestRichMessage.java
@yvasyliev

Copy link
Copy Markdown
Contributor Author

Conflicts are resolved

@yvasyliev

Copy link
Copy Markdown
Contributor Author

The build is fixed

@yvasyliev

Copy link
Copy Markdown
Contributor Author

@rubenlagus could you please share the build logs? I'm not able to reproduce the failure:

[INFO] Reactor Summary:
[INFO] 
[INFO] Bots 10.1.1 ........................................ SUCCESS [  1.351 s]
[INFO] Telegram Bots Meta 10.1.1 .......................... SUCCESS [ 37.011 s]
[INFO] Telegram Bots Long Polling 10.1.1 .................. SUCCESS [ 11.405 s]
[INFO] Telegram Bots Webhook 10.1.1 ....................... SUCCESS [ 11.725 s]
[INFO] Telegram Bots Client 10.1.1 ........................ SUCCESS [  8.674 s]
[INFO] Telegram Bots Client Jetty HttpClient adapter 10.1.1 SUCCESS [ 11.554 s]
[INFO] Telegram Bots Long polling Spring Boot Starter 10.1.1 SUCCESS [  9.202 s]
[INFO] Telegram Bots Webhook Spring Boot Starter 10.1.1 ... SUCCESS [ 15.472 s]
[INFO] Telegram Bots Extensions 10.1.1 .................... SUCCESS [ 10.130 s]
[INFO] Telegram Ability Bot 10.1.1 ........................ SUCCESS [ 18.573 s]
[INFO] Telegram Bots BOM 9.5.0 ............................ SUCCESS [  0.218 s]
[INFO] Telegram Bots Test Reports 10.1.1 .................. SUCCESS [  2.556 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:19 min
[INFO] Finished at: 2026-07-26T18:32:49+03:00
[INFO] ------------------------------------------------------------------------

@yvasyliev yvasyliev changed the title feat: migrate from Jackson 2 to Jackson 3 feat!: migrate from Jackson 2 to Jackson 3 Aug 1, 2026
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.

2 participants