Skip to content

Conversation

luanpotter
Copy link
Contributor

@luanpotter luanpotter commented Oct 1, 2025

Centralize and expose a registerTypeAdapters method on GsonFactory

Typically on larger projects, gson needs to be configured with many other adapters and configurations. The way the GsonFactory class on slack-api-client currently expose a finalized, pre-built gson instances makes it less reusable for users, who would have to copy the adapter registration configuration one-by-one if they already have a gson of their own.

In fact, even within GsonFactory, the code is already repeated thrice, which can lead to desynchronization issues - which, in fact, did happen, as the last version had two repeated registrations (MessageChangedEvent.PreviousMessage and LogsResponse.DetailsChangedValue) and two missing registrations (FunctionExecutedEvent.InputValue, Attachment.VideoHtml), clearly a copy-paste mistake (unless this was intentional, but the reason would most certainly elude me).

This unifies all instances to use the same shared method, and expose it so users can create their own instances as well.

Category (place an x in each of the [ ])

  • bolt (Bolt for Java)
  • bolt-{sub modules} (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

Copy link

salesforce-cla bot commented Oct 1, 2025

Thanks for the contribution! Before we can merge this, we need @luanpotter to sign the Salesforce Inc. Contributor License Agreement.

@luanpotter luanpotter marked this pull request as ready for review October 1, 2025 15:27
@luanpotter luanpotter changed the title feat: Centralize and expose a registerTypeAdapters method on GsonFactory [WIP] feat: Centralize and expose a registerTypeAdapters method on GsonFactory Oct 1, 2025
@WilliamBergamin WilliamBergamin added this to the 1.45.5 milestone Oct 1, 2025
@WilliamBergamin WilliamBergamin added enhancement M-T: A feature request for new functionality project:slack-api-client project:slack-api-client labels Oct 1, 2025
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.04%. Comparing base (5b861d8) to head (37e14fe).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...main/java/com/slack/api/util/json/GsonFactory.java 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1510      +/-   ##
============================================
- Coverage     73.12%   73.04%   -0.09%     
+ Complexity     4384     4381       -3     
============================================
  Files           475      475              
  Lines         14245    14222      -23     
  Branches       1447     1447              
============================================
- Hits          10417    10388      -29     
- Misses         2969     2976       +7     
+ Partials        859      858       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@WilliamBergamin WilliamBergamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise for taking the time to contribute to this project 🙏

The changes look like valid enhancements to me and the tests are passing 🚀

@luanpotter
Copy link
Contributor Author

@WilliamBergamin my pleasure! and thank you so much for the swift review 🙏

@WilliamBergamin WilliamBergamin merged commit 84c8d2b into slackapi:main Oct 1, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:signed enhancement M-T: A feature request for new functionality project:slack-api-client project:slack-api-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants