@@ -47,6 +47,7 @@ executeSynchronous(async () => {
4747 // using 'localPath' here because at this point it is guaranteed that the folder got created (when cloneAndGenerateBasePaths function is invoked)
4848 // or is an existing path
4949 summaryPath = path . join ( localPath , 'summary.log' ) ;
50+ console . log ( `Summary path not passed, using default value: ${ summaryPath } ` ) ;
5051 }
5152
5253 // resolve absolute path
@@ -62,54 +63,68 @@ executeSynchronous(async () => {
6263 const summaryLogger = await getLogger ( summaryPath ) ;
6364
6465 for ( const basePath of basePaths ) {
65- const readme = await validateAndReturnReadmePath ( localPath , basePath ) ;
66- const namespaces = keys ( await getApiVersionsByNamespace ( readme ) ) ;
67- let filteredAutoGenList = findOrGenerateAutogenEntries ( basePath , namespaces )
68- . filter ( x => x . disabledForAutogen !== true ) ;
69-
70- if ( args [ 'readme-files' ] ) {
71- filteredAutoGenList = filteredAutoGenList . filter ( c => {
72- const readmeFiles = args [ 'readme-files' ] ?. map ( x => x . toString ( ) ) ;
73- const r = readmeFiles ?. find ( f => f . startsWith ( 'specification/' + c . basePath ) ) ;
74- if ( r ) {
75- c . readmeFile = r ;
76- return true ;
77- }
78- return false ;
79- } ) ;
80- }
66+ try {
67+ const readme = await validateAndReturnReadmePath ( localPath , basePath ) ;
68+ const namespaces = keys ( await getApiVersionsByNamespace ( readme ) ) ;
69+ let filteredAutoGenList = findOrGenerateAutogenEntries ( basePath , namespaces )
70+ . filter ( x => x . disabledForAutogen !== true ) ;
71+
72+ if ( args [ 'readme-files' ] ) {
73+ filteredAutoGenList = filteredAutoGenList . filter ( c => {
74+ const readmeFiles = args [ 'readme-files' ] ?. map ( x => x . toString ( ) ) ;
75+ const r = readmeFiles ?. find ( f => f . startsWith ( 'specification/' + c . basePath ) ) ;
76+ if ( r ) {
77+ c . readmeFile = r ;
78+ return true ;
79+ }
80+ return false ;
81+ } ) ;
82+ }
8183
82- await clearAutoGeneratedSchemaRefs ( filteredAutoGenList ) ;
83-
84- for ( const autoGenConfig of filteredAutoGenList ) {
85- const pkg = {
86- path : [ 'schemas' ]
87- } as Package ;
88- try {
89- const readme = await validateAndReturnReadmePath ( localPath , autoGenConfig . readmeFile || autoGenConfig . basePath ) ;
90- pkg . packageName = getPackageString ( readme ) ;
91-
92- const newConfigs = await generateSchemas ( readme , autoGenConfig ) ;
93- schemaConfigs . push ( ...newConfigs ) ;
94- pkg . result = 'succeeded' ;
95- } catch ( error ) {
96- pkg . packageName = autoGenConfig . basePath ;
97- pkg . result = 'failed' ;
98- console . log ( chalk . red ( `Caught exception processing autogenlist entry ${ autoGenConfig . basePath } .` ) ) ;
99- console . log ( chalk . red ( error ) ) ;
100-
101- // Use markdown formatting as this summary will be included in the PR description
102- logOut ( summaryLogger ,
103- `<details>
104- <summary>Failed to generate types for path '${ basePath } '</summary>
105- \`\`\`
106- ${ error }
107- \`\`\`
108- </details>
109- ` ) ;
84+ await clearAutoGeneratedSchemaRefs ( filteredAutoGenList ) ;
85+
86+ for ( const autoGenConfig of filteredAutoGenList ) {
87+ const pkg = {
88+ path : [ 'schemas' ]
89+ } as Package ;
90+ try {
91+ const readme = await validateAndReturnReadmePath ( localPath , autoGenConfig . readmeFile || autoGenConfig . basePath ) ;
92+ pkg . packageName = getPackageString ( readme ) ;
93+
94+ const newConfigs = await generateSchemas ( readme , autoGenConfig ) ;
95+ schemaConfigs . push ( ...newConfigs ) ;
96+ pkg . result = 'succeeded' ;
97+ } catch ( error ) {
98+ pkg . packageName = autoGenConfig . basePath ;
99+ pkg . result = 'failed' ;
100+ console . log ( chalk . red ( `Caught exception processing autogenlist entry ${ autoGenConfig . basePath } .` ) ) ;
101+ console . log ( chalk . red ( error ) ) ;
102+
103+ // Use markdown formatting as this summary will be included in the PR description
104+ logOut ( summaryLogger ,
105+ `<details>
106+ <summary>Failed to generate types for path '${ autoGenConfig . basePath } ' and namespace '${ autoGenConfig . namespace } '</summary>
107+ \`\`\`
108+ ${ error }
109+ \`\`\`
110+ </details>
111+ ` ) ;
112+ }
113+ packages . push ( pkg ) ;
110114 }
111- packages . push ( pkg ) ;
115+ } catch ( error ) {
116+ // Use markdown formatting as this summary will be included in the PR description
117+ // This error usually indicates that a file has not been found (readme)
118+ logOut ( summaryLogger ,
119+ `<details>
120+ <summary>Failed to generate types for path '${ basePath } ' probably due to readme not found or due to any other file not found exception.</summary>
121+ \`\`\`
122+ ${ error }
123+ \`\`\`
124+ </details>
125+ ` ) ;
112126 }
127+
113128 }
114129
115130 await saveAutoGeneratedSchemaRefs ( flatten ( schemaConfigs ) ) ;
0 commit comments