Skip to content

Regenerate with decimal_string enabled for v2 APIs#2310

Merged
jar-stripe merged 2 commits intomasterfrom
jar/enable-decimal-string-v2
Mar 20, 2026
Merged

Regenerate with decimal_string enabled for v2 APIs#2310
jar-stripe merged 2 commits intomasterfrom
jar/enable-decimal-string-v2

Conversation

@jar-stripe
Copy link
Copy Markdown
Contributor

@jar-stripe jar-stripe commented Mar 18, 2026

Why?

V2 API decimal fields (e.g. amount on billing meter events) were previously generated as plain string types, even though the same fields in v1 are generated as float64 with high_precision form tags. A codegen workaround suppressed decimal_string type mapping for all v2 APIs. That workaround has been removed and the root cause (a Go struct tag bug where high_precision leaked into json tags) fixed properly.

What?

  • Regenerated code with decimal_string enabled for v2 APIs
  • V2 decimal fields now use float64 with correct struct tags (json:"field,string" + form:"field,high_precision") instead of plain string
  • No handwritten code changes — this is purely regenerated output
  • Go's json:",string" tag handles decimal string serialization/deserialization natively — no SDK fix needed

Testing

Integration tested against a live Stripe sandbox (6/6 tests passed):

  1. float64 deserialization from JSON string ✓
  2. float64 zero-value when field absent ✓
  3. float64 high precision (10 decimal places) ✓
  4. Amount struct consolidation ✓
  5. Live V2 Account create with float64 percentOwnership ✓
  6. Live V2 Account retrieve — round-trip float64 percentOwnership ✓

See Also

Changelog

  • ⚠️ Breaking change: V2 API decimal fields changed type from string to float64 with json:",string" and form:",high_precision" struct tags. Code that passes these fields as string will need to use float64 instead. Affected fields:
    • V2CoreAccountIdentityIndividualRelationship: PercentOwnership
    • V2CoreAccountPersonRelationship: PercentOwnership
    • Params: V2CoreAccountIdentityIndividualRelationshipParams, V2CoreAccountCreateIdentityIndividualRelationshipParams, V2CoreAccountUpdateIdentityIndividualRelationshipParams, V2CoreAccountTokenIdentityIndividualRelationshipParams, V2CoreAccountTokenCreateIdentityIndividualRelationshipParams, V2CoreAccountsPersonRelationshipParams, V2CoreAccountsPersonCreateRelationshipParams, V2CoreAccountsPersonUpdateRelationshipParams, V2CoreAccountsPersonTokenRelationshipParams, V2CoreAccountsPersonTokenCreateRelationshipParams

V2 API fields with `format: decimal` now generate as `float64` with
proper struct tags (`json:",string"` and `form:",high_precision"`) instead
of `*string`. Driven by sdk-codegen#3369.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
@jar-stripe jar-stripe force-pushed the jar/enable-decimal-string-v2 branch from ea64f6a to 800fdf7 Compare March 19, 2026 04:23
@jar-stripe jar-stripe changed the base branch from beta to master March 19, 2026 04:53
@jar-stripe jar-stripe requested a review from a team as a code owner March 19, 2026 04:53
@jar-stripe jar-stripe requested review from mbroshi-stripe and removed request for a team March 19, 2026 04:53
@jar-stripe jar-stripe enabled auto-merge (squash) March 20, 2026 15:31
@jar-stripe jar-stripe merged commit 9a5d723 into master Mar 20, 2026
13 checks passed
@jar-stripe jar-stripe deleted the jar/enable-decimal-string-v2 branch March 20, 2026 15:35
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