Update generated code for beta - #1892
Open
stripe-openapi[bot] wants to merge 4 commits into
Open
Conversation
stripe-openapi
Bot
requested review from
zacchua-stripe
and removed request for
a team and
zacchua-stripe
August 27, 2026 08:00
stripe-openapi
Bot
force-pushed
the
latest-codegen-beta
branch
8 times, most recently
from
August 27, 2026 22:24
4654fff to
7d77981
Compare
* 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
Bot
force-pushed
the
latest-codegen-beta
branch
from
August 28, 2026 17:16
7d77981 to
4bfc7a7
Compare
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
Bot
force-pushed
the
latest-codegen-beta
branch
5 times, most recently
from
August 28, 2026 19:55
1f1a69c to
7c4a2c0
Compare
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
Bot
force-pushed
the
latest-codegen-beta
branch
from
August 29, 2026 08:35
7c4a2c0 to
3be9dd7
Compare
…dbc0f84a7b38a62b476b8da5e3
stripe-openapi
Bot
force-pushed
the
latest-codegen-beta
branch
from
August 29, 2026 08:54
3be9dd7 to
a7bb107
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codegen for openapi v2454 and v2 openapi af6426adecfde0dbc0f84a7b38a62b476b8da5e3.
Changelog