Skip to content

feat(openapi): require businessInfo.country on business customer create - #790

Draft
JasonCWang wants to merge 1 commit into
mainfrom
jason/business-info-require-country
Draft

feat(openapi): require businessInfo.country on business customer create#790
JasonCWang wants to merge 1 commit into
mainfrom
jason/business-info-require-country

Conversation

@JasonCWang

Copy link
Copy Markdown
Contributor

Reason

businessInfo.country — the country of incorporation — is what decides which other KYB fields a business has to supply; a US business needs close to all of them. That makes it the one field that cannot be deferred: without it, a create request carries no jurisdiction to apply requirements against. It is also already required downstream — verification_validator.py rejects a business that reaches POST /verifications without a country — so a business created without one is simply one that cannot be verified.

Secondary benefit: create-time dedup gets reliable. sparkcore matches an existing business on (registrationNumber, country) and skips the check entirely when either is missing, so today a business created without a country can be silently duplicated.

Overview

One line — country added to BusinessInfo.yaml's required list, which applies to BusinessCustomerCreateRequest only. BusinessInfoUpdate (used by PATCH /customers/{customerId}) is untouched, so partial updates still work as before.

This is a breaking change. Adding to a request body's required is an oasdiff ERR, so this PR will pick up the breaking-change label and needs an API reviewer. Callers creating business customers without businessInfo.country start getting a 400 once the generated clients pick it up — enforcement lives in the generated pydantic model (grid-api/grid_api/models/business_info.py), so nothing changes in sparkcore until that client is regenerated.

Not in this PR: the wider country-conditional rule (which other fields a US vs non-US business must supply at create). verification_validator.py currently requires the same flat business-field list for every country, so that matrix is a product decision rather than something derivable from the code.

Test Plan

  • npm run lint:openapi — redocly lint clean, spectral clean at --fail-severity=error, bundles regenerated into openapi.yaml and mintlify/openapi.yaml.
  • No sparkcore change to test yet: create_customer.py already treats businessInfo.country as optional (parse_country_code(biz.country, "country") if biz.country else None), so it keeps working against either generated client. Once the client is regenerated, that branch and the not biz.country guard in _gen_find_existing_business_customer become dead and can be simplified.

🤖 Generated with Claude Code

`country` is the country of incorporation, and it decides which other KYB fields
a business has to supply — a US business needs close to all of them. It cannot
be a deferred field: without it the create request carries no jurisdiction to
apply requirements against, and `POST /verifications` already rejects a business
that reaches verification without one.

It also makes create-time dedup reliable: sparkcore matches an existing business
on (registrationNumber, country), and skips the check entirely when either is
absent.

Breaking: adding to a request body's `required` is an oasdiff ERR, so this PR
will be labelled breaking-change and needs an API reviewer. Callers that create
business customers without `businessInfo.country` today start getting a 400 once
the generated clients pick this up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mintlify

mintlify Bot commented Aug 3, 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 3, 2026, 10:12 PM

@vercel

vercel Bot commented Aug 3, 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 3, 2026 10:09pm
grid-wallet-demo Ignored Ignored Aug 3, 2026 10:09pm

Request Review

@github-actions github-actions Bot added the breaking-change Introduces a breaking change to the OpenAPI spec label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Breaking OpenAPI changes detected

oasdiff reports 1 error / 0 warning changes to openapi.yaml.
This PR will need approval from an API reviewer before merge.

Errors (1)

  • POST /customers — the request property oneOf[subschema #2: Business Customer Create Request]/allOf[subschema #3]/businessInfo/country became required [request-property-became-required].

Detected by oasdiff. Full report: job summary or the oasdiff-report artifact.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✱ Stainless preview builds for grid

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

cli

chore(internal): regenerate SDK with no functional changes

go

fix(types): make country required in business customer create request

kotlin

fix(types): make country required in BusinessInfo

openapi

fix(types): make country required in business entity

php

fix(types): make country required in BusinessInfo

python

fix(types): make country required in BusinessInfo

ruby

fix(types): make country required in BusinessInfo

typescript

fix(types): make country required in customers BusinessInfo

Edit this comment to update them. They will appear in their respective SDK's changelogs.

grid-typescript studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅lint ❗test ✅

npm install https://pkg.stainless.com/s/grid-typescript/5677d2fbedae8fb209de0bef71eb89c7bc7c8b94/dist.tar.gz
grid-openapi studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️

grid-ruby studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅lint ✅test ✅

grid-go studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅lint ❗test ❗

go get github.com/stainless-sdks/grid-go@2443ccaff7b3f8956ea1c222fe1b26ea46cc3f2d
grid-kotlin studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ✅lint ✅test ❗

grid-python studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅lint ❗test ❗

pip install https://pkg.stainless.com/s/grid-python/8be7f0e2a717fde387b222ea708fe62e1e51bf8e/grid-0.0.1-py3-none-any.whl
grid-php studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅lint ✅test ✅

grid-cli studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
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-03 22:14:54 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Introduces a breaking change to the OpenAPI spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants