Skip to content

Commit 4d84e0b

Browse files
rix0rrrRomainMuller
authored andcommitted
fix(jsii-spec): show deep validation errors (#452)
1 parent 675b86a commit 4d84e0b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/jsii-spec/lib/validate-assembly.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export const schema: jsonschema.Schema = require('../schema/jsii-spec.schema.jso
66

77
export function validateAssembly(obj: any): Assembly {
88
const validator = new jsonschema.Validator();
9-
const result = validator.validate(obj, schema);
9+
validator.addSchema(schema); // For definitions
10+
const result = validator.validate(obj, schema, { nestedErrors: true } as any); // nestedErrors does exist but is not in the TypeScript definitions
1011
if (result.valid) { return obj; }
1112
throw new Error(`Invalid assembly:\n${result}`);
12-
}
13+
}

0 commit comments

Comments
 (0)