Skip to content

Update generated code for beta - #1892

Open
stripe-openapi[bot] wants to merge 4 commits into
betafrom
latest-codegen-beta
Open

Update generated code for beta#1892
stripe-openapi[bot] wants to merge 4 commits into
betafrom
latest-codegen-beta

Conversation

@stripe-openapi

@stripe-openapi stripe-openapi Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codegen for openapi v2454 and v2 openapi af6426adecfde0dbc0f84a7b38a62b476b8da5e3.

Changelog

  • Release specs are identical.

@stripe-openapi
stripe-openapi Bot requested a review from a team as a code owner August 27, 2026 08:00
@stripe-openapi
stripe-openapi Bot requested review from zacchua-stripe and removed request for a team and zacchua-stripe August 27, 2026 08:00
@stripe-openapi
stripe-openapi Bot enabled auto-merge August 27, 2026 08:00
@stripe-openapi
stripe-openapi Bot force-pushed the latest-codegen-beta branch 8 times, most recently from 4654fff to 7d77981 Compare August 27, 2026 22:24
* Add discriminated union serialization tests

Tests discriminated union type shapes for both request-side (TypedDict
params with Literal discriminator) and response-side (StripeObject
deserialization), covering standalone and inline variants.

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

* Clarify test docstring scope and dict() comment

The module docstring now explicitly states these tests exercise runtime
semantics (dict construction, field access, round-trip), not static type
narrowing. The dict() comment explains what it's actually testing.

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

* Rewrite DU tests: correct inline pattern + route through _api_encode

Inline union tests now use the flattened TypedDict pattern (discriminator
and per-variant payload fields on the parent) rather than the incorrect
per-variant TypedDicts-with-type-field pattern that was there before.

Request-side tests now exercise `_api_encode` so they verify real SDK
encoding behavior (bracket notation, nested dicts) rather than just dict
construction and key lookup.

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

* Dispatch discriminated union fields to their variant class

A discriminated union field arrived as a dict with no class attached, so it
became a bare StripeObject. That object carries no `_field_encodings`, so an
int64 or decimal field inside a variant stayed a string — `luminance` came
back as "1500" rather than 1500.

Codegen already emits `_inner_class_union_variant_types` on the parent
(`{"color": ("model", {"rgb": RgbColor, ...})}`); nothing read it. Consume it
in `_update_attributes` so the discriminator inside the value selects the
variant class, which then applies its own encodings.

Mirrors stripe-ruby#1923. Falls back to a plain StripeObject when the
discriminator is absent, is not a string, or names a variant this release
does not know, so a variant the API adds later still deserializes.

Rewrites tests/test_discriminated_unions.py, which could not detect any of
this: every response-side test ran `StripeObject.construct_from` on the base
class with no variant map, so all seven passed identically against `{"foo":
1}`. The fixtures now mirror the generated shape — two color variants with
*different* encodings — so identical wire bytes hydrate differently based
only on the discriminator. Seven of the 24 tests fail with the dispatch line
reverted.

The request side moves from `_api_encode` to `_coerce_v2_params`.
`_api_encode` is v1 form encoding, which treats any dict identically and so
asserted nothing about unions; v2 requests coerce through the method-level
schema. One test pins the generator's deliberate flattening of variants into
one field-name-keyed map.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@stripe-openapi
stripe-openapi Bot force-pushed the latest-codegen-beta branch from 7d77981 to 4bfc7a7 Compare August 28, 2026 17:16
Replace --quiet with stdout redirection. Ruff's --quiet flag suppresses
all output including parse errors (e.g. merge markers), making format
failures in CI impossible to diagnose. Redirecting stdout to /dev/null
suppresses the file list but lets errors (which go to stderr) through.


Committed-By-Agent: claude

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@stripe-openapi
stripe-openapi Bot force-pushed the latest-codegen-beta branch 5 times, most recently from 1f1a69c to 7c4a2c0 Compare August 28, 2026 19:55
private-preview's ci.yml differs from master's by one additive hunk:
`private-preview` in `on.push.branches`.

Because that hunk lives only on private-preview, every merge of master into
private-preview yields a workflow blob matching neither parent. GitHub refuses a
push from a GitHub App lacking `workflows` permission when it introduces a
workflow blob that does not already exist in the repository, so the codegen repo's
Codegen job's push to latest-codegen-private-preview is rejected and a human has
to perform the merge by hand. Holding the hunk on master too means both sides of
the merge carry the same change, the merge result is byte-identical to master's
blob, and the App only ever carries an already-committed file forward.

The hunk is a no-op on master. For a push event the workflow file comes from the
pushed ref, so master's copy listing private-preview is never consulted for a
push to private-preview, and it cannot affect pushes to master or beta.
`on.pull_request.branches` already lists private-preview.


Committed-By-Agent: claude

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@stripe-openapi
stripe-openapi Bot force-pushed the latest-codegen-beta branch from 7c4a2c0 to 3be9dd7 Compare August 29, 2026 08:35
@stripe-openapi
stripe-openapi Bot force-pushed the latest-codegen-beta branch from 3be9dd7 to a7bb107 Compare August 29, 2026 08:54
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