mirror of
https://github.com/spacebarchat/server.git
synced 2026-11-04 11:18:37 +00:00
getInvalidSchemaValues: add additionalProperty to instancePath
This commit is contained in:
1 parent
c944a20aec
commit
5f03867fa9
3 files changed
+5
-1
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -71,7 +71,11 @@ export function validateSchema<G extends object>(schema: string, data: G): G {
|
||||
|
||||
export function getInvalidSchemaValues(data: object, errors: typeof ajv.errors) {
|
||||
if (errors == null) return [];
|
||||
return errors.map((e) => getInvalidSchemaValue(data, e.instancePath));
|
||||
return errors.map((e) => {
|
||||
let instancePath = e.instancePath;
|
||||
if (e.keyword === "additionalProperties") instancePath += `/${e.params.additionalProperty}`;
|
||||
return getInvalidSchemaValue(data, instancePath);
|
||||
});
|
||||
}
|
||||
|
||||
function getInvalidSchemaValue(data: object, instancePath: string) {
|
||||
|
||||
Reference in new issue
Block a user