mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 19:33:05 +00:00
Cut down schemas by 90%
This commit is contained in:
1 parent
60a24f0e39
commit
2ebe2a57fb
16 files changed
+302
-82
No files matched your search
@@ -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`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user