mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
feat(server): @ResponseContract checks a handler's responses against its shared schema in tests
The decorator records the @trek/shared response schema a route answers with. Under NODE_ENV=test it adds an interceptor that parses every response and fails the request with a logged 500 naming the handler and the issues, so the e2e and integration suites catch a response that drifted from its contract; in production nothing is added to the request path and the body is never rewritten. lint:response-contracts holds the handlers still without one to a per-file baseline that only shrinks, and runs in server-quality.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
"lint:query-api": "node scripts/query-api-ratchet.mjs",
|
||||
"lint:mcp-zod": "node scripts/mcp-inline-zod.mjs",
|
||||
"lint:service-http": "node scripts/service-http-ratchet.mjs",
|
||||
"lint:response-contracts": "node scripts/response-contract-ratchet.mjs",
|
||||
"contracts:dto-open": "node scripts/dto-open-shapes.mjs",
|
||||
"gen:plugin-facts": "node --import tsx scripts/gen-plugin-facts.ts",
|
||||
"check:plugin-facts": "node --import tsx scripts/gen-plugin-facts.ts --check",
|
||||
|
||||
Reference in New Issue
Block a user