mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-14 22:45:14 +00:00
Log schema in validator?
This commit is contained in:
@@ -47,9 +47,12 @@ addFormats(ajv);
|
||||
|
||||
export function validateSchema<G extends object>(schema: string, data: G): G {
|
||||
// skip validation for settings proto JSON updates - TODO: figure out if this even possible?
|
||||
if(schema === "SettingsProtoUpdateJsonSchema") return data;
|
||||
if (schema === "SettingsProtoUpdateJsonSchema") return data;
|
||||
|
||||
const valid = ajv.validate(schema, data);
|
||||
if (!valid) throw ajv.errors;
|
||||
if (!valid) {
|
||||
console.log("[Validator] Validation error in ", schema)
|
||||
throw ajv.errors;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user