Skip to content

Add numeric type cases to CustomTypeSerializer#62

Merged
SirCotare merged 1 commit intomainfrom
bugfix-backport
Apr 7, 2026
Merged

Add numeric type cases to CustomTypeSerializer#62
SirCotare merged 1 commit intomainfrom
bugfix-backport

Conversation

@SirCotare
Copy link
Copy Markdown
Contributor

Ported from #61.

CustomTypeSerializer.serialize() was missing explicit handling for numeric types (Byte, Short, Integer, Long, Float, Double, BigInteger, BigDecimal, ScaledBigDecimal). These fell through to the generic writeRawValue() branch, causing numeric-wrapped CustomType<?> values to be serialized as JSON strings instead of JSON numbers.

This port adds the nine missing case branches, each calling writeNumber() with the appropriately typed value. The implementation is adapted from the v1 branch fix (PR #61) to the Jackson 3.x API used in main (tools.jackson.*, ValueSerializer, SerializationContext, no throws IOException). No case null branch was added — the value is @NonNull per jspecify and the null case is not applicable in this branch.

Review notes

This PR ports an existing change into this project. Please focus on:

  • Completeness — are all relevant changes from the source correctly reflected here?
  • Integration — does the ported code fit into this project's existing patterns, conventions, and call sites?
  • Adaptation — were any necessary adaptations (naming, imports, framework differences) made correctly?

@SirCotare SirCotare self-assigned this Apr 7, 2026
@SirCotare SirCotare requested a review from Piiit April 7, 2026 14:15
@SirCotare SirCotare merged commit 88fa1a0 into main Apr 7, 2026
1 check passed
@SirCotare SirCotare deleted the bugfix-backport branch April 7, 2026 15:21
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