From 98eadf015fbacdc9fe82e69981aaa0d9579138d5 Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark" Date: Tue, 19 May 2026 09:20:00 -0500 Subject: [PATCH] docs(openapi): pin Customer schema field lengths to match the validators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The OpenAPI \`Customer\` component declared every string field as a bare \`type: 'string'\` with no length constraint. The actual zod validators in customer.schema.js have concrete max lengths (and a fixed \`.length(2)\` on custState per #265). SDK generators (openapi-typescript et al.) consume the OpenAPI spec, so without these constraints client-side types miss the real bounds and a SDK-driven 400 surprises the caller. What changed: - custState: type 'string' with min/maxLength: 2 (per #265 fix) - custZip / custPhone / custEmail: explicit maxLength matching the zod schema (32 / 64 / 255) - custCompanyName / FName / LName / Address1/2 / City: maxLength 255 each No behavior change — runtime still validates via the same zod schema; this just brings the published contract into agreement with reality. 760 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/config/openapi.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/config/openapi.js b/app/config/openapi.js index 91d063b..e1779b9 100644 --- a/app/config/openapi.js +++ b/app/config/openapi.js @@ -38,16 +38,20 @@ const customerSchema = { type: 'object', properties: { custId: { type: 'integer', readOnly: true }, - custCompanyName: { type: 'string' }, - custFName: { type: 'string' }, - custLName: { type: 'string' }, - custAddress1: { type: 'string' }, - custAddress2: { type: 'string' }, - custCity: { type: 'string' }, - custState: { type: 'string' }, - custZip: { type: 'string' }, - custPhone: { type: 'string' }, - custEmail: { type: 'string', format: 'email' }, + custCompanyName: { type: 'string', maxLength: 255 }, + custFName: { type: 'string', maxLength: 255 }, + custLName: { type: 'string', maxLength: 255 }, + custAddress1: { type: 'string', maxLength: 255 }, + custAddress2: { type: 'string', maxLength: 255 }, + custCity: { type: 'string', maxLength: 255 }, + // custState matches the DB column varchar(2) — US state codes + // (NE, CA) + Canadian province codes (AB, BC). Pinning the + // length here so SDK code-gen (openapi-typescript etc.) carries + // the constraint into client types. See #265. + custState: { type: 'string', minLength: 2, maxLength: 2 }, + custZip: { type: 'string', maxLength: 32 }, + custPhone: { type: 'string', maxLength: 64 }, + custEmail: { type: 'string', format: 'email', maxLength: 255 }, custCompId: { type: 'integer' }, custArch: { type: 'boolean', readOnly: true }, },