feat(openapi): require businessInfo.country on business customer create - #790
feat(openapi): require businessInfo.country on business customer create#790JasonCWang wants to merge 1 commit into
Conversation
`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>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
✱ Stainless preview builds for gridThis PR will update the cli go kotlin openapi php python ruby typescript Edit this comment to update them. They will appear in their respective SDK's changelogs. ✅ grid-typescript studio · code · diff
✅ grid-openapi studio · code · diff
✅ grid-ruby studio · code · diff
✅ grid-go studio · code · diff
✅ grid-kotlin studio · code · diff
✅ grid-python studio · code · diff
✅ grid-php studio · code · diff
✅ grid-cli studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
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.pyrejects a business that reachesPOST /verificationswithout 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 —
countryadded toBusinessInfo.yaml'srequiredlist, which applies toBusinessCustomerCreateRequestonly.BusinessInfoUpdate(used byPATCH /customers/{customerId}) is untouched, so partial updates still work as before.This is a breaking change. Adding to a request body's
requiredis an oasdiff ERR, so this PR will pick up thebreaking-changelabel and needs an API reviewer. Callers creating business customers withoutbusinessInfo.countrystart 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.pycurrently 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 intoopenapi.yamlandmintlify/openapi.yaml.create_customer.pyalready treatsbusinessInfo.countryas 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 thenot biz.countryguard in_gen_find_existing_business_customerbecome dead and can be simplified.🤖 Generated with Claude Code