Skip to content

Commit 4a3d968

Browse files
feat: remove OAS v2 support
1 parent 6775de9 commit 4a3d968

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+144
-3226
lines changed

dist/index.js

Lines changed: 121 additions & 1199 deletions
Large diffs are not rendered by default.

src/client/interfaces/OperationCodegen.d.ts

Whitespace-only changes.

src/index.ts

Lines changed: 23 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { HttpClient } from './HttpClient';
22
import { Indent } from './Indent';
3-
import { parse as parseV2 } from './openApi/v2';
4-
import { parse as parseV3 } from './openApi/v3';
3+
import { parse } from './openApi/v3';
54
import { getOpenApiSpec } from './utils/getOpenApiSpec';
6-
import { getOpenApiVersion, OpenApiVersion } from './utils/getOpenApiVersion';
5+
import { getOpenApiVersion } from './utils/getOpenApiVersion';
76
import { isString } from './utils/isString';
87
import { postProcessClient } from './utils/postProcessClient';
98
import { registerHandlebarTemplates } from './utils/registerHandlebarTemplates';
@@ -78,56 +77,27 @@ export const generate = async ({
7877
useOptions,
7978
});
8079

81-
switch (openApiVersion) {
82-
case OpenApiVersion.V2: {
83-
const client = parseV2(openApi);
84-
const clientFinal = postProcessClient(client);
85-
if (!write) break;
86-
await writeClient(
87-
clientFinal,
88-
templates,
89-
output,
90-
httpClient,
91-
useOptions,
92-
useUnionTypes,
93-
exportCore,
94-
exportServices,
95-
exportModels,
96-
exportHooks,
97-
exportSchemas,
98-
indent,
99-
postfixServices,
100-
postfixModels,
101-
clientName,
102-
request
103-
);
104-
break;
105-
}
106-
107-
case OpenApiVersion.V3: {
108-
const client = parseV3(openApi);
109-
const clientFinal = postProcessClient(client);
110-
if (!write) break;
111-
await writeClient(
112-
clientFinal,
113-
templates,
114-
output,
115-
httpClient,
116-
useOptions,
117-
useUnionTypes,
118-
exportCore,
119-
exportServices,
120-
exportModels,
121-
exportHooks,
122-
exportSchemas,
123-
indent,
124-
postfixServices,
125-
postfixModels,
126-
clientName,
127-
request
128-
);
129-
break;
130-
}
80+
const client = parse(openApi);
81+
const clientFinal = postProcessClient(client);
82+
if (write) {
83+
await writeClient(
84+
clientFinal,
85+
templates,
86+
output,
87+
httpClient,
88+
useOptions,
89+
useUnionTypes,
90+
exportCore,
91+
exportServices,
92+
exportModels,
93+
exportHooks,
94+
exportSchemas,
95+
indent,
96+
postfixServices,
97+
postfixModels,
98+
clientName,
99+
request
100+
);
131101
}
132102
};
133103

src/openApi/v2/index.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/openApi/v2/interfaces/Extensions/WithEnumExtension.d.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/openApi/v2/interfaces/Extensions/WithNullableExtension.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/openApi/v2/interfaces/OpenApi.d.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/openApi/v2/interfaces/OpenApiContact.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/openApi/v2/interfaces/OpenApiExample.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/openApi/v2/interfaces/OpenApiExternalDocs.d.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)