Skip to content

refactor(openapi): extract document upload/replace request bodies into reusable components#517

Merged
pengying merged 1 commit into
mainfrom
05-27-refactor_openapi_extract_document_upload_replace_request_bodies_into_reusable_components
May 28, 2026
Merged

refactor(openapi): extract document upload/replace request bodies into reusable components#517
pengying merged 1 commit into
mainfrom
05-27-refactor_openapi_extract_document_upload_replace_request_bodies_into_reusable_components

Conversation

@pengying
Copy link
Copy Markdown
Contributor

@pengying pengying commented May 28, 2026

Summary

Extracts the inline requestBody definitions on POST /documents and PUT /documents/{documentId} into reusable components under openapi/components/requestBodies/. The bundler now emits a top-level components.requestBodies section with DocumentUploadRequestBody and DocumentReplaceRequestBody, and the path operations reference them with $ref.

No spec semantics change — the bundled output is structurally equivalent: same required: true, same multipart/form-data, same underlying schemas. Only the wire representation in openapi.yaml differs (refs through components.requestBodies instead of inline definitions). This is a likely candidate for downstream tooling that wants to reuse the bodies (e.g. SDK codegen).

Test plan

  • make build succeeds
  • make lint exits 0
  • Confirmed components.requestBodies is populated and the two paths reference it

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

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

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment May 28, 2026 1:12am

Request Review

Copy link
Copy Markdown
Contributor Author

pengying commented May 28, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

✱ Stainless preview builds for grid

This PR will update the grid SDKs with the following commit messages.

cli

refactor(openapi): extract document upload/replace request bodies into reusable components

csharp

refactor(openapi): extract document upload/replace request bodies into reusable components

go

refactor(openapi): extract document upload/replace request bodies into reusable components

kotlin

refactor(openapi): extract document upload/replace request bodies into reusable components

openapi

refactor(openapi): extract document upload/replace request bodies into reusable components

php

refactor(openapi): extract document upload/replace request bodies into reusable components

python

refactor(openapi): extract document upload/replace request bodies into reusable components

ruby

refactor(openapi): extract document upload/replace request bodies into reusable components

typescript

refactor(openapi): extract document upload/replace request bodies into reusable components
⚠️ grid-openapi studio · code

Your SDK build had at least one warning diagnostic.
generate ✅

⚠️ grid-ruby studio · code

Your SDK build had at least one "warning" diagnostic.
generate ⚠️build ⏭️lint ✅test ✅

⚠️ grid-typescript studio · code

Your SDK build had at least one warning diagnostic.
generate ✅build ⏭️lint ⏭️test ✅

⚠️ grid-python studio · code

Your SDK build had at least one warning diagnostic.
generate ✅build ⏭️lint ⏭️test ✅

⚠️ grid-csharp studio · code

Your SDK build had a failure in the test CI job, which is a regression from the base state.
generate ⚠️build ⏭️lint ⏭️test ❗

⚠️ grid-go studio · code

Your SDK build had a failure in the lint CI job, which is a regression from the base state.
generate ✅build ⏭️lint ❗test ❗

go get github.com/stainless-sdks/grid-go@c604778ce8ef9842552fa2476e28cbdd6c68a3bc
⚠️ grid-php studio · code

Your SDK build had at least one warning diagnostic.
generate ✅lint ✅test ✅

⚠️ grid-kotlin studio · code

Your SDK build had a failure in the test CI job, which is a regression from the base state.
generate ✅build ⏭️lint ⏭️test ❗

⚠️ grid-cli studio · code

Your SDK build had a failure in the test CI job, which is a regression from the base state.
generate ⚠️build ⏭️lint ⏭️test ❗


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-05-28 04:39:19 UTC

@pengying pengying force-pushed the 05-27-refactor_openapi_extract_document_upload_replace_request_bodies_into_reusable_components branch from a74c322 to 49ca343 Compare May 28, 2026 01:12
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Greptile Summary

This PR extracts the inline requestBody definitions for the document upload (POST /documents) and document replace (PUT /documents/{documentId}) endpoints into reusable components/requestBodies components, following standard OpenAPI 3.x DRY practices. Both bundled output files (openapi.yaml and mintlify/openapi.yaml) are correctly regenerated via make build.

  • Two new component files (DocumentUploadRequestBody.yaml, DocumentReplaceRequestBody.yaml) are added under openapi/components/requestBodies/, with correct relative $ref paths pointing to the existing schema files.
  • The path files are updated to reference the new components via $ref, and the bundles reflect the change with proper #/components/requestBodies/… pointers — no semantic behaviour change.

Confidence Score: 5/5

Pure structural refactor with no functional changes — safe to merge.

The change only moves inline request body definitions into named components and regenerates the bundles. All relative $ref paths resolve to existing files, the bundled output is consistent with the source, and both bundle targets (openapi.yaml and mintlify/openapi.yaml) are kept in sync.

No files require special attention.

Important Files Changed

Filename Overview
openapi/components/requestBodies/DocumentUploadRequestBody.yaml New reusable requestBody component for document upload; $ref path resolves correctly to the existing DocumentUploadRequest schema.
openapi/components/requestBodies/DocumentReplaceRequestBody.yaml New reusable requestBody component for document replace; $ref path resolves correctly to the existing DocumentReplaceRequest schema.
openapi/paths/documents/documents.yaml POST /documents requestBody replaced with $ref to new DocumentUploadRequestBody component; relative path resolves correctly.
openapi/paths/documents/documents_{documentId}.yaml PUT /documents/{documentId} requestBody replaced with $ref to new DocumentReplaceRequestBody component; relative path resolves correctly.
openapi.yaml Regenerated bundle: inline requestBody definitions replaced with component $refs, and new requestBodies section added to components — consistent with source changes.
mintlify/openapi.yaml Mintlify copy of the regenerated bundle; identical changes to openapi.yaml, correctly kept in sync.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["POST /documents\n(documents.yaml)"] -->|"$ref: ../../components/requestBodies/\nDocumentUploadRequestBody.yaml"| B["DocumentUploadRequestBody.yaml"]
    C["PUT /documents/{documentId}\n(documents_{documentId}.yaml)"] -->|"$ref: ../../components/requestBodies/\nDocumentReplaceRequestBody.yaml"| D["DocumentReplaceRequestBody.yaml"]
    B -->|"$ref: ../schemas/documents/\nDocumentUploadRequest.yaml"| E["DocumentUploadRequest.yaml"]
    D -->|"$ref: ../schemas/documents/\nDocumentReplaceRequest.yaml"| F["DocumentReplaceRequest.yaml"]
    G["make build"] --> H["openapi.yaml\nmintlify/openapi.yaml\n(bundles)"]
    H -->|"#/components/requestBodies/\nDocumentUploadRequestBody"| A
    H -->|"#/components/requestBodies/\nDocumentReplaceRequestBody"| C
Loading

Reviews (1): Last reviewed commit: "refactor(openapi): extract document uplo..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor Author

pengying commented May 28, 2026

Merge activity

  • May 28, 4:32 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 28, 4:32 AM UTC: @pengying merged this pull request with Graphite.

@pengying pengying merged commit 501fdaa into main May 28, 2026
9 checks passed
@pengying pengying deleted the 05-27-refactor_openapi_extract_document_upload_replace_request_bodies_into_reusable_components branch May 28, 2026 04:32
pengying added a commit that referenced this pull request May 28, 2026
…es (#518)

## Summary

Updates the Stainless config to reflect the current API surface and adds five new SDK targets.

### New SDK targets
- `ruby` (gem `grid`, rubygems publish disabled)
- `go` (package `grid`)
- `csharp` (package `grid`, nuget publish disabled)
- `php` (package `grid`, composer `org-placeholder/grid`)
- `cli` (binary `grid`)

All have `production_repo: null` for now.

### Resource sync
- `config.models`: add `embedded_wallet_config`
- `sandbox`: add `cards.simulate` subresource (authorization/clearing/return) with associated card simulation models
- `$shared`: add `slv_external_account_create_info`, `slv_beneficiary`, `swift_external_account_create_info`
- `customers.methods`: add `generate_kyc_link: post /customers/{customerId}/kyc-link`
- `agents`: add `agent_account_restrictions`, `agent_approval_thresholds`
- Add top-level `cards` resource (issue / list / retrieve / update)

### Auth credential verify-request aliases — intentionally omitted

`email_otp_credential_verify_request`, `oauth_credential_verify_request`, and `passkey_credential_verify_request` are **not** added as model aliases. The auth verify-request schemas are defined as:

```yaml
allOf:
  - $ref: AuthCredentialVerifyRequest
  - $ref: <X>CredentialVerifyRequestFields
```

Two existing `openapi.transforms` (lines stripping `type` from `AuthCredentialVerifyRequest.properties`, then removing the `$ref` from `allOf[0]` of each verify variant) reduce these to structurally equivalent to their `Fields` siblings. Stainless collapses the allOf and emits only the `<X>CredentialVerifyRequestFields` types in `credentials.ts`, so a model alias pointing to `<X>CredentialVerifyRequest` would generate broken imports (`TS2724` / `TS2552` in `auth.ts`, `credentials.ts`, `index.ts`).

The create-side aliases work because `AuthCredentialCreateRequest` retains a non-`type` field (`accountId`) after the transform, so its variants don't collapse.

### Other
- `organization.docs`: `docs.lightspark.com` → `grid.lightspark.com`. **Worth a second look** — recent commits (#513, #514) migrated *away* from `grid.lightspark.com` in the docs. Confirm this is intentional before merging.

## Notes

Stacked on top of #517 (document request body refactor); no code dependency between the two — sequencing is just chronological.
pengying pushed a commit that referenced this pull request May 28, 2026
## Summary
- Add required `documentNumber` and `issuingAuthority` fields to identity document upload examples in KYC guide
- Aligns documentation with OpenAPI schema split (#517) that separated document uploads into identity vs non-identity types

## Test plan
- [x] Verify PASSPORT upload examples include all required fields per `IdentityDocumentUploadRequest` schema
- [ ] Review generated Mintlify docs render correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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