1- import _ from "lodash" ;
2- import ts from "typescript" ;
1+ import * as lodash from "lodash" ;
2+ import * as typescript from "typescript" ;
33import { CodeFormatter } from "./code-formatter.js" ;
44import { CodeGenConfig } from "./configuration.js" ;
55import { SchemaComponentsMap } from "./schema-components-map.js" ;
@@ -103,8 +103,8 @@ class CodeGenProcess {
103103
104104 this . schemaComponentsMap . clear ( ) ;
105105
106- _ . each ( swagger . usageSchema . components , ( component , componentName ) =>
107- _ . each ( component , ( rawTypeData , typeName ) => {
106+ lodash . each ( swagger . usageSchema . components , ( component , componentName ) =>
107+ lodash . each ( component , ( rawTypeData , typeName ) => {
108108 this . schemaComponentsMap . createComponent (
109109 this . schemaComponentsMap . createRef ( [
110110 "components" ,
@@ -120,7 +120,7 @@ class CodeGenProcess {
120120 * @type {SchemaComponent[] }
121121 */
122122 const componentsToParse = this . schemaComponentsMap . filter (
123- _ . compact ( [ "schemas" , this . config . extractResponses && "responses" ] ) ,
123+ lodash . compact ( [ "schemas" , this . config . extractResponses && "responses" ] ) ,
124124 ) ;
125125
126126 const parsedSchemas = componentsToParse . map ( ( schemaComponent ) => {
@@ -228,7 +228,7 @@ class CodeGenProcess {
228228 return ` * ${ line } ${ eol ? "\n" : "" } ` ;
229229 } ,
230230 NameResolver : NameResolver ,
231- _,
231+ _ : lodash ,
232232 require : this . templatesWorker . requireFnFromTemplate ,
233233 } ,
234234 config : this . config ,
@@ -239,7 +239,7 @@ class CodeGenProcess {
239239 const components = this . schemaComponentsMap . getComponents ( ) ;
240240 let modelTypes = [ ] ;
241241
242- const modelTypeComponents = _ . compact ( [
242+ const modelTypeComponents = lodash . compact ( [
243243 "schemas" ,
244244 this . config . extractResponses && "responses" ,
245245 ] ) ;
@@ -322,7 +322,7 @@ class CodeGenProcess {
322322 ? await this . createMultipleFileInfos ( templatesToRender , configuration )
323323 : await this . createSingleFileInfo ( templatesToRender , configuration ) ;
324324
325- if ( ! _ . isEmpty ( configuration . extraTemplates ) ) {
325+ if ( ! lodash . isEmpty ( configuration . extraTemplates ) ) {
326326 for ( const extraTemplate of configuration . extraTemplates ) {
327327 const content = this . templatesWorker . renderTemplate (
328328 this . fileSystem . getFileContent ( extraTemplate . path ) ,
@@ -467,27 +467,29 @@ class CodeGenProcess {
467467 return await this . createOutputFileInfo (
468468 configuration ,
469469 configuration . fileName ,
470- _ . compact ( [
471- this . templatesWorker . renderTemplate (
472- templatesToRender . dataContracts ,
473- configuration ,
474- ) ,
475- generateRouteTypes &&
476- this . templatesWorker . renderTemplate (
477- templatesToRender . routeTypes ,
478- configuration ,
479- ) ,
480- generateClient &&
481- this . templatesWorker . renderTemplate (
482- templatesToRender . httpClient ,
483- configuration ,
484- ) ,
485- generateClient &&
470+ lodash
471+ . compact ( [
486472 this . templatesWorker . renderTemplate (
487- templatesToRender . api ,
473+ templatesToRender . dataContracts ,
488474 configuration ,
489475 ) ,
490- ] ) . join ( "\n" ) ,
476+ generateRouteTypes &&
477+ this . templatesWorker . renderTemplate (
478+ templatesToRender . routeTypes ,
479+ configuration ,
480+ ) ,
481+ generateClient &&
482+ this . templatesWorker . renderTemplate (
483+ templatesToRender . httpClient ,
484+ configuration ,
485+ ) ,
486+ generateClient &&
487+ this . templatesWorker . renderTemplate (
488+ templatesToRender . api ,
489+ configuration ,
490+ ) ,
491+ ] )
492+ . join ( "\n" ) ,
491493 ) ;
492494 } ;
493495
@@ -500,7 +502,7 @@ class CodeGenProcess {
500502 */
501503 createOutputFileInfo = async ( configuration , fileNameFull , content ) => {
502504 const fileName = this . fileSystem . cropExtension ( fileNameFull ) ;
503- const fileExtension = ts . Extension . Ts ;
505+ const fileExtension = typescript . Extension . Ts ;
504506
505507 if ( configuration . translateToJavaScript ) {
506508 this . logger . debug ( "using js translator for" , fileName ) ;
@@ -542,14 +544,14 @@ class CodeGenProcess {
542544 servers : servers || [ ] ,
543545 basePath,
544546 host,
545- externalDocs : _ . merge (
547+ externalDocs : lodash . merge (
546548 {
547549 url : "" ,
548550 description : "" ,
549551 } ,
550552 externalDocs ,
551553 ) ,
552- tags : _ . compact ( tags ) ,
554+ tags : lodash . compact ( tags ) ,
553555 baseUrl : serverUrl ,
554556 title,
555557 version,
0 commit comments