mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 06:04:05 +00:00
972a246bb6
Adds Zod as the validation library for apps/server (in place of express-validator), scoped here to a low-risk slice rather than a full migration: - MCP tool-call arguments (apps/server/src/api-mcp) are now validated end to end. Every tool's inputSchema is generated from its Zod schema via z.toJSONSchema() instead of hand-maintained JSON Schema literals, and every handler now parses its arguments before use — previously every handler did an unchecked `args as SomeType` cast with no runtime validation at all. - A new validate.ts middleware (validateBody/validateParams) replaces the express-validator chokepoint for two reference routers, session and url-presets, demonstrating the pattern the remaining ~11 routers will follow in later PRs. - An oxlint no-restricted-imports guardrail keeps zod importable only from apps/server, so it can never leak into the apps/client bundle. The bulk of the REST router migration (automation, rundown, and the rest of api-data) is intentionally left for follow-up PRs to keep this change reviewable.
38 lines
821 B
JSON
38 lines
821 B
JSON
{
|
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
"categories": {
|
|
"correctness": "warn",
|
|
"suspicious": "off",
|
|
"pedantic": "off",
|
|
"perf": "warn",
|
|
"style": "off",
|
|
"restriction": "off",
|
|
"nursery": "off"
|
|
},
|
|
"rules": {
|
|
"no-unused-vars": [
|
|
"error",
|
|
{
|
|
"argsIgnorePattern": "^_",
|
|
"varsIgnorePattern": "^_",
|
|
"caughtErrorsIgnorePattern": "^_",
|
|
"destructuredArrayIgnorePattern": "^_",
|
|
"caughtErrors": "none"
|
|
}
|
|
],
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"patterns": ["ontime-types/src/*", "ontime-utils/src/*", "zod"]
|
|
}
|
|
]
|
|
},
|
|
"ignorePatterns": [
|
|
"**/node_modules/**",
|
|
"**/dist/**",
|
|
"apps/client/build/**",
|
|
"apps/electron/assets/**",
|
|
"**/ONTIME_VERSION.js"
|
|
]
|
|
}
|