Split request and response schemas for external account paymentRails#302
Split request and response schemas for external account paymentRails#302AaryamanBhute wants to merge 1 commit intomainfrom
Conversation
…for paymentRails Remove paymentRails from the create external account request schema while keeping it in the response. Each common *AccountInfo is now split into a *AccountInfoBase (without paymentRails) and *AccountInfo (allOf composition with paymentRails). Request schemas reference *AccountInfoBase via new *ExternalAccountCreateInfo files, while response schemas still use the full *AccountInfo with paymentRails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✱ Stainless preview buildsThis PR will update the kotlin openapi python typescript Edit this comment to update them. They will appear in their respective SDK's changelogs. ✅ grid-typescript studio · code · diff
✅ grid-python studio · code · diff
✅ grid-openapi studio · code · diff
✅ grid-kotlin studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
AaryamanBhute
left a comment
There was a problem hiding this comment.
[Hurlicane-Aary] ## PR Review: Split request/response schemas for external account paymentRails
Overall: Looks good. The approach is clean and the pattern is applied consistently across all 27 currency account types.
What this does
- Splits each
*AccountInfo.yamlinto*AccountInfoBase.yaml(core fields withoutpaymentRails) and*AccountInfo.yaml(allOf composition addingpaymentRailsas required) - Creates new
*ExternalAccountCreateInfo.yamlschemas for each currency that reference the Base variant (nopaymentRails) - Introduces
ExternalAccountCreateInfoOneOf.yamlas the discriminated union for create requests - Updates
ExternalAccountCreateRequestandPlatformExternalAccountCreateRequestto use the new create-specific oneOf - Response schemas (
ExternalAccountInfoOneOf) remain unchanged — responses still includepaymentRails - Request examples in endpoint files correctly remove
paymentRails
Correctness ✅
- The
allOfcomposition in each*AccountInfo.yamlcorrectly extends the Base with a requiredpaymentRailsfield — response schemas are preserved. - The
ExternalAccountCreateInfoOneOfdiscriminator mapping is complete and consistent with the existingExternalAccountInfoOneOf. ExternalAccountDetailsDestination.yaml(used in quotes) correctly referencesExternalAccountCreateRequest, which now uses the create-specific schemas — this is the right call since it's a create context.- The
BaseExternalAccountInfoshared schema is reused properly in all new*ExternalAccountCreateInfo.yamlfiles.
Design ✅
- The
*Base/*Fullpattern viaallOfis the standard OpenAPI approach for this kind of request/response divergence. Clean choice. - The naming convention (
*AccountInfoBasefor shared fields,*AccountInfofor response-complete,*ExternalAccountCreateInfofor request) is clear and consistent.
No blockers found.
One minor note (non-blocking): The PR branch includes 8 commits from other already-merged PRs (#295, #296, #297, #300, etc.). Consider rebasing onto main before merge to keep the history clean, though this is cosmetic.
|
[Hurlicane-Aary] @greptile review |
Greptile SummaryThis PR cleanly splits the external account Key changes:
Confidence Score: 5/5Safe to merge — all 27 fiat currencies are covered correctly, build and lint pass, and no logical issues were found in the schema split The refactoring is mechanically consistent across all 27 fiat currencies: Base schemas correctly extract every field except paymentRails, composed AccountInfo schemas correctly re-add paymentRails via allOf, new CreateInfo schemas correctly reference the Base variants, and the existing response schemas remain untouched. The discriminator union entries match between request and response oneOfs. Both make build and make lint-openapi pass per the test plan. No files require special attention
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/external_accounts/ExternalAccountCreateInfoOneOf.yaml | New request-side discriminator union — all 27 fiat currencies point to *CreateInfo variants (no paymentRails), crypto wallets reuse existing schemas unchanged; mapping is complete and consistent |
| openapi/components/schemas/external_accounts/ExternalAccountCreateRequest.yaml | Single-line change swapping accountInfo $ref from ExternalAccountInfoOneOf to ExternalAccountCreateInfoOneOf — correct |
| openapi/components/schemas/external_accounts/PlatformExternalAccountCreateRequest.yaml | Mirrors ExternalAccountCreateRequest.yaml — accountInfo now points to ExternalAccountCreateInfoOneOf; correct |
| openapi/components/schemas/common/UsdAccountInfo.yaml | Refactored to allOf composition (UsdAccountInfoBase + paymentRails); response schemas continue to resolve all required fields |
| openapi/components/schemas/common/UsdAccountInfoBase.yaml | New base schema with all USD account fields except paymentRails; used by UsdExternalAccountCreateInfo for request bodies |
| openapi/components/schemas/external_accounts/UsdExternalAccountCreateInfo.yaml | New create schema: allOf [BaseExternalAccountInfo + UsdAccountInfoBase + beneficiary]; no paymentRails — correctly mirrors UsdExternalAccountInfo but without that field |
| openapi/paths/customers/customers_external_accounts.yaml | paymentRails removed from POST request body example — consistent with schema change |
| openapi/paths/platform/platform_external_accounts.yaml | paymentRails removed from POST request body example — consistent with schema change |
Class Diagram
%%{init: {'theme': 'neutral'}}%%
classDiagram
class UsdAccountInfoBase {
+accountType: USD_ACCOUNT
+accountNumber: string
+routingNumber: string
}
class UsdAccountInfo {
+paymentRails: array
}
class UsdExternalAccountCreateInfo {
+beneficiary: object
}
class UsdExternalAccountInfo {
+beneficiary: object
}
class ExternalAccountCreateRequest {
+accountInfo: ExternalAccountCreateInfoOneOf
}
class ExternalAccountCreateInfoOneOf {
discriminator: accountType
}
class ExternalAccountInfoOneOf {
discriminator: accountType
}
UsdAccountInfo --|> UsdAccountInfoBase : allOf
UsdExternalAccountCreateInfo --|> UsdAccountInfoBase : allOf (no paymentRails)
UsdExternalAccountInfo --|> UsdAccountInfo : allOf (with paymentRails)
ExternalAccountCreateRequest --> ExternalAccountCreateInfoOneOf : accountInfo
ExternalAccountCreateInfoOneOf --> UsdExternalAccountCreateInfo : USD_ACCOUNT
ExternalAccountInfoOneOf --> UsdExternalAccountInfo : USD_ACCOUNT
Reviews (2): Last reviewed commit: "[Hurlicane-Aary] split external account ..." | Re-trigger Greptile
Summary
paymentRailsis only present in the response, not the request*AccountInfo.yamlis now split into*AccountInfoBase.yaml(withoutpaymentRails) and*AccountInfo.yaml(allOf composition withpaymentRails)*ExternalAccountCreateInfo.yamlschemas reference the Base variants (nopaymentRails), while response schemas continue using the full*AccountInfo.yamlpaymentRailsTest plan
make buildpasses - OpenAPI spec bundles successfullymake lint-openapipasses - validation reportsYour API description is validmake mint🤖 Generated with Claude Code