mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 19:43:16 +00:00
Fix ignored request schemas
This commit is contained in:
1 parent
9ef9744332
commit
efba3f245d
3 files changed
+47
-4
No files matched your search
@@ -32,6 +32,11 @@ import {
|
||||
import { AnyValidateFunction } from "ajv/dist/core";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
|
||||
const ignoredRequestSchemas = [
|
||||
// skip validation for settings proto JSON updates - TODO: figure out if this even possible to fix?
|
||||
"SettingsProtoUpdateJsonSchema"
|
||||
]
|
||||
|
||||
declare global {
|
||||
// TODO: fix this
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
@@ -119,7 +124,8 @@ export function route(opts: RouteOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
if (validate) {
|
||||
|
||||
if (validate && !ignoredRequestSchemas.includes(opts.requestBody!)) {
|
||||
const valid = validate(req.body);
|
||||
if (!valid) {
|
||||
const fields: Record<
|
||||
|
||||
Reference in new issue
Block a user