diff --git a/generator/cmd/generateall.ts b/generator/cmd/generateall.ts
index 4b3f90b939..b41241d348 100644
--- a/generator/cmd/generateall.ts
+++ b/generator/cmd/generateall.ts
@@ -47,6 +47,7 @@ executeSynchronous(async () => {
// using 'localPath' here because at this point it is guaranteed that the folder got created (when cloneAndGenerateBasePaths function is invoked)
// or is an existing path
summaryPath = path.join(localPath, 'summary.log');
+ console.log(`Summary path not passed, using default value: ${summaryPath}`);
}
// resolve absolute path
@@ -62,54 +63,68 @@ executeSynchronous(async () => {
const summaryLogger = await getLogger(summaryPath);
for (const basePath of basePaths) {
- const readme = await validateAndReturnReadmePath(localPath, basePath);
- const namespaces = keys(await getApiVersionsByNamespace(readme));
- let filteredAutoGenList = findOrGenerateAutogenEntries(basePath, namespaces)
- .filter(x => x.disabledForAutogen !== true);
-
- if (args['readme-files']) {
- filteredAutoGenList = filteredAutoGenList.filter(c => {
- const readmeFiles = args['readme-files']?.map(x => x.toString());
- const r = readmeFiles?.find(f => f.startsWith('specification/' + c.basePath));
- if (r) {
- c.readmeFile = r;
- return true;
- }
- return false;
- });
- }
+ try {
+ const readme = await validateAndReturnReadmePath(localPath, basePath);
+ const namespaces = keys(await getApiVersionsByNamespace(readme));
+ let filteredAutoGenList = findOrGenerateAutogenEntries(basePath, namespaces)
+ .filter(x => x.disabledForAutogen !== true);
+
+ if (args['readme-files']) {
+ filteredAutoGenList = filteredAutoGenList.filter(c => {
+ const readmeFiles = args['readme-files']?.map(x => x.toString());
+ const r = readmeFiles?.find(f => f.startsWith('specification/' + c.basePath));
+ if (r) {
+ c.readmeFile = r;
+ return true;
+ }
+ return false;
+ });
+ }
- await clearAutoGeneratedSchemaRefs(filteredAutoGenList);
-
- for (const autoGenConfig of filteredAutoGenList) {
- const pkg = {
- path: ['schemas']
- } as Package;
- try {
- const readme = await validateAndReturnReadmePath(localPath, autoGenConfig.readmeFile || autoGenConfig.basePath);
- pkg.packageName = getPackageString(readme);
-
- const newConfigs = await generateSchemas(readme, autoGenConfig);
- schemaConfigs.push(...newConfigs);
- pkg.result = 'succeeded';
- } catch(error) {
- pkg.packageName = autoGenConfig.basePath;
- pkg.result = 'failed';
- console.log(chalk.red(`Caught exception processing autogenlist entry ${autoGenConfig.basePath}.`));
- console.log(chalk.red(error));
-
- // Use markdown formatting as this summary will be included in the PR description
- logOut(summaryLogger,
- `
- Failed to generate types for path '${basePath}'
- \`\`\`
- ${error}
- \`\`\`
-
- `);
+ await clearAutoGeneratedSchemaRefs(filteredAutoGenList);
+
+ for (const autoGenConfig of filteredAutoGenList) {
+ const pkg = {
+ path: ['schemas']
+ } as Package;
+ try {
+ const readme = await validateAndReturnReadmePath(localPath, autoGenConfig.readmeFile || autoGenConfig.basePath);
+ pkg.packageName = getPackageString(readme);
+
+ const newConfigs = await generateSchemas(readme, autoGenConfig);
+ schemaConfigs.push(...newConfigs);
+ pkg.result = 'succeeded';
+ } catch(error) {
+ pkg.packageName = autoGenConfig.basePath;
+ pkg.result = 'failed';
+ console.log(chalk.red(`Caught exception processing autogenlist entry ${autoGenConfig.basePath}.`));
+ console.log(chalk.red(error));
+
+ // Use markdown formatting as this summary will be included in the PR description
+ logOut(summaryLogger,
+ `
+ Failed to generate types for path '${autoGenConfig.basePath}' and namespace '${autoGenConfig.namespace}'
+ \`\`\`
+ ${error}
+ \`\`\`
+
+ `);
+ }
+ packages.push(pkg);
}
- packages.push(pkg);
+ } catch (error) {
+ // Use markdown formatting as this summary will be included in the PR description
+ // This error usually indicates that a file has not been found (readme)
+ logOut(summaryLogger,
+ `
+ Failed to generate types for path '${basePath}' probably due to readme not found or due to any other file not found exception.
+ \`\`\`
+ ${error}
+ \`\`\`
+
+ `);
}
+
}
await saveAutoGeneratedSchemaRefs(flatten(schemaConfigs));