From c2935bd1d7c964d19e51d6e4faab3e3102f44c68 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Mon, 22 Jul 2019 13:50:41 +0300 Subject: [PATCH] Better config validator error message for missing properties --- src/validatorUtils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/validatorUtils.ts b/src/validatorUtils.ts index ddbddf44..a1ca1944 100644 --- a/src/validatorUtils.ts +++ b/src/validatorUtils.ts @@ -35,7 +35,10 @@ const report = fold((errors: any) => { return errors.map(err => { if (err.message) return err.message; const context = err.context.map(c => c.key).filter(k => k && !k.startsWith("{")); - return `Invalid value <${stringify(err.value)}> supplied to <${context.join("/")}>`; + const value = stringify(err.value); + return value === undefined + ? `<${context.join("/")}> is required` + : `Invalid value <${stringify(err.value)}> supplied to <${context.join("/")}>`; }); }, noop);