Cut down schemas by 90%

This commit is contained in:
Rory& committed 2025-11-29 22:22:41 +01:00
1 parent 60a24f0e39
commit 2ebe2a57fb
16 files changed
+302 -82

No files matched your search

+7 -1
View File
@@ -87,7 +87,13 @@ export interface RouteOptions {
export function route(opts: RouteOptions) {
let validate: AnyValidateFunction | undefined;
if (opts.requestBody) {
validate = ajv.getSchema(opts.requestBody);
try {
validate = ajv.getSchema(opts.requestBody);
} catch (e) {
console.error("AJV getSchema failed!");
throw e;
}
if (!validate)
throw new Error(`Body schema ${opts.requestBody} not found`);
}