Skip to content

chore(stainless): bump edition, sync resources, fix webhook discrimination#525

Merged
pengying merged 1 commit into
mainfrom
05-28-chore_stainless_expose_document_models_and_body_param_names
May 29, 2026
Merged

chore(stainless): bump edition, sync resources, fix webhook discrimination#525
pengying merged 1 commit into
mainfrom
05-28-chore_stainless_expose_document_models_and_body_param_names

Conversation

@pengying
Copy link
Copy Markdown
Contributor

@pengying pengying commented May 28, 2026

Summary

Bumps the Stainless edition and syncs several resource definitions to match the current API surface and codegen needs.

Edition

  • Bump root edition: 2025-10-102026-05-06.
  • Drop the now-redundant pinned kotlin.2025-10-08 edition; the new root edition covers it.

Webhook discrimination

  • webhooks.unwrap: add discriminator: type so the unwrap codegen dispatches on the payload's type field.
  • New openapi.transforms entry: strip type from BaseWebhook.properties and BaseWebhook.required. Without this, every generated *WebhookEvent carries the full WebhookType enum on its type field via BaseWebhook, defeating the discriminator — variants that share the same data shape (e.g. multiple Card-related webhooks) become indistinguishable and the deserializer picks the first one declared. Same pattern already applied to customer / account / source / destination / auth base schemas in this file.

Card refund (Kotlin keyword fix carry-over)

Resource cleanup — customers

  • Drop the customers.models block. Customer / kyc / internal-account types are now exposed via $shared.models and resource subresources directly.
  • Drop the standalone create_kyc_link method definition; the API surface is covered by generate_kyc_link (renamed earlier in chore(stainless): add ruby/go/csharp/php/cli targets and sync resources #518).
  • Simplify update_internal_account to the short form (the body_param_name was redundant).

Resource cleanup — auth

  • Move auth_session model alias from sessionscredentials (the canonical location for credential-related types).
  • Drop the per-variant *CredentialCreateRequest / *CredentialVerifyRequest model aliases (email_otp_*, oauth_*, passkey_*) for the verify side. Stainless collapses these schemas to their Fields siblings after the existing type-strip transforms; exposing the wrapper aliases generated broken imports in the TS SDK (TS2724 / TS2552). See chore(stainless): add ruby/go/csharp/php/cli targets and sync resources #518 for the original diagnosis.
  • Drop auth_session_refresh_request and the explicit body_param_name on sessions.refresh; covered by the new edition's defaults.

New $shared models

Surface a few schemas that consumers need to reference directly:

  • individual_customer, business_customer, beneficial_owner, business_info_update, swift_beneficiary

agents

  • Add agent_account_rule model alias.

Stack

Stacked on top of #521.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
grid-flow-builder Ignored Ignored Preview May 29, 2026 5:04pm

Request Review

Copy link
Copy Markdown
Contributor Author

pengying commented May 28, 2026

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Greptile Summary

This PR updates .stainless/stainless.yml to improve the generated SDK for the documents resource by adding body_param_name hints to the upload and replace methods and explicitly registering five document schemas in the models block.

  • upload and replace methods are expanded from simple endpoint strings to objects with endpoint + body_param_name, matching the pattern already used in auth.credentials and auth.sessions.
  • Five schemas are added to documents.models: Document, DocumentListResponse, DocumentType, DocumentUploadRequest, and DocumentReplaceRequest.
  • Both DocumentUploadRequest and DocumentReplaceRequest are discriminated oneOf schemas; their concrete sub-type variants (IdentityDocumentUploadRequest, NonIdentityDocumentUploadRequest, etc.) are not listed in models, unlike the analogous treatment in auth.credentials.

Confidence Score: 4/5

Safe to merge; the change only affects SDK code generation config and does not touch runtime API logic.

The change is straightforward configuration following established patterns in the file. The one open question is whether the discriminated-union sub-types need explicit model entries to be surfaced in the generated SDK — comparable resources list them explicitly, but this may be intentional or Stainless may resolve them automatically.

.stainless/stainless.yml — specifically the new documents.models block and whether the oneOf sub-types require explicit entries.

Important Files Changed

Filename Overview
.stainless/stainless.yml Expands the documents resource: adds body_param_name to upload and replace methods, and adds a models section exposing five schemas. Sub-type variants of the oneOf request schemas are not listed, which differs from the pattern used in other resources like auth.credentials.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Stainless SDK Generator] --> B[documents resource]
    B --> C[Methods]
    B --> D[Models]
    C --> C1["upload (POST /documents)\nbody_param_name: DocumentUploadRequest"]
    C --> C4["replace (PUT /documents/{id})\nbody_param_name: DocumentReplaceRequest"]
    D --> D1[Document]
    D --> D2[DocumentListResponse]
    D --> D3[DocumentType]
    D --> D4[DocumentUploadRequest]
    D --> D5[DocumentReplaceRequest]
    D4 -. oneOf .-> D4a[IdentityDocumentUploadRequest]
    D4 -. oneOf .-> D4b[NonIdentityDocumentUploadRequest]
    D5 -. oneOf .-> D5a[IdentityDocumentReplaceRequest]
    D5 -. oneOf .-> D5b[NonIdentityDocumentReplaceRequest]
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
.stainless/stainless.yml:475-480
**Missing oneOf sub-type models for request schemas**

`DocumentUploadRequest` and `DocumentReplaceRequest` are discriminated `oneOf` schemas — their actual concrete variants are `IdentityDocumentUploadRequest` / `NonIdentityDocumentUploadRequest` and `IdentityDocumentReplaceRequest` / `NonIdentityDocumentReplaceRequest`. The comparable `auth.credentials` resource explicitly lists all union variants (e.g. `email_otp_credential_create_request`, `passkey_credential_create_request`, `oauth_credential_create_request`). Without listing the variants here, generated SDK consumers may not have access to the concrete types they need to construct a valid request body — they'd only see the opaque top-level union. Consider adding `identity_document_upload_request`, `non_identity_document_upload_request`, `identity_document_replace_request`, `non_identity_document_replace_request`, `identity_document_type`, and `non_identity_document_type` to this `models` block, or confirm that Stainless resolves sub-types automatically for discriminated unions.

Reviews (1): Last reviewed commit: "chore(stainless): expose document models..." | Re-trigger Greptile

Comment thread .stainless/stainless.yml Outdated
Comment on lines +475 to +480
models:
document: "#/components/schemas/Document"
document_list_response: "#/components/schemas/DocumentListResponse"
document_type: "#/components/schemas/DocumentType"
document_upload_request: "#/components/schemas/DocumentUploadRequest"
document_replace_request: "#/components/schemas/DocumentReplaceRequest"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing oneOf sub-type models for request schemas

DocumentUploadRequest and DocumentReplaceRequest are discriminated oneOf schemas — their actual concrete variants are IdentityDocumentUploadRequest / NonIdentityDocumentUploadRequest and IdentityDocumentReplaceRequest / NonIdentityDocumentReplaceRequest. The comparable auth.credentials resource explicitly lists all union variants (e.g. email_otp_credential_create_request, passkey_credential_create_request, oauth_credential_create_request). Without listing the variants here, generated SDK consumers may not have access to the concrete types they need to construct a valid request body — they'd only see the opaque top-level union. Consider adding identity_document_upload_request, non_identity_document_upload_request, identity_document_replace_request, non_identity_document_replace_request, identity_document_type, and non_identity_document_type to this models block, or confirm that Stainless resolves sub-types automatically for discriminated unions.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .stainless/stainless.yml
Line: 475-480

Comment:
**Missing oneOf sub-type models for request schemas**

`DocumentUploadRequest` and `DocumentReplaceRequest` are discriminated `oneOf` schemas — their actual concrete variants are `IdentityDocumentUploadRequest` / `NonIdentityDocumentUploadRequest` and `IdentityDocumentReplaceRequest` / `NonIdentityDocumentReplaceRequest`. The comparable `auth.credentials` resource explicitly lists all union variants (e.g. `email_otp_credential_create_request`, `passkey_credential_create_request`, `oauth_credential_create_request`). Without listing the variants here, generated SDK consumers may not have access to the concrete types they need to construct a valid request body — they'd only see the opaque top-level union. Consider adding `identity_document_upload_request`, `non_identity_document_upload_request`, `identity_document_replace_request`, `non_identity_document_replace_request`, `identity_document_type`, and `non_identity_document_type` to this `models` block, or confirm that Stainless resolves sub-types automatically for discriminated unions.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from c072600 to aeca0f5 Compare May 28, 2026 19:04
@pengying pengying changed the title chore(stainless): expose document models and body_param_names chore(stainless): set body_param_name on document upload/replace May 28, 2026
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from aeca0f5 to a111ae8 Compare May 28, 2026 20:51
@pengying pengying changed the title chore(stainless): set body_param_name on document upload/replace chore(stainless): fix webhook discrimination and pin document body param names May 28, 2026
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from a111ae8 to c031718 Compare May 28, 2026 22:41
@pengying pengying changed the title chore(stainless): fix webhook discrimination and pin document body param names chore(stainless): bump edition, sync resources, fix webhook discrimination May 28, 2026
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from c031718 to bd0bc88 Compare May 28, 2026 22:43
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from bd0bc88 to 6393370 Compare May 28, 2026 22:44
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 6393370 to 8080538 Compare May 28, 2026 23:02
@pengying pengying force-pushed the 05-27-fix_spectral_catch_oneof_without_discriminator_at_all_schema_depths branch from bd7bf74 to 6d31e9c Compare May 28, 2026 23:09
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 8080538 to 98f05d1 Compare May 28, 2026 23:09
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 98f05d1 to 4245cd6 Compare May 28, 2026 23:32
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 4245cd6 to 1410aee Compare May 28, 2026 23:51
AaryamanBhute
AaryamanBhute previously approved these changes May 29, 2026
@pengying pengying force-pushed the 05-27-fix_spectral_catch_oneof_without_discriminator_at_all_schema_depths branch 2 times, most recently from dc08535 to 4cc01d1 Compare May 29, 2026 00:19
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 1410aee to 884ca72 Compare May 29, 2026 00:19
Copy link
Copy Markdown

@restamp-bot restamp-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

884ca72 is a pure rebase onto 4cc01d1. Approving based on @AaryamanBhute's previous approval of 1410aee.

@pengying pengying changed the base branch from 05-27-fix_spectral_catch_oneof_without_discriminator_at_all_schema_depths to graphite-base/525 May 29, 2026 17:04
Copy link
Copy Markdown

@restamp-bot restamp-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

884ca72 is a pure rebase onto 4cc01d1. Approving based on @AaryamanBhute's previous approval of 1410aee.

@pengying pengying force-pushed the graphite-base/525 branch from 4cc01d1 to d9e464f Compare May 29, 2026 17:04
@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 884ca72 to 73bb1e6 Compare May 29, 2026 17:04
Copy link
Copy Markdown

@restamp-bot restamp-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

73bb1e6 is a pure rebase onto d9e464f. Approving based on @AaryamanBhute's previous approval of 1410aee.

restamp-bot[bot]
restamp-bot Bot previously approved these changes May 29, 2026
Copy link
Copy Markdown

@restamp-bot restamp-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

73bb1e6 is a pure rebase onto d9e464f. Approving based on @AaryamanBhute's previous approval of 1410aee.

@graphite-app graphite-app Bot changed the base branch from graphite-base/525 to main May 29, 2026 17:04
@graphite-app graphite-app Bot dismissed stale reviews from restamp-bot[bot] and AaryamanBhute May 29, 2026 17:04

The base branch was changed.

@pengying pengying force-pushed the 05-28-chore_stainless_expose_document_models_and_body_param_names branch from 73bb1e6 to 5db6f8a Compare May 29, 2026 17:04
Copy link
Copy Markdown

@restamp-bot restamp-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

73bb1e6 is a pure rebase onto d9e464f. Approving based on @AaryamanBhute's previous approval of 1410aee.

Copy link
Copy Markdown

@restamp-bot restamp-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5db6f8a is a pure rebase onto d9e464f. Approving based on @AaryamanBhute's previous approval of 1410aee.

@pengying pengying merged commit 6aed011 into main May 29, 2026
8 checks passed
@pengying pengying deleted the 05-28-chore_stainless_expose_document_models_and_body_param_names branch May 29, 2026 18: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.

2 participants