Skip to content

Regenerate with decimal_string enabled for v2 APIs#3329

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

Regenerate with decimal_string enabled for v2 APIs#3329
jar-stripe merged 7 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 decimal?. A codegen workaround suppressed decimal_string type mapping for all v2 APIs. That workaround has been removed.

What?

  • Regenerated code with decimal_string enabled for v2 APIs

Merge dependency

Merge first: #3327 (STJ migration phase 1)

This branch is based on jar/stj-migration-phase1 because the codegen generates System.Text.Json annotations that only exist on that branch. This PR should be merged after #3327 lands.

Testing

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

  1. decimal? deserialization from JSON string (STJ) ✓
  2. decimal? null when field absent ✓
  3. decimal? high precision (10 decimal places) ✓
  4. Amount consolidation (shared V2.Amount class) ✓
  5. Live V2 Account create with decimal? percentOwnership ✓
  6. Live V2 Account retrieve — round-trip decimal? percentOwnership ✓

See Also

Changelog

  • ⚠️ Breaking change: V2 API decimal fields changed type from string to decimal?. Code that reads or writes these fields as string will need to use decimal? instead. Affected fields:
    • AccountPersonRelationship: PercentOwnership
    • AccountIdentityIndividualRelationship: PercentOwnership
    • Options: AccountCreateIdentityIndividualRelationshipOptions, AccountUpdateIdentityIndividualRelationshipOptions, AccountTokenCreateIdentityIndividualRelationshipOptions, PersonCreateRelationshipOptions, PersonUpdateRelationshipOptions, PersonTokenCreateRelationshipOptions

@jar-stripe jar-stripe requested a review from a team as a code owner March 18, 2026 22:25
@jar-stripe jar-stripe requested review from xavdid-stripe and removed request for a team March 18, 2026 22:25
jar-stripe and others added 6 commits March 18, 2026 18:15
…hanges

System.Text.Json migration for stripe-dotnet. This commit contains all
hand-written (non-generated) changes:

- Add STJ package references and multi-TFM support
- STJ converter implementations (AnyOf, Expandable, DateTime, Enum, etc.)
- Engine swap: deserialize/serialize paths now use System.Text.Json
- Base entity/service/options classes updated with STJ attributes
- Hand-written entity and service classes updated with STJ attributes
- Request serialization migrated to STJ
- All tests updated for STJ as primary deserializer
- Wholesome tests for STJ attribute coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
Machine-generated changes from OpenAPI spec codegen. All files in this
commit contain the "File generated from our OpenAPI spec" header.

Adds System.Text.Json attributes ([JsonPropertyName], [JsonConverter],
etc.) to all generated entity and service option classes.

This commit can be skipped during review — the hand-written infrastructure
that drives these attributes is in the previous commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
…hase1

Committed-By-Agent: claude

# Conflicts:
#	src/Stripe.net/Entities/Charges/ChargePaymentMethodDetailsCardPresent.cs
#	src/Stripe.net/Entities/Charges/ChargePaymentMethodDetailsInteracPresent.cs
#	src/Stripe.net/Entities/ConfirmationTokens/ConfirmationTokenPaymentMethodPreviewCardGeneratedFromPaymentMethodDetailsCardPresent.cs
#	src/Stripe.net/Entities/Mandates/MandatePaymentMethodDetailsBacsDebit.cs
#	src/Stripe.net/Entities/PaymentAttemptRecords/PaymentAttemptRecordPaymentMethodDetailsCardPresent.cs
#	src/Stripe.net/Entities/PaymentAttemptRecords/PaymentAttemptRecordPaymentMethodDetailsInteracPresent.cs
#	src/Stripe.net/Entities/PaymentIntents/PaymentIntentPaymentMethodOptionsUsBankAccount.cs
#	src/Stripe.net/Entities/PaymentMethods/PaymentMethodCardGeneratedFromPaymentMethodDetailsCardPresent.cs
#	src/Stripe.net/Entities/PaymentRecords/PaymentRecordPaymentMethodDetailsCardPresent.cs
#	src/Stripe.net/Entities/PaymentRecords/PaymentRecordPaymentMethodDetailsInteracPresent.cs
#	src/Stripe.net/Entities/Reserve/Holds/Hold.cs
#	src/Stripe.net/Entities/Reserve/Holds/HoldReleaseSchedule.cs
#	src/Stripe.net/Entities/Reserve/Plans/Plan.cs
#	src/Stripe.net/Entities/Reserve/Plans/PlanFixedRelease.cs
#	src/Stripe.net/Entities/Reserve/Plans/PlanRollingRelease.cs
#	src/Stripe.net/Entities/Reserve/Releases/Release.cs
#	src/Stripe.net/Entities/Reserve/Releases/ReleaseSourceTransaction.cs
#	src/Stripe.net/Entities/Tax/Registrations/RegistrationCountryOptions.cs
#	src/Stripe.net/Entities/Tax/Registrations/RegistrationCountryOptionsLk.cs
#	src/Stripe.net/Entities/Terminal/Configurations/Configuration.cs
#	src/Stripe.net/Entities/Terminal/Configurations/ConfigurationCellular.cs
#	src/Stripe.net/Entities/Terminal/Configurations/ConfigurationStripeS710.cs
#	src/Stripe.net/Entities/V2/Billing/MeterEventAdjustments/MeterEventAdjustment.cs
#	src/Stripe.net/Entities/V2/Billing/MeterEventSessions/MeterEventSession.cs
#	src/Stripe.net/Services/PaymentIntents/PaymentIntentPaymentMethodOptionsUsBankAccountOptions.cs
#	src/Stripe.net/Services/PaymentLinks/PaymentLinkUpdateOptions.cs
#	src/Stripe.net/Services/SubscriptionItems/SubscriptionItemDeleteOptions.cs
#	src/Stripe.net/Services/Tax/Registrations/RegistrationCountryOptionsLkOptions.cs
#	src/Stripe.net/Services/Tax/Registrations/RegistrationCountryOptionsOptions.cs
#	src/Stripe.net/Services/Terminal/Configurations/ConfigurationCellularOptions.cs
#	src/Stripe.net/Services/Terminal/Configurations/ConfigurationCreateOptions.cs
#	src/Stripe.net/Services/Terminal/Configurations/ConfigurationStripeS710Options.cs
#	src/Stripe.net/Services/Terminal/Configurations/ConfigurationUpdateOptions.cs
…d-trip test

Delete NewtonsoftAndSystemTextJsonDeserializeTheSameObject which iterated
over ~4700 entity types with reflection-heavy object population, causing
CI timeouts (7+ minutes, killed by SIGTERM).

Replace with a focused test in DeserializationTest that exercises every
property type pattern (string, long, bool, decimal, decimal_string,
DateTime, nested object, list, expandable field, map, StripeList) through
both STJ and Newtonsoft deserialization and verifies equivalence. Add
DecimalStringConverter attributes to close the one coverage gap.

Other wholesome tests already verify all types have correct STJ attributes
(PropertiesHaveAllNecessaryJsonAttributes, CorrectSystemTextJsonConvertersForTypes)
and that serialization output matches (OutputTheSameObject).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
V2 API fields with `format: decimal` now generate as `decimal?` instead
of `string`, matching v1 behavior. 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 b7e8ef1 to bbf5aa2 Compare March 19, 2026 04:37
@jar-stripe jar-stripe changed the base branch from beta to jar/stj-migration-phase1 March 19, 2026 04:53
Base automatically changed from jar/stj-migration-phase1 to master March 19, 2026 15:28
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