Skip to content

Commit c290555

Browse files
Silas Davismacjohnny
authored andcommitted
typescript-axios: @ts-ignore possible unused imports (#3742)
Depending on the template parameters some imports may not get used - this causes a typescript compiler error that must be manually fixed. Signed-off-by: Silas Davis <[email protected]>
1 parent 197294a commit c290555

File tree

6 files changed

+12
-2
lines changed

6 files changed

+12
-2
lines changed

modules/openapi-generator/src/main/resources/typescript-axios/api.mustache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import * as globalImportUrl from 'url';
77
import { Configuration } from './configuration';
88
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
9+
// Some imports not used depending on template conditions
10+
// @ts-ignore
911
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
1012

1113
{{#models}}
@@ -17,4 +19,4 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr
1719
{{/withSeparateModelsAndApi}}{{#withSeparateModelsAndApi}}
1820
{{#apiInfo}}{{#apis}}{{#operations}}export * from './{{apiPackage}}/{{classFilename}}';
1921
{{/operations}}{{/apis}}{{/apiInfo}}
20-
{{/withSeparateModelsAndApi}}
22+
{{/withSeparateModelsAndApi}}

modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import * as globalImportUrl from 'url';
77
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
88
import { Configuration } from '{{apiRelativeToRoot}}configuration';
9+
// Some imports not used depending on template conditions
10+
// @ts-ignore
911
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '{{apiRelativeToRoot}}base';
1012

1113
{{#imports}}import { {{classname}} } from '{{apiRelativeToRoot}}{{tsModelPackage}}';

modules/openapi-generator/src/main/resources/typescript-axios/baseApi.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
{{>licenseInfo}}
44

55
import { Configuration } from "./configuration";
6+
// Some imports not used depending on template conditions
7+
// @ts-ignore
68
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
79

810
export const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, "");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.1-SNAPSHOT
1+
4.1.1

samples/client/petstore/typescript-axios/builds/default/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import * as globalImportUrl from 'url';
1717
import { Configuration } from './configuration';
1818
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
19+
// Some imports not used depending on template conditions
20+
// @ts-ignore
1921
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
2022

2123
/**

samples/client/petstore/typescript-axios/builds/default/base.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515

1616
import { Configuration } from "./configuration";
17+
// Some imports not used depending on template conditions
18+
// @ts-ignore
1719
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
1820

1921
export const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, "");

0 commit comments

Comments
 (0)