getInvalidSchemaValues: add additionalProperty to instancePath

This commit is contained in:
Rory& committed 2026-10-16 07:14:13 +02:00
1 parent c944a20aec
commit 5f03867fa9
3 files changed
+5 -1

No files matched your search

Binary file not shown.
Binary file not shown.
+5 -1
View File
@@ -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) {