Skip to content

Commit 9abd6c1

Browse files
fix some variable scoping, security client instantiation, and error returns
1 parent bd517cc commit 9abd6c1

File tree

7 files changed

+465
-533
lines changed

7 files changed

+465
-533
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
},
55
"dependencies": {
66
"@types/qs": "^6.9.7",
7-
"axios": "^1.1.2",
7+
"axios": "^1.1.3",
8+
"form-data": "^4.0.0",
89
"reflect-metadata": "^0.1.13"
910
},
1011
"devDependencies": {

src/internal/utils/queryparams.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const qpMetadataKey = "queryParam";
77
export function GetQueryParamSerializer(
88
queryParams: any
99
): ParamsSerializerOptions | undefined {
10+
if (queryParams == null) return undefined;
1011
const fieldNames: string[] = Object.getOwnPropertyNames(queryParams);
1112
fieldNames.forEach((fname) => {
1213
const qpAnn: string = Reflect.getMetadata(

src/internal/utils/security.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function ParseSecurityDecorator(securityAnn: string): SecurityDecorator {
4949
}
5050

5151
function ParseSecurityClass(serverURL: string, security: any): AxiosInstance {
52+
let client: AxiosInstance = axios.create({ baseURL: serverURL });
5253
const fieldNames: string[] = Object.getOwnPropertyNames(security);
5354
fieldNames.forEach((fname) => {
5455
const securityAnn: string = Reflect.getMetadata(
@@ -61,13 +62,17 @@ function ParseSecurityClass(serverURL: string, security: any): AxiosInstance {
6162
ParseSecurityDecorator(securityAnn);
6263
if (securityDecorator == null) return;
6364
if (securityDecorator.Option) {
64-
return ParseSecurityOption(serverURL, security[fname]);
65+
client = ParseSecurityOption(serverURL, security[fname]);
6566
} else if (securityDecorator.Scheme) {
66-
return ParseSecurityScheme(serverURL, securityDecorator, security[fname]);
67+
client = ParseSecurityScheme(
68+
serverURL,
69+
securityDecorator,
70+
security[fname]
71+
);
6772
}
6873
});
6974

70-
return axios.create({ baseURL: serverURL });
75+
return client;
7176
}
7277

7378
function ParseSecurityOption(

src/sdk/models/operations/getapis.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export class GetApisQueryParams {
2323
}
2424

2525
export class GetApisRequest {
26-
QueryParams: GetApisQueryParams;
26+
QueryParams?: GetApisQueryParams;
2727

28-
constructor(QueryParams: GetApisQueryParams) {
28+
constructor(QueryParams?: GetApisQueryParams) {
2929
this.QueryParams = QueryParams;
3030
}
3131
}

src/sdk/models/shared/filters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Metadata } from "../../../internal/utils/utils";
2+
import { Filter } from "./filter";
23

34
export class Filters {
45
@Metadata("json, name=filters")

0 commit comments

Comments
 (0)