Skip to content

Commit 938b116

Browse files
committed
cancel use apiAlias
1 parent 3cfaf6e commit 938b116

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-typescript-codegen",
3-
"version": "0.5.6",
3+
"version": "0.5.7",
44
"description": "NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification.",
55
"author": "Ferdi Koomen",
66
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@ export async function generate({
6060
const openApiVersion = getOpenApiVersion(openApi);
6161
const templates = registerHandlebarTemplates();
6262

63-
6463
switch (openApiVersion) {
6564
case OpenApiVersion.V2: {
6665
const client = parseV2(openApi);
6766
const clientFinal = postProcessClient(client);
6867
if (!write) break;
69-
// TODO: format clientFinal add api(request) alias
7068
await writeClient(clientFinal, templates, output, httpClient, useOptions, useUnionTypes, exportCore, exportServices, exportModels, exportSchemas, apiAlias);
7169
break;
7270
}
@@ -75,7 +73,6 @@ export async function generate({
7573
const client = parseV3(openApi);
7674
const clientFinal = postProcessClient(client);
7775
if (!write) break;
78-
// TODO: format clientFinal add api(request) alias
7976
await writeClient(clientFinal, templates, output, httpClient, useOptions, useUnionTypes, exportCore, exportServices, exportModels, exportSchemas, apiAlias);
8077
break;
8178
}

src/utils/writeClient.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as path from 'path';
22

33
import type { Client } from '../client/interfaces/Client';
44
import { HttpClient } from '../index';
5-
import { mkdir, rmdir } from './fileSystem';
5+
import { mkdir, rmdir, exists } from './fileSystem';
66
import { isSubDirectory } from './isSubdirectory';
77
import { Templates } from './registerHandlebarTemplates';
88
import { writeClientCore } from './writeClientCore';
@@ -48,10 +48,13 @@ export async function writeClient(
4848
throw new Error(`Output folder is not a subdirectory of the current working directory`);
4949
}
5050

51-
await rmdir(outputPath);
51+
await rmdir(outputPathModels);
52+
await rmdir(outputPathSchemas);
53+
await rmdir(outputPathServices);
5254
await mkdir(outputPath);
53-
if (exportCore && outputPathCore) {
54-
55+
const coreExists = await exists(outputPathCore)
56+
console.log('outputPathCore', outputPathCore,coreExists )
57+
if (exportCore && outputPathCore && !coreExists) {
5558
await mkdir(outputPathCore);
5659
await writeClientCore(client, templates, outputPathCore, httpClient);
5760
}

0 commit comments

Comments
 (0)