Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public static synth(root: ConstructNode, options: SynthesisOptions = { }): cxapi.CloudAssembly {
const builder = new cxapi.CloudAssemblyBuilder(options.outdir);
// the three holy phases of synthesis: prepare, validate and synthesize
// prepare
this.prepare(root);
// validate
const validate = options.skipValidation === undefined ? true : !options.skipValidation;
if (validate) {
const errors = this.validate(root);
if (errors.length > 0) {
const errorList = errors.map(e => `[${e.source.node.path}] ${e.message}`).join('\n ');
throw new Error(`Validation failed with the following errors:\n ${errorList}`);
}
}
public synthesize(root: IConstruct, options: SynthesisOptions = { }): CloudAssembly {
const session = new CloudAssemblyBuilder(options.outdir);
// the three holy phases of synthesis: prepare, validate and synthesize
// prepare
root.node.prepareTree();
// validate
const validate = options.skipValidation === undefined ? true : !options.skipValidation;
if (validate) {
const errors = root.node.validateTree();
if (errors.length > 0) {
const errorList = errors.map(e => `[${e.source.node.path}] ${e.message}`).join('\n ');
throw new Error(`Validation failed with the following errors:\n ${errorList}`);
}
}