config-loader: validate each schema upfront to provide a more precise error message

This commit is contained in:
Patrik Oldsberg
2021-01-29 16:58:48 +01:00
parent 03177610a8
commit bdbeaf6051
@@ -69,6 +69,14 @@ export function compileConfigSchemas(
},
});
for (const schema of schemas) {
try {
ajv.compile(schema.value);
} catch (error) {
throw new Error(`Schema at ${schema.path} is invalid, ${error}`);
}
}
const merged = mergeAllOf(
{ allOf: schemas.map(_ => _.value) },
{