From 4d84e0b241404e01b66e16bfe488c086f24da391 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 15 Apr 2019 09:15:27 +0200 Subject: [PATCH] fix(jsii-spec): show deep validation errors (#452) --- packages/jsii-spec/lib/validate-assembly.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/jsii-spec/lib/validate-assembly.ts b/packages/jsii-spec/lib/validate-assembly.ts index c966bfd0a1..90c4192537 100644 --- a/packages/jsii-spec/lib/validate-assembly.ts +++ b/packages/jsii-spec/lib/validate-assembly.ts @@ -6,7 +6,8 @@ export const schema: jsonschema.Schema = require('../schema/jsii-spec.schema.jso export function validateAssembly(obj: any): Assembly { const validator = new jsonschema.Validator(); - const result = validator.validate(obj, schema); + validator.addSchema(schema); // For definitions + const result = validator.validate(obj, schema, { nestedErrors: true } as any); // nestedErrors does exist but is not in the TypeScript definitions if (result.valid) { return obj; } throw new Error(`Invalid assembly:\n${result}`); -} +} \ No newline at end of file