Skip to content

Add runtime support for V2 int64 string-encoded fields#2179

Open
mbroshi-stripe wants to merge 3 commits intomasterfrom
mbroshi/v2-int64-as-string
Open

Add runtime support for V2 int64 string-encoded fields#2179
mbroshi-stripe wants to merge 3 commits intomasterfrom
mbroshi/v2-int64-as-string

Conversation

@mbroshi-stripe
Copy link
Contributor

@mbroshi-stripe mbroshi-stripe commented Mar 15, 2026

Why?

V2 APIs represent int64 fields as JSON strings on the wire (e.g. "12345" instead of 12345) to avoid precision loss. The SDK should transparently convert between native Long and this wire format so users don't need to handle string encoding themselves.

What?

  • Added StringInt64TypeAdapter (GSON TypeAdapter) — serializes Long as JSON string, deserializes string-encoded integers back to Long
  • Added tests for request serialization (toMap produces string) and response deserialization (fromJson with string value produces Long)
  • Generated code will annotate int64_string fields with @JsonAdapter(StringInt64TypeAdapter.class)

@mbroshi-stripe mbroshi-stripe force-pushed the mbroshi/v2-int64-as-string branch from 2487387 to cce4802 Compare March 15, 2026 21:55
@mbroshi-stripe mbroshi-stripe force-pushed the mbroshi/v2-int64-as-string branch from cce4802 to 1534db3 Compare March 15, 2026 21:58
@mbroshi-stripe mbroshi-stripe changed the title Mbroshi/v2 int64 as string Add runtime support for V2 int64 string-encoded fields Mar 15, 2026
@mbroshi-stripe mbroshi-stripe changed the base branch from private-preview to master March 15, 2026 22:32
@mbroshi-stripe mbroshi-stripe marked this pull request as ready for review March 16, 2026 00:46
@mbroshi-stripe mbroshi-stripe requested a review from a team as a code owner March 16, 2026 00:46
@mbroshi-stripe mbroshi-stripe requested review from xavdid-stripe and removed request for a team March 16, 2026 00:46
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.

1 participant