@@ -19,8 +19,9 @@ export enum HttpClient {
1919 * @param input The relative location of the OpenAPI spec.
2020 * @param output The relative location of the output directory.
2121 * @param httpClient The selected httpClient (fetch or XHR).
22+ * @param write Write the files to disk (true or false)
2223 */
23- export function generate ( input : string , output : string , httpClient : HttpClient = HttpClient . FETCH ) : void {
24+ export function generate ( input : string , output : string , httpClient : HttpClient = HttpClient . FETCH , write : boolean = false ) : void {
2425 const inputPath = path . resolve ( process . cwd ( ) , input ) ;
2526 const outputPath = path . resolve ( process . cwd ( ) , output ) ;
2627
@@ -34,12 +35,16 @@ export function generate(input: string, output: string, httpClient: HttpClient =
3435 switch ( openApiVersion ) {
3536 case OpenApiVersion . V2 :
3637 const clientV2 = parseV2 ( openApi ) ;
37- writeClient ( clientV2 , httpClient , templates , outputPath ) ;
38+ if ( write ) {
39+ writeClient ( clientV2 , httpClient , templates , outputPath ) ;
40+ }
3841 break ;
3942
4043 case OpenApiVersion . V3 :
4144 const clientV3 = parseV3 ( openApi ) ;
42- writeClient ( clientV3 , httpClient , templates , outputPath ) ;
45+ if ( write ) {
46+ writeClient ( clientV3 , httpClient , templates , outputPath ) ;
47+ }
4348 break ;
4449 }
4550 } catch ( e ) {
0 commit comments