@@ -45,7 +45,8 @@ async function parse(config: Config): Promise<[Metadata, Swagger]> {
4545
4646function writeSwaggerFile ( swagger : Swagger , apiVersion : string , extensionVersion : string ) {
4747 const swaggerJson : string = JSON . stringify ( swagger , null , 2 ) ;
48- const fullOutputPath = `${ outputPath } /${ apiVersion } ` ;
48+ const releaseType : string = getReleaseTypeFromExtensionVersion ( extensionVersion ) ;
49+ const fullOutputPath = `${ outputPath } /${ releaseType } /${ apiVersion } ` ;
4950
5051 if ( outputPath !== 'output' ) {
5152 if ( ! fs . existsSync ( fullOutputPath ) ) {
@@ -77,11 +78,11 @@ function writeSwaggerReadMeFile(apiExtensionVersions: { [key in ApiVersion]: str
7778 let betaVersionsContent = '' ;
7879 let v1VersionsContent = '' ;
7980 for ( const version of apiExtensionVersions [ ApiVersion . Beta ] ) {
80- const releaseType = version . endsWith ( 'preview' ) ? 'preview' : 'official' ;
81+ const releaseType = getReleaseTypeFromExtensionVersion ( version ) ;
8182 betaVersionsContent += `\n - microsoftgraph/${ releaseType } /beta/${ version } .json` ;
8283 }
8384 for ( const version of apiExtensionVersions [ ApiVersion . V1_0 ] ) {
84- const releaseType = version . endsWith ( 'preview' ) ? 'preview' : 'official' ;
85+ const releaseType = getReleaseTypeFromExtensionVersion ( version ) ;
8586 v1VersionsContent += `\n - microsoftgraph/${ releaseType } /v1.0/${ version } .json` ;
8687 }
8788 let readMeContent = `# MicrosoftGraph
@@ -130,6 +131,10 @@ input-file: ${v1VersionsContent}
130131 } ) ;
131132}
132133
134+ function getReleaseTypeFromExtensionVersion ( extensionVersion : string ) : 'preview' | 'official' {
135+ return extensionVersion . endsWith ( 'preview' ) ? 'preview' : 'official' ;
136+ }
137+
133138async function main ( ) {
134139 let extensionVersionMetadata : ExtensionVersionMetadata = require ( '../output/metadata.json' ) ;
135140 let metadata : Metadata = { } ;
0 commit comments