more validators

This commit is contained in:
Sebastian Seedorf
2020-05-26 16:52:26 +02:00
parent 7367af7fe4
commit 9fa06685ba
13 changed files with 340 additions and 14 deletions

View File

@@ -99,17 +99,8 @@ async function validateSchema(
if (!validators.hasOwnProperty(prop)) {
continue;
}
if (value.hasOwnProperty(prop)) {
const errors = await validate(value[prop], v[prop]);
valErrors.push(...(errors ?? []));
} else {
valErrors.push({
type: "property",
param: [prop],
message: `Property '${prop}' expected but not found!`,
args: { property: prop },
});
}
const errors = await validate(value && value[prop], v[prop]);
valErrors.push(...(errors ?? []));
}
return valErrors;
}