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