From 115e14da34d081009f70829ded15051d326f0688 Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark" Date: Tue, 19 May 2026 09:29:53 -0500 Subject: [PATCH] docs(openapi): pin Company schema field lengths to match the validators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirror of the customer fix in #270. The OpenAPI Company component schema had compState with maxLength: 2 already, but the other fields were unbounded — even though company.schema.js validates them with concrete .min/.max constraints (and the DB columns underneath cap compPhone at varchar(32)). Aligned every string field with the runtime contract: - compName: minLength: 1, maxLength: 255 (per zod min(1).max(255)) - compAddress1/2 / compCity / compEmail: maxLength: 255 - compState: minLength: 2, maxLength: 2 - compZip / compPhone: maxLength: 32 SDK generators (openapi-typescript et al.) now carry the bounds into client types. No behavior change. 760 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/config/openapi.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/config/openapi.js b/app/config/openapi.js index e1779b9..6ae3c3c 100644 --- a/app/config/openapi.js +++ b/app/config/openapi.js @@ -96,14 +96,20 @@ const companySchema = { type: 'object', properties: { compId: { type: 'integer', readOnly: true }, - compName: { type: 'string' }, - compAddress1: { type: 'string' }, - compAddress2: { type: 'string' }, - compCity: { type: 'string' }, - compState: { type: 'string', maxLength: 2 }, - compZip: { type: 'string' }, - compPhone: { type: 'string' }, - compEmail: { type: 'string', format: 'email' }, + // Field-length constraints mirror the zod validators in + // company.schema.js and the DB column widths in + // setup/TimeTracker.sql. Surfacing them here lets SDK + // generators (openapi-typescript et al.) carry the bounds + // into client-side types. Customer got the same treatment + // in #270. + compName: { type: 'string', minLength: 1, maxLength: 255 }, + compAddress1: { type: 'string', maxLength: 255 }, + compAddress2: { type: 'string', maxLength: 255 }, + compCity: { type: 'string', maxLength: 255 }, + compState: { type: 'string', minLength: 2, maxLength: 2 }, + compZip: { type: 'string', maxLength: 32 }, + compPhone: { type: 'string', maxLength: 32 }, + compEmail: { type: 'string', format: 'email', maxLength: 255 }, compArch: { type: 'boolean', readOnly: true }, }, };