Skip to content

feat(cards): declare card error codes in Error400/Error409 enums - #814

Merged
kphurley7 merged 1 commit into
mainfrom
kph/card-error-codes
Aug 10, 2026
Merged

feat(cards): declare card error codes in Error400/Error409 enums#814
kphurley7 merged 1 commit into
mainfrom
kph/card-error-codes

Conversation

@kphurley7

Copy link
Copy Markdown
Contributor

What

The card endpoints already document these error codes in their response descriptions, but the codes were missing from the machine-readable code enums on Error400 / Error409. Since the generated typed SDKs validate code against those enums on deserialize (code_validate_enum), a client would fail to parse a card error response carrying one of these codes.

This adds them so the enums match what the Grid implementation actually returns:

  • Error400 (POST /cards): CARDHOLDER_KYC_NOT_APPROVED — cardholder KYC status is not APPROVED.
  • Error409 (PATCH /cards/{id}): INVALID_STATE_TRANSITION, CARD_ALREADY_CLOSED, CARD_NOT_MUTABLE.

Both the code.description table and the enum list are updated in each source schema; openapi.yaml and mintlify/openapi.yaml are re-bundled. redocly lint passes.

Why now

The Grid implementation change that returns these codes is in webdev (kph/grid-cards-0a-error-codes). Until this lands and the vendored client is regenerated, a strict SDK consumer can't deserialize those error responses.

Note (out of scope, pre-existing)

The POST /cards 400 description also mentions FUNDING_SOURCE_INELIGIBLE, but the implementation does not currently return that code (it returns INVALID_INPUT), so it is deliberately not added here. That description-vs-implementation gap predates this change and should be closed separately (either implement the code or drop it from the prose).

The card endpoints' response descriptions document these codes, but they
were missing from the machine-readable `code` enums, so the generated
typed SDKs reject deserializing them (code_validate_enum fails). Add:

- Error400: CARDHOLDER_KYC_NOT_APPROVED (POST /cards, cardholder KYC not APPROVED)
- Error409: INVALID_STATE_TRANSITION, CARD_ALREADY_CLOSED, CARD_NOT_MUTABLE (PATCH /cards/{id})

These match exactly the codes the Grid implementation now returns.
Re-bundled openapi.yaml + mintlify/openapi.yaml.
@mintlify

mintlify Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Grid 🟢 Ready View Preview Aug 10, 2026, 8:14 PM

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
grid-flow-builder Ignored Ignored Aug 10, 2026 8:12pm
grid-wallet-demo Ignored Ignored Aug 10, 2026 8:12pm

Request Review

@kphurley7
kphurley7 requested a review from jklein24 August 10, 2026 20:13
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

✱ Stainless preview builds for grid

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

cli

feat(cards): declare card error codes in Error400/Error409 enums

go

chore(internal): regenerate SDK with no functional changes

kotlin

feat(cards): declare card error codes in Error400/Error409 enums

openapi

feat(api): add cardholder KYC and card state error codes

php

feat(cards): declare card error codes in Error400/Error409 enums

python

feat(cards): declare card error codes in Error400/Error409 enums

ruby

feat(cards): declare card error codes in Error400/Error409 enums

typescript

feat(cards): declare card error codes in Error400/Error409 enums
⚠️ 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 "note" diagnostic.
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@fe6dbdfce42d0612b68f37020756315985082d43
⚠️ 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-python 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-php studio · code

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

grid-typescript studio · conflict

Your SDK build had at least one note diagnostic.

⚠️ 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-08-10 20:20:57 UTC

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR synchronizes the machine-readable shared error enums with card error responses already documented by the API.

  • Adds CARDHOLDER_KYC_NOT_APPROVED to Error400.
  • Adds INVALID_STATE_TRANSITION, CARD_ALREADY_CLOSED, and CARD_NOT_MUTABLE to Error409.
  • Regenerates identical root and Mintlify OpenAPI bundles for SDK and documentation consumers.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The new enum values match the documented card response codes, remain synchronized between source schemas and generated bundles, and preserve the repository’s established shared-error-schema workflow.

Important Files Changed

Filename Overview
openapi/components/schemas/errors/Error400.yaml Adds the cardholder KYC error consistently to the description table and machine-readable 400-code enum.
openapi/components/schemas/errors/Error409.yaml Adds the three card state-conflict errors consistently to the description table and machine-readable 409-code enum.
openapi.yaml Regenerated SDK-facing bundle accurately reflects both source-schema changes.
mintlify/openapi.yaml Regenerated documentation bundle remains identical to the root OpenAPI bundle.

Reviews (1): Last reviewed commit: "feat(cards): declare card error codes in..." | Re-trigger Greptile

@kphurley7
kphurley7 merged commit d85db7f into main Aug 10, 2026
9 of 10 checks passed
@kphurley7
kphurley7 deleted the kph/card-error-codes branch August 10, 2026 20:15
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