Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(validation): accept .safeParse() as body validation
zenobit8ea614266c9b
diff --git a/scripts/check-route-validation.mjs b/scripts/check-route-validation.mjsindex 5bff8dd306..036341c9db 100644--- a/scripts/check-route-validation.mjs+++ b/scripts/check-route-validation.mjs@@ -8,6 +8,7 @@ const API_ROOT = path.join(ROOT, "src", "app", "api");const FILE_NAME = "route.ts";const REQUEST_JSON_REGEX = /request\.json\s*\(/;const VALIDATE_BODY_REGEX = /\bvalidateBody\s*\(/;+const SAFE_PARSE_REGEX = /\.safeParse\s*\(/;/*** Walk directory recursively and collect route files.@@ -43,13 +44,14 @@ const missingValidation = [];for (const fullPath of routeFiles) {const source = fs.readFileSync(fullPath, "utf8");if (!REQUEST_JSON_REGEX.test(source)) continue;- if (!VALIDATE_BODY_REGEX.test(source)) {+ // Accept either validateBody() or .safeParse() as validation+ if (!VALIDATE_BODY_REGEX.test(source) && !SAFE_PARSE_REGEX.test(source)) {missingValidation.push(path.relative(ROOT, fullPath));}}if (missingValidation.length > 0) {- console.error("[t06:route-validation] FAIL - routes with request.json() without validateBody():");+ console.error("[t06:route-validation] FAIL - routes with request.json() without validateBody() or .safeParse():");for (const file of missingValidation) {console.error(` - ${file}`);}