diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache index 6fc3928c4872..4aae18a02f0e 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache @@ -41,7 +41,7 @@ export class {{classname}} extends BaseAPI { {{#hasParams}} {{#allParams}} {{#required}} - throwIfNullOrUndefined({{> paramNamePartial}}, '{{nickname}}'); + throwIfNullOrUndefined({{> paramNamePartial}}, '{{> paramNamePartial}}', '{{nickname}}'); {{/required}} {{/allParams}} diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache index 97989df889a6..db845a859459 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache @@ -178,9 +178,9 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn } }; -export const throwIfNullOrUndefined = (value: any, nickname?: string) => { +export const throwIfNullOrUndefined = (value: any, paramName: string, nickname: string) => { if (value == null) { - throw new Error(`Parameter "${value}" was null or undefined when calling "${nickname}".`); + throw new Error(`Parameter "${paramName}" was null or undefined when calling "${nickname}".`); } }; diff --git a/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts index 3b3232c44dbb..021781fd7abb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts @@ -64,7 +64,7 @@ export class PetApi extends BaseAPI { * Add a new pet to the store */ addPet = ({ body }: AddPetRequest): Observable => { - throwIfNullOrUndefined(body, 'addPet'); + throwIfNullOrUndefined(body, 'body', 'addPet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -89,7 +89,7 @@ export class PetApi extends BaseAPI { * Deletes a pet */ deletePet = ({ petId, apiKey }: DeletePetRequest): Observable => { - throwIfNullOrUndefined(petId, 'deletePet'); + throwIfNullOrUndefined(petId, 'petId', 'deletePet'); const headers: HttpHeaders = { ...(apiKey != null ? { 'api_key': String(apiKey) } : undefined), @@ -114,7 +114,7 @@ export class PetApi extends BaseAPI { * Finds Pets by status */ findPetsByStatus = ({ status }: FindPetsByStatusRequest): Observable> => { - throwIfNullOrUndefined(status, 'findPetsByStatus'); + throwIfNullOrUndefined(status, 'status', 'findPetsByStatus'); const headers: HttpHeaders = { // oauth required @@ -143,7 +143,7 @@ export class PetApi extends BaseAPI { * Finds Pets by tags */ findPetsByTags = ({ tags }: FindPetsByTagsRequest): Observable> => { - throwIfNullOrUndefined(tags, 'findPetsByTags'); + throwIfNullOrUndefined(tags, 'tags', 'findPetsByTags'); const headers: HttpHeaders = { // oauth required @@ -172,7 +172,7 @@ export class PetApi extends BaseAPI { * Find pet by ID */ getPetById = ({ petId }: GetPetByIdRequest): Observable => { - throwIfNullOrUndefined(petId, 'getPetById'); + throwIfNullOrUndefined(petId, 'petId', 'getPetById'); const headers: HttpHeaders = { ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication @@ -189,7 +189,7 @@ export class PetApi extends BaseAPI { * Update an existing pet */ updatePet = ({ body }: UpdatePetRequest): Observable => { - throwIfNullOrUndefined(body, 'updatePet'); + throwIfNullOrUndefined(body, 'body', 'updatePet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -214,7 +214,7 @@ export class PetApi extends BaseAPI { * Updates a pet in the store with form data */ updatePetWithForm = ({ petId, name, status }: UpdatePetWithFormRequest): Observable => { - throwIfNullOrUndefined(petId, 'updatePetWithForm'); + throwIfNullOrUndefined(petId, 'petId', 'updatePetWithForm'); const headers: HttpHeaders = { // oauth required @@ -242,7 +242,7 @@ export class PetApi extends BaseAPI { * uploads an image */ uploadFile = ({ petId, additionalMetadata, file }: UploadFileRequest): Observable => { - throwIfNullOrUndefined(petId, 'uploadFile'); + throwIfNullOrUndefined(petId, 'petId', 'uploadFile'); const headers: HttpHeaders = { // oauth required diff --git a/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts index aac36206d606..8ce04d16aa04 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts @@ -39,7 +39,7 @@ export class StoreApi extends BaseAPI { * Delete purchase order by ID */ deleteOrder = ({ orderId }: DeleteOrderRequest): Observable => { - throwIfNullOrUndefined(orderId, 'deleteOrder'); + throwIfNullOrUndefined(orderId, 'orderId', 'deleteOrder'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -68,7 +68,7 @@ export class StoreApi extends BaseAPI { * Find purchase order by ID */ getOrderById = ({ orderId }: GetOrderByIdRequest): Observable => { - throwIfNullOrUndefined(orderId, 'getOrderById'); + throwIfNullOrUndefined(orderId, 'orderId', 'getOrderById'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -80,7 +80,7 @@ export class StoreApi extends BaseAPI { * Place an order for a pet */ placeOrder = ({ body }: PlaceOrderRequest): Observable => { - throwIfNullOrUndefined(body, 'placeOrder'); + throwIfNullOrUndefined(body, 'body', 'placeOrder'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts index 1b3c07eea4f7..a223874786eb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts @@ -57,7 +57,7 @@ export class UserApi extends BaseAPI { * Create user */ createUser = ({ body }: CreateUserRequest): Observable => { - throwIfNullOrUndefined(body, 'createUser'); + throwIfNullOrUndefined(body, 'body', 'createUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -75,7 +75,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithArrayInput = ({ body }: CreateUsersWithArrayInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithArrayInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithArrayInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -93,7 +93,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithListInput = ({ body }: CreateUsersWithListInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithListInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithListInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -112,7 +112,7 @@ export class UserApi extends BaseAPI { * Delete user */ deleteUser = ({ username }: DeleteUserRequest): Observable => { - throwIfNullOrUndefined(username, 'deleteUser'); + throwIfNullOrUndefined(username, 'username', 'deleteUser'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -124,7 +124,7 @@ export class UserApi extends BaseAPI { * Get user by user name */ getUserByName = ({ username }: GetUserByNameRequest): Observable => { - throwIfNullOrUndefined(username, 'getUserByName'); + throwIfNullOrUndefined(username, 'username', 'getUserByName'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -136,8 +136,8 @@ export class UserApi extends BaseAPI { * Logs user into the system */ loginUser = ({ username, password }: LoginUserRequest): Observable => { - throwIfNullOrUndefined(username, 'loginUser'); - throwIfNullOrUndefined(password, 'loginUser'); + throwIfNullOrUndefined(username, 'username', 'loginUser'); + throwIfNullOrUndefined(password, 'password', 'loginUser'); const query: HttpQuery = { // required parameters are used directly since they are already checked by throwIfNullOrUndefined 'username': username, @@ -166,8 +166,8 @@ export class UserApi extends BaseAPI { * Updated user */ updateUser = ({ username, body }: UpdateUserRequest): Observable => { - throwIfNullOrUndefined(username, 'updateUser'); - throwIfNullOrUndefined(body, 'updateUser'); + throwIfNullOrUndefined(username, 'username', 'updateUser'); + throwIfNullOrUndefined(body, 'body', 'updateUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts index ad383a116427..42ddef55ae1c 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts @@ -189,9 +189,9 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn } }; -export const throwIfNullOrUndefined = (value: any, nickname?: string) => { +export const throwIfNullOrUndefined = (value: any, paramName: string, nickname: string) => { if (value == null) { - throw new Error(`Parameter "${value}" was null or undefined when calling "${nickname}".`); + throw new Error(`Parameter "${paramName}" was null or undefined when calling "${nickname}".`); } }; diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts index 3b3232c44dbb..021781fd7abb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts @@ -64,7 +64,7 @@ export class PetApi extends BaseAPI { * Add a new pet to the store */ addPet = ({ body }: AddPetRequest): Observable => { - throwIfNullOrUndefined(body, 'addPet'); + throwIfNullOrUndefined(body, 'body', 'addPet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -89,7 +89,7 @@ export class PetApi extends BaseAPI { * Deletes a pet */ deletePet = ({ petId, apiKey }: DeletePetRequest): Observable => { - throwIfNullOrUndefined(petId, 'deletePet'); + throwIfNullOrUndefined(petId, 'petId', 'deletePet'); const headers: HttpHeaders = { ...(apiKey != null ? { 'api_key': String(apiKey) } : undefined), @@ -114,7 +114,7 @@ export class PetApi extends BaseAPI { * Finds Pets by status */ findPetsByStatus = ({ status }: FindPetsByStatusRequest): Observable> => { - throwIfNullOrUndefined(status, 'findPetsByStatus'); + throwIfNullOrUndefined(status, 'status', 'findPetsByStatus'); const headers: HttpHeaders = { // oauth required @@ -143,7 +143,7 @@ export class PetApi extends BaseAPI { * Finds Pets by tags */ findPetsByTags = ({ tags }: FindPetsByTagsRequest): Observable> => { - throwIfNullOrUndefined(tags, 'findPetsByTags'); + throwIfNullOrUndefined(tags, 'tags', 'findPetsByTags'); const headers: HttpHeaders = { // oauth required @@ -172,7 +172,7 @@ export class PetApi extends BaseAPI { * Find pet by ID */ getPetById = ({ petId }: GetPetByIdRequest): Observable => { - throwIfNullOrUndefined(petId, 'getPetById'); + throwIfNullOrUndefined(petId, 'petId', 'getPetById'); const headers: HttpHeaders = { ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication @@ -189,7 +189,7 @@ export class PetApi extends BaseAPI { * Update an existing pet */ updatePet = ({ body }: UpdatePetRequest): Observable => { - throwIfNullOrUndefined(body, 'updatePet'); + throwIfNullOrUndefined(body, 'body', 'updatePet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -214,7 +214,7 @@ export class PetApi extends BaseAPI { * Updates a pet in the store with form data */ updatePetWithForm = ({ petId, name, status }: UpdatePetWithFormRequest): Observable => { - throwIfNullOrUndefined(petId, 'updatePetWithForm'); + throwIfNullOrUndefined(petId, 'petId', 'updatePetWithForm'); const headers: HttpHeaders = { // oauth required @@ -242,7 +242,7 @@ export class PetApi extends BaseAPI { * uploads an image */ uploadFile = ({ petId, additionalMetadata, file }: UploadFileRequest): Observable => { - throwIfNullOrUndefined(petId, 'uploadFile'); + throwIfNullOrUndefined(petId, 'petId', 'uploadFile'); const headers: HttpHeaders = { // oauth required diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts index aac36206d606..8ce04d16aa04 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts @@ -39,7 +39,7 @@ export class StoreApi extends BaseAPI { * Delete purchase order by ID */ deleteOrder = ({ orderId }: DeleteOrderRequest): Observable => { - throwIfNullOrUndefined(orderId, 'deleteOrder'); + throwIfNullOrUndefined(orderId, 'orderId', 'deleteOrder'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -68,7 +68,7 @@ export class StoreApi extends BaseAPI { * Find purchase order by ID */ getOrderById = ({ orderId }: GetOrderByIdRequest): Observable => { - throwIfNullOrUndefined(orderId, 'getOrderById'); + throwIfNullOrUndefined(orderId, 'orderId', 'getOrderById'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -80,7 +80,7 @@ export class StoreApi extends BaseAPI { * Place an order for a pet */ placeOrder = ({ body }: PlaceOrderRequest): Observable => { - throwIfNullOrUndefined(body, 'placeOrder'); + throwIfNullOrUndefined(body, 'body', 'placeOrder'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts index 1b3c07eea4f7..a223874786eb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts @@ -57,7 +57,7 @@ export class UserApi extends BaseAPI { * Create user */ createUser = ({ body }: CreateUserRequest): Observable => { - throwIfNullOrUndefined(body, 'createUser'); + throwIfNullOrUndefined(body, 'body', 'createUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -75,7 +75,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithArrayInput = ({ body }: CreateUsersWithArrayInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithArrayInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithArrayInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -93,7 +93,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithListInput = ({ body }: CreateUsersWithListInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithListInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithListInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -112,7 +112,7 @@ export class UserApi extends BaseAPI { * Delete user */ deleteUser = ({ username }: DeleteUserRequest): Observable => { - throwIfNullOrUndefined(username, 'deleteUser'); + throwIfNullOrUndefined(username, 'username', 'deleteUser'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -124,7 +124,7 @@ export class UserApi extends BaseAPI { * Get user by user name */ getUserByName = ({ username }: GetUserByNameRequest): Observable => { - throwIfNullOrUndefined(username, 'getUserByName'); + throwIfNullOrUndefined(username, 'username', 'getUserByName'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -136,8 +136,8 @@ export class UserApi extends BaseAPI { * Logs user into the system */ loginUser = ({ username, password }: LoginUserRequest): Observable => { - throwIfNullOrUndefined(username, 'loginUser'); - throwIfNullOrUndefined(password, 'loginUser'); + throwIfNullOrUndefined(username, 'username', 'loginUser'); + throwIfNullOrUndefined(password, 'password', 'loginUser'); const query: HttpQuery = { // required parameters are used directly since they are already checked by throwIfNullOrUndefined 'username': username, @@ -166,8 +166,8 @@ export class UserApi extends BaseAPI { * Updated user */ updateUser = ({ username, body }: UpdateUserRequest): Observable => { - throwIfNullOrUndefined(username, 'updateUser'); - throwIfNullOrUndefined(body, 'updateUser'); + throwIfNullOrUndefined(username, 'username', 'updateUser'); + throwIfNullOrUndefined(body, 'body', 'updateUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts index ad383a116427..42ddef55ae1c 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts @@ -189,9 +189,9 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn } }; -export const throwIfNullOrUndefined = (value: any, nickname?: string) => { +export const throwIfNullOrUndefined = (value: any, paramName: string, nickname: string) => { if (value == null) { - throw new Error(`Parameter "${value}" was null or undefined when calling "${nickname}".`); + throw new Error(`Parameter "${paramName}" was null or undefined when calling "${nickname}".`); } }; diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts index 3b3232c44dbb..021781fd7abb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts @@ -64,7 +64,7 @@ export class PetApi extends BaseAPI { * Add a new pet to the store */ addPet = ({ body }: AddPetRequest): Observable => { - throwIfNullOrUndefined(body, 'addPet'); + throwIfNullOrUndefined(body, 'body', 'addPet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -89,7 +89,7 @@ export class PetApi extends BaseAPI { * Deletes a pet */ deletePet = ({ petId, apiKey }: DeletePetRequest): Observable => { - throwIfNullOrUndefined(petId, 'deletePet'); + throwIfNullOrUndefined(petId, 'petId', 'deletePet'); const headers: HttpHeaders = { ...(apiKey != null ? { 'api_key': String(apiKey) } : undefined), @@ -114,7 +114,7 @@ export class PetApi extends BaseAPI { * Finds Pets by status */ findPetsByStatus = ({ status }: FindPetsByStatusRequest): Observable> => { - throwIfNullOrUndefined(status, 'findPetsByStatus'); + throwIfNullOrUndefined(status, 'status', 'findPetsByStatus'); const headers: HttpHeaders = { // oauth required @@ -143,7 +143,7 @@ export class PetApi extends BaseAPI { * Finds Pets by tags */ findPetsByTags = ({ tags }: FindPetsByTagsRequest): Observable> => { - throwIfNullOrUndefined(tags, 'findPetsByTags'); + throwIfNullOrUndefined(tags, 'tags', 'findPetsByTags'); const headers: HttpHeaders = { // oauth required @@ -172,7 +172,7 @@ export class PetApi extends BaseAPI { * Find pet by ID */ getPetById = ({ petId }: GetPetByIdRequest): Observable => { - throwIfNullOrUndefined(petId, 'getPetById'); + throwIfNullOrUndefined(petId, 'petId', 'getPetById'); const headers: HttpHeaders = { ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication @@ -189,7 +189,7 @@ export class PetApi extends BaseAPI { * Update an existing pet */ updatePet = ({ body }: UpdatePetRequest): Observable => { - throwIfNullOrUndefined(body, 'updatePet'); + throwIfNullOrUndefined(body, 'body', 'updatePet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -214,7 +214,7 @@ export class PetApi extends BaseAPI { * Updates a pet in the store with form data */ updatePetWithForm = ({ petId, name, status }: UpdatePetWithFormRequest): Observable => { - throwIfNullOrUndefined(petId, 'updatePetWithForm'); + throwIfNullOrUndefined(petId, 'petId', 'updatePetWithForm'); const headers: HttpHeaders = { // oauth required @@ -242,7 +242,7 @@ export class PetApi extends BaseAPI { * uploads an image */ uploadFile = ({ petId, additionalMetadata, file }: UploadFileRequest): Observable => { - throwIfNullOrUndefined(petId, 'uploadFile'); + throwIfNullOrUndefined(petId, 'petId', 'uploadFile'); const headers: HttpHeaders = { // oauth required diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts index aac36206d606..8ce04d16aa04 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts @@ -39,7 +39,7 @@ export class StoreApi extends BaseAPI { * Delete purchase order by ID */ deleteOrder = ({ orderId }: DeleteOrderRequest): Observable => { - throwIfNullOrUndefined(orderId, 'deleteOrder'); + throwIfNullOrUndefined(orderId, 'orderId', 'deleteOrder'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -68,7 +68,7 @@ export class StoreApi extends BaseAPI { * Find purchase order by ID */ getOrderById = ({ orderId }: GetOrderByIdRequest): Observable => { - throwIfNullOrUndefined(orderId, 'getOrderById'); + throwIfNullOrUndefined(orderId, 'orderId', 'getOrderById'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -80,7 +80,7 @@ export class StoreApi extends BaseAPI { * Place an order for a pet */ placeOrder = ({ body }: PlaceOrderRequest): Observable => { - throwIfNullOrUndefined(body, 'placeOrder'); + throwIfNullOrUndefined(body, 'body', 'placeOrder'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts index 1b3c07eea4f7..a223874786eb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts @@ -57,7 +57,7 @@ export class UserApi extends BaseAPI { * Create user */ createUser = ({ body }: CreateUserRequest): Observable => { - throwIfNullOrUndefined(body, 'createUser'); + throwIfNullOrUndefined(body, 'body', 'createUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -75,7 +75,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithArrayInput = ({ body }: CreateUsersWithArrayInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithArrayInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithArrayInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -93,7 +93,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithListInput = ({ body }: CreateUsersWithListInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithListInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithListInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -112,7 +112,7 @@ export class UserApi extends BaseAPI { * Delete user */ deleteUser = ({ username }: DeleteUserRequest): Observable => { - throwIfNullOrUndefined(username, 'deleteUser'); + throwIfNullOrUndefined(username, 'username', 'deleteUser'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -124,7 +124,7 @@ export class UserApi extends BaseAPI { * Get user by user name */ getUserByName = ({ username }: GetUserByNameRequest): Observable => { - throwIfNullOrUndefined(username, 'getUserByName'); + throwIfNullOrUndefined(username, 'username', 'getUserByName'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -136,8 +136,8 @@ export class UserApi extends BaseAPI { * Logs user into the system */ loginUser = ({ username, password }: LoginUserRequest): Observable => { - throwIfNullOrUndefined(username, 'loginUser'); - throwIfNullOrUndefined(password, 'loginUser'); + throwIfNullOrUndefined(username, 'username', 'loginUser'); + throwIfNullOrUndefined(password, 'password', 'loginUser'); const query: HttpQuery = { // required parameters are used directly since they are already checked by throwIfNullOrUndefined 'username': username, @@ -166,8 +166,8 @@ export class UserApi extends BaseAPI { * Updated user */ updateUser = ({ username, body }: UpdateUserRequest): Observable => { - throwIfNullOrUndefined(username, 'updateUser'); - throwIfNullOrUndefined(body, 'updateUser'); + throwIfNullOrUndefined(username, 'username', 'updateUser'); + throwIfNullOrUndefined(body, 'body', 'updateUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts index ad383a116427..42ddef55ae1c 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts @@ -189,9 +189,9 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn } }; -export const throwIfNullOrUndefined = (value: any, nickname?: string) => { +export const throwIfNullOrUndefined = (value: any, paramName: string, nickname: string) => { if (value == null) { - throw new Error(`Parameter "${value}" was null or undefined when calling "${nickname}".`); + throw new Error(`Parameter "${paramName}" was null or undefined when calling "${nickname}".`); } }; diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts index 3b3232c44dbb..021781fd7abb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts @@ -64,7 +64,7 @@ export class PetApi extends BaseAPI { * Add a new pet to the store */ addPet = ({ body }: AddPetRequest): Observable => { - throwIfNullOrUndefined(body, 'addPet'); + throwIfNullOrUndefined(body, 'body', 'addPet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -89,7 +89,7 @@ export class PetApi extends BaseAPI { * Deletes a pet */ deletePet = ({ petId, apiKey }: DeletePetRequest): Observable => { - throwIfNullOrUndefined(petId, 'deletePet'); + throwIfNullOrUndefined(petId, 'petId', 'deletePet'); const headers: HttpHeaders = { ...(apiKey != null ? { 'api_key': String(apiKey) } : undefined), @@ -114,7 +114,7 @@ export class PetApi extends BaseAPI { * Finds Pets by status */ findPetsByStatus = ({ status }: FindPetsByStatusRequest): Observable> => { - throwIfNullOrUndefined(status, 'findPetsByStatus'); + throwIfNullOrUndefined(status, 'status', 'findPetsByStatus'); const headers: HttpHeaders = { // oauth required @@ -143,7 +143,7 @@ export class PetApi extends BaseAPI { * Finds Pets by tags */ findPetsByTags = ({ tags }: FindPetsByTagsRequest): Observable> => { - throwIfNullOrUndefined(tags, 'findPetsByTags'); + throwIfNullOrUndefined(tags, 'tags', 'findPetsByTags'); const headers: HttpHeaders = { // oauth required @@ -172,7 +172,7 @@ export class PetApi extends BaseAPI { * Find pet by ID */ getPetById = ({ petId }: GetPetByIdRequest): Observable => { - throwIfNullOrUndefined(petId, 'getPetById'); + throwIfNullOrUndefined(petId, 'petId', 'getPetById'); const headers: HttpHeaders = { ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication @@ -189,7 +189,7 @@ export class PetApi extends BaseAPI { * Update an existing pet */ updatePet = ({ body }: UpdatePetRequest): Observable => { - throwIfNullOrUndefined(body, 'updatePet'); + throwIfNullOrUndefined(body, 'body', 'updatePet'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -214,7 +214,7 @@ export class PetApi extends BaseAPI { * Updates a pet in the store with form data */ updatePetWithForm = ({ petId, name, status }: UpdatePetWithFormRequest): Observable => { - throwIfNullOrUndefined(petId, 'updatePetWithForm'); + throwIfNullOrUndefined(petId, 'petId', 'updatePetWithForm'); const headers: HttpHeaders = { // oauth required @@ -242,7 +242,7 @@ export class PetApi extends BaseAPI { * uploads an image */ uploadFile = ({ petId, additionalMetadata, file }: UploadFileRequest): Observable => { - throwIfNullOrUndefined(petId, 'uploadFile'); + throwIfNullOrUndefined(petId, 'petId', 'uploadFile'); const headers: HttpHeaders = { // oauth required diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts index aac36206d606..8ce04d16aa04 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts @@ -39,7 +39,7 @@ export class StoreApi extends BaseAPI { * Delete purchase order by ID */ deleteOrder = ({ orderId }: DeleteOrderRequest): Observable => { - throwIfNullOrUndefined(orderId, 'deleteOrder'); + throwIfNullOrUndefined(orderId, 'orderId', 'deleteOrder'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -68,7 +68,7 @@ export class StoreApi extends BaseAPI { * Find purchase order by ID */ getOrderById = ({ orderId }: GetOrderByIdRequest): Observable => { - throwIfNullOrUndefined(orderId, 'getOrderById'); + throwIfNullOrUndefined(orderId, 'orderId', 'getOrderById'); return this.request({ path: '/store/order/{orderId}'.replace('{orderId}', encodeURI(orderId)), @@ -80,7 +80,7 @@ export class StoreApi extends BaseAPI { * Place an order for a pet */ placeOrder = ({ body }: PlaceOrderRequest): Observable => { - throwIfNullOrUndefined(body, 'placeOrder'); + throwIfNullOrUndefined(body, 'body', 'placeOrder'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts index 1b3c07eea4f7..a223874786eb 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts @@ -57,7 +57,7 @@ export class UserApi extends BaseAPI { * Create user */ createUser = ({ body }: CreateUserRequest): Observable => { - throwIfNullOrUndefined(body, 'createUser'); + throwIfNullOrUndefined(body, 'body', 'createUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -75,7 +75,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithArrayInput = ({ body }: CreateUsersWithArrayInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithArrayInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithArrayInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -93,7 +93,7 @@ export class UserApi extends BaseAPI { * Creates list of users with given input array */ createUsersWithListInput = ({ body }: CreateUsersWithListInputRequest): Observable => { - throwIfNullOrUndefined(body, 'createUsersWithListInput'); + throwIfNullOrUndefined(body, 'body', 'createUsersWithListInput'); const headers: HttpHeaders = { 'Content-Type': 'application/json', @@ -112,7 +112,7 @@ export class UserApi extends BaseAPI { * Delete user */ deleteUser = ({ username }: DeleteUserRequest): Observable => { - throwIfNullOrUndefined(username, 'deleteUser'); + throwIfNullOrUndefined(username, 'username', 'deleteUser'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -124,7 +124,7 @@ export class UserApi extends BaseAPI { * Get user by user name */ getUserByName = ({ username }: GetUserByNameRequest): Observable => { - throwIfNullOrUndefined(username, 'getUserByName'); + throwIfNullOrUndefined(username, 'username', 'getUserByName'); return this.request({ path: '/user/{username}'.replace('{username}', encodeURI(username)), @@ -136,8 +136,8 @@ export class UserApi extends BaseAPI { * Logs user into the system */ loginUser = ({ username, password }: LoginUserRequest): Observable => { - throwIfNullOrUndefined(username, 'loginUser'); - throwIfNullOrUndefined(password, 'loginUser'); + throwIfNullOrUndefined(username, 'username', 'loginUser'); + throwIfNullOrUndefined(password, 'password', 'loginUser'); const query: HttpQuery = { // required parameters are used directly since they are already checked by throwIfNullOrUndefined 'username': username, @@ -166,8 +166,8 @@ export class UserApi extends BaseAPI { * Updated user */ updateUser = ({ username, body }: UpdateUserRequest): Observable => { - throwIfNullOrUndefined(username, 'updateUser'); - throwIfNullOrUndefined(body, 'updateUser'); + throwIfNullOrUndefined(username, 'username', 'updateUser'); + throwIfNullOrUndefined(body, 'body', 'updateUser'); const headers: HttpHeaders = { 'Content-Type': 'application/json', diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts index ad383a116427..42ddef55ae1c 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts @@ -189,9 +189,9 @@ export const throwIfRequired = (params: {[key: string]: any}, key: string, nickn } }; -export const throwIfNullOrUndefined = (value: any, nickname?: string) => { +export const throwIfNullOrUndefined = (value: any, paramName: string, nickname: string) => { if (value == null) { - throw new Error(`Parameter "${value}" was null or undefined when calling "${nickname}".`); + throw new Error(`Parameter "${paramName}" was null or undefined when calling "${nickname}".`); } };