docs(spec): clarify customerType is immutable on PATCH /customers#497
docs(spec): clarify customerType is immutable on PATCH /customers#497jklein24 wants to merge 1 commit into
Conversation
customerType is required on PATCH because it's the discriminator for the oneOf request body, but must match the existing customer's type. The audit found callers accidentally mutating customer type via PATCH. Refs AT-5336
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✱ Stainless preview builds for gridThis PR will update the cli csharp go kotlin openapi php python ruby typescript Edit this comment to update them. They will appear in their respective SDK's changelogs. ✅ grid-cli studio · code · diff
✅ grid-openapi studio · code · diff
✅ grid-ruby studio · code · diff
✅ grid-go studio · code · diff
✅ grid-python studio · code · diff
⏳ grid-csharp studio · code · diff
✅ grid-kotlin studio · code · diff
✅ grid-typescript studio · code · diff
✅ grid-php studio · code · diff
⏳ These are partial results; builds are still running. This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Greptile SummaryThis PR adds a clarifying
Confidence Score: 5/5Documentation-only clarification with no behavioural or schema changes — safe to merge. All three files change only the description on an existing required field; the allOf wrapping is the standard OpenAPI 3.x idiom and does not alter validation semantics. The source file was edited in the canonical location and the two generated bundles reflect a consistent make build output. No files require special attention.
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/customers/CustomerUpdateRequest.yaml | Source schema edit — adds immutability description to customerType using the correct allOf+$ref pattern. |
| openapi.yaml | Generated bundle updated consistently with the source schema change; diff matches expected make build output. |
| mintlify/openapi.yaml | Mintlify-targeted generated bundle; identical change as root openapi.yaml, consistent with bundler output. |
Sequence Diagram
sequenceDiagram
participant Client
participant API as PATCH /customers/{id}
participant DB
Client->>API: "PATCH { customerType: INDIVIDUAL, ... }"
API->>DB: Fetch existing customer
DB-->>API: "Customer { customerType: INDIVIDUAL }"
API->>API: customerType matches? ✓
API->>DB: Apply update (non-type fields only)
DB-->>API: Updated customer
API-->>Client: 200 OK
Note over Client,API: If submitted customerType ≠ existing type
Client->>API: "PATCH { customerType: BUSINESS, ... }"
API->>DB: Fetch existing customer
DB-->>API: "Customer { customerType: INDIVIDUAL }"
API->>API: customerType matches? ✗
API-->>Client: 400 INVALID_INPUT
Reviews (1): Last reviewed commit: "docs(spec): clarify customerType is immu..." | Re-trigger Greptile
|
Closing — the underlying defects (filed under epic AT-5324) are server-side runtime issues that need to be fixed in sparkcore, not here in the spec. These spec-level clarifications can be reopened as follow-ups once the server fixes land if still useful. |

Summary
Adds a
descriptionto thecustomerTypeproperty on the customer-updaterequest schemas clarifying that this field is the request-body
discriminator and must equal the existing customer's type. Type changes
require a new customer.
Why
The error audit (parent epic AT-5324) found callers can submit a
different
customerTypeon PATCH than the existing customer's, silentlyconverting INDIVIDUAL → BUSINESS (or vice versa) and losing required
fields. The server-side rejection fix is tracked under the same ticket;
this PR tightens the spec so the contract is unambiguous.
Test plan
make buildcleanmake lintcleancustomer-update schemas.
Refs AT-5336