Skip to content

Commit 14fe205

Browse files
committed
Don't require "headers" if all parameters are optional
* This is a bit inexact as headers could still be optional if non-header parameters are required, but the information is not available
1 parent e7cfb60 commit 14fe205

File tree

12 files changed

+13
-48
lines changed

12 files changed

+13
-48
lines changed

snapshotTests/snapshot/example/api.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface DefaultApiInterface {
3030
*
3131
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
3232
* @throws {HttpError}
33-
* @memberof DefaultApi
3433
*/
3534
addPet(params: {
3635
pathParams: { storeId: string };
@@ -40,7 +39,6 @@ export interface DefaultApiInterface {
4039
*
4140
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
4241
* @throws {HttpError}
43-
* @memberof DefaultApi
4442
*/
4543
addPetWithForm(params: {
4644
pathParams: { petId: string };
@@ -50,11 +48,10 @@ export interface DefaultApiInterface {
5048
*
5149
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
5250
* @throws {HttpError}
53-
* @memberof DefaultApi
5451
*/
5552
listPets(params: {
5653
pathParams: { storeId: string };
57-
queryParams?: { status?: Array<string>, tags?: Array<string>, bornAfter?: Date, };
54+
queryParams?: { status?: Array<string>, tags?: Array<string>, bornAfter?: Date, };
5855
}): Promise<PetDto>;
5956
}
6057

snapshotTests/snapshot/example/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class BaseAPI {
7878
);
7979
}
8080

81-
protected removeEmpty(obj: Record<string, string | undefined>): Record<string, string> {
81+
protected removeEmpty(obj: Record<string, string | undefined> = {}): Record<string, string> {
8282
return Object.fromEntries(Object.entries(obj)
8383
.filter(([, v]) => v != null)) as Record<string, string>;
8484
}

snapshotTests/snapshot/infectionTracker/api.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ export interface CaseWorkersApiInterface {
3434
/**
3535
*
3636
* @throws {HttpError}
37-
* @memberof CaseWorkersApi
3837
*/
3938
listCaseWorkers(): Promise<CaseWorkerDto>;
4039
/**
4140
*
4241
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
4342
* @throws {HttpError}
44-
* @memberof CaseWorkersApi
4543
*/
4644
registerCaseWorker(params: {
4745
caseWorkerDto?: CaseWorkerDto;
@@ -89,22 +87,19 @@ export interface CasesApiInterface {
8987
*
9088
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
9189
* @throws {HttpError}
92-
* @memberof CasesApi
9390
*/
9491
getCaseDetails(params: {
9592
pathParams: { caseId: string };
9693
}): Promise<InfectionDto>;
9794
/**
9895
*
9996
* @throws {HttpError}
100-
* @memberof CasesApi
10197
*/
10298
listCases(): Promise<InfectionDto>;
10399
/**
104100
*
105101
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
106102
* @throws {HttpError}
107-
* @memberof CasesApi
108103
*/
109104
newCase(params: {
110105
infectionInformationDto?: InfectionInformationDto;
@@ -113,7 +108,6 @@ export interface CasesApiInterface {
113108
*
114109
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
115110
* @throws {HttpError}
116-
* @memberof CasesApi
117111
*/
118112
registerExposure(params: {
119113
pathParams: { caseId: string };
@@ -193,14 +187,12 @@ export interface ExposuresApiInterface {
193187
/**
194188
*
195189
* @throws {HttpError}
196-
* @memberof ExposuresApi
197190
*/
198191
listExposures(): Promise<ExposureDto>;
199192
/**
200193
*
201194
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
202195
* @throws {HttpError}
203-
* @memberof ExposuresApi
204196
*/
205197
updateExposure(params: {
206198
pathParams: { exposureId: string };

snapshotTests/snapshot/infectionTracker/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class BaseAPI {
7878
);
7979
}
8080

81-
protected removeEmpty(obj: Record<string, string | undefined>): Record<string, string> {
81+
protected removeEmpty(obj: Record<string, string | undefined> = {}): Record<string, string> {
8282
return Object.fromEntries(Object.entries(obj)
8383
.filter(([, v]) => v != null)) as Record<string, string>;
8484
}

snapshotTests/snapshot/petstore/api.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export interface PetApiInterface {
3838
* @summary Add a new pet to the store
3939
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
4040
* @throws {HttpError}
41-
* @memberof PetApi
4241
*/
4342
addPet(params: {
4443
petDto?: PetDto;
@@ -49,7 +48,6 @@ export interface PetApiInterface {
4948
* @summary Deletes a pet
5049
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
5150
* @throws {HttpError}
52-
* @memberof PetApi
5351
*/
5452
deletePet(params: {
5553
pathParams: { petId: number };
@@ -61,29 +59,26 @@ export interface PetApiInterface {
6159
* @summary Finds Pets by status
6260
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
6361
* @throws {HttpError}
64-
* @memberof PetApi
6562
*/
6663
findPetsByStatus(params: {
67-
queryParams?: { status?: Array<"available" | "pending" | "sold">, };
64+
queryParams?: { status?: Array<"available" | "pending" | "sold">, };
6865
security: petstore_auth;
6966
}): Promise<Array<PetDto>>;
7067
/**
7168
*
7269
* @summary Finds Pets by tags
7370
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
7471
* @throws {HttpError}
75-
* @memberof PetApi
7672
*/
7773
findPetsByTags(params: {
78-
queryParams?: { tags?: Array<string>, };
74+
queryParams?: { tags?: Array<string>, };
7975
security: petstore_auth;
8076
}): Promise<Array<PetDto>>;
8177
/**
8278
*
8379
* @summary Find pet by ID
8480
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
8581
* @throws {HttpError}
86-
* @memberof PetApi
8782
*/
8883
getPetById(params: {
8984
pathParams: { petId: number };
@@ -94,7 +89,6 @@ export interface PetApiInterface {
9489
* @summary Update an existing pet
9590
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
9691
* @throws {HttpError}
97-
* @memberof PetApi
9892
*/
9993
updatePet(params: {
10094
petDto?: PetDto;
@@ -105,7 +99,6 @@ export interface PetApiInterface {
10599
* @summary Updates a pet in the store with form data
106100
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
107101
* @throws {HttpError}
108-
* @memberof PetApi
109102
*/
110103
updatePetWithForm(params: {
111104
pathParams: { petId: string };
@@ -117,7 +110,6 @@ export interface PetApiInterface {
117110
* @summary uploads an image
118111
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
119112
* @throws {HttpError}
120-
* @memberof PetApi
121113
*/
122114
uploadFile(params: {
123115
pathParams: { petId: number };
@@ -309,7 +301,6 @@ export interface StoreApiInterface {
309301
* @summary Delete purchase order by ID
310302
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
311303
* @throws {HttpError}
312-
* @memberof StoreApi
313304
*/
314305
deleteOrder(params: {
315306
pathParams: { orderId: string };
@@ -318,7 +309,6 @@ export interface StoreApiInterface {
318309
*
319310
* @summary Returns pet inventories by status
320311
* @throws {HttpError}
321-
* @memberof StoreApi
322312
*/
323313
getInventory(params: {
324314
security: api_key;
@@ -328,7 +318,6 @@ export interface StoreApiInterface {
328318
* @summary Find purchase order by ID
329319
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
330320
* @throws {HttpError}
331-
* @memberof StoreApi
332321
*/
333322
getOrderById(params: {
334323
pathParams: { orderId: string };
@@ -338,7 +327,6 @@ export interface StoreApiInterface {
338327
* @summary Place an order for a pet
339328
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
340329
* @throws {HttpError}
341-
* @memberof StoreApi
342330
*/
343331
placeOrder(params: {
344332
orderDto?: OrderDto;
@@ -425,7 +413,6 @@ export interface UserApiInterface {
425413
* @summary Create user
426414
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
427415
* @throws {HttpError}
428-
* @memberof UserApi
429416
*/
430417
createUser(params: {
431418
userDto?: UserDto;
@@ -435,7 +422,6 @@ export interface UserApiInterface {
435422
* @summary Creates list of users with given input array
436423
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
437424
* @throws {HttpError}
438-
* @memberof UserApi
439425
*/
440426
createUsersWithArrayInput(params: {
441427
userDto?: Array<UserDto>;
@@ -445,7 +431,6 @@ export interface UserApiInterface {
445431
* @summary Creates list of users with given input array
446432
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
447433
* @throws {HttpError}
448-
* @memberof UserApi
449434
*/
450435
createUsersWithListInput(params: {
451436
userDto?: Array<UserDto>;
@@ -455,7 +440,6 @@ export interface UserApiInterface {
455440
* @summary Delete user
456441
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
457442
* @throws {HttpError}
458-
* @memberof UserApi
459443
*/
460444
deleteUser(params: {
461445
pathParams: { username: string };
@@ -465,7 +449,6 @@ export interface UserApiInterface {
465449
* @summary Get user by user name
466450
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
467451
* @throws {HttpError}
468-
* @memberof UserApi
469452
*/
470453
getUserByName(params: {
471454
pathParams: { username: string };
@@ -475,24 +458,21 @@ export interface UserApiInterface {
475458
* @summary Logs user into the system
476459
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
477460
* @throws {HttpError}
478-
* @memberof UserApi
479461
*/
480462
loginUser(params: {
481-
queryParams?: { username?: string, password?: string, };
463+
queryParams?: { username?: string, password?: string, };
482464
}): Promise<string>;
483465
/**
484466
*
485467
* @summary Logs out current logged in user session
486468
* @throws {HttpError}
487-
* @memberof UserApi
488469
*/
489470
logoutUser(): Promise<void>;
490471
/**
491472
*
492473
* @summary Updated user
493474
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
494475
* @throws {HttpError}
495-
* @memberof UserApi
496476
*/
497477
updateUser(params: {
498478
pathParams: { username: string };

snapshotTests/snapshot/petstore/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class BaseAPI {
7878
);
7979
}
8080

81-
protected removeEmpty(obj: Record<string, string | undefined>): Record<string, string> {
81+
protected removeEmpty(obj: Record<string, string | undefined> = {}): Record<string, string> {
8282
return Object.fromEntries(Object.entries(obj)
8383
.filter(([, v]) => v != null)) as Record<string, string>;
8484
}

snapshotTests/snapshot/poly/api.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@ export interface DefaultApiInterface {
3636
/**
3737
*
3838
* @throws {HttpError}
39-
* @memberof DefaultApi
4039
*/
4140
partiesGet(): Promise<AnyPartyDto>;
4241
/**
4342
*
4443
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
4544
* @throws {HttpError}
46-
* @memberof DefaultApi
4745
*/
4846
partiesIdPut(params: {
4947
pathParams: { id: string };
@@ -53,7 +51,6 @@ export interface DefaultApiInterface {
5351
*
5452
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
5553
* @throws {HttpError}
56-
* @memberof DefaultApi
5754
*/
5855
partiesPost(params: {
5956
anyPartyDto?: AnyPartyDto;

snapshotTests/snapshot/poly/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class BaseAPI {
7878
);
7979
}
8080

81-
protected removeEmpty(obj: Record<string, string | undefined>): Record<string, string> {
81+
protected removeEmpty(obj: Record<string, string | undefined> = {}): Record<string, string> {
8282
return Object.fromEntries(Object.entries(obj)
8383
.filter(([, v]) => v != null)) as Record<string, string>;
8484
}

snapshotTests/snapshot/typeHierarchy/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export interface DefaultApiInterface {
3434
*
3535
* @param {*} [params] Request parameters, including pathParams, queryParams (including bodyParams) and http options.
3636
* @throws {HttpError}
37-
* @memberof DefaultApi
3837
*/
3938
petsPatch(params: {
4039
anyPetDto?: AnyPetDto;

snapshotTests/snapshot/typeHierarchy/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class BaseAPI {
7878
);
7979
}
8080

81-
protected removeEmpty(obj: Record<string, string | undefined>): Record<string, string> {
81+
protected removeEmpty(obj: Record<string, string | undefined> = {}): Record<string, string> {
8282
return Object.fromEntries(Object.entries(obj)
8383
.filter(([, v]) => v != null)) as Record<string, string>;
8484
}

0 commit comments

Comments
 (0)