openapi-gen-typescript
Advanced tools
Comparing version 0.1.9 to 0.2.0
@@ -284,3 +284,3 @@ "use strict"; | ||
.replace(/\.ts$/, '')}';`, | ||
`import * as schemas from '../schemas';\n`, | ||
schemasClassCode.length > 0 ? `import * as schemas from '../schemas';\n` : '\n', | ||
code, | ||
@@ -305,5 +305,7 @@ ].join('\n'); | ||
].join('\n'); | ||
const schemasCode = [constants_1.NotModifyCode, schemasClassCode.join('\n')].join('\n'); | ||
fs.writeFileSync(`${outputDir}/index.ts`, util_1.format(typesCode)); | ||
fs.writeFileSync(`${outputDir}/schemas.ts`, util_1.format(schemasCode)); | ||
if (schemasClassCode.length > 0) { | ||
const schemasCode = [constants_1.NotModifyCode, schemasClassCode.join('\n')].join('\n'); | ||
fs.writeFileSync(`${outputDir}/schemas.ts`, util_1.format(schemasCode)); | ||
} | ||
console.info(`Generate code successful in directory: ${outputDir}`); | ||
@@ -310,0 +312,0 @@ }); |
{ | ||
"name": "openapi-gen-typescript", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -407,3 +407,3 @@ // @ts-ignore | ||
.replace(/\.ts$/, '')}';`, | ||
`import * as schemas from '../schemas';\n`, | ||
schemasClassCode.length > 0 ? `import * as schemas from '../schemas';\n` : '\n', | ||
code, | ||
@@ -432,8 +432,10 @@ ].join('\n'); | ||
const schemasCode = [NotModifyCode, schemasClassCode.join('\n')].join('\n'); | ||
fs.writeFileSync(`${outputDir}/index.ts`, format(typesCode)); | ||
fs.writeFileSync(`${outputDir}/schemas.ts`, format(schemasCode)); | ||
if (schemasClassCode.length > 0) { | ||
const schemasCode = [NotModifyCode, schemasClassCode.join('\n')].join('\n'); | ||
fs.writeFileSync(`${outputDir}/schemas.ts`, format(schemasCode)); | ||
} | ||
console.info(`Generate code successful in directory: ${outputDir}`); | ||
} |
63914
1364