diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache
index 273d611bb530..4129ee41f2f7 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache
@@ -47,7 +47,7 @@ export class {{classname}} {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
diff --git a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts
index ddebacbbc883..ca01b4ca3401 100644
--- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts
+++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -45,13 +45,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
+ public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.addPetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -68,7 +68,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -78,13 +78,13 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
- public findPetsByStatus(status?: Array, extraHttpRequestParams?: any): Observable> {
+ public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> {
return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -94,21 +94,21 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
- public findPetsByTags(tags?: Array, extraHttpRequestParams?: any): Observable> {
+ public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> {
return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
/**
* Find pet by ID
- * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- * @param petId ID of pet that needs to be fetched
+ * Returns a single pet
+ * @param petId ID of pet to return
*/
public getPetById(petId: number, extraHttpRequestParams?: any): Observable {
return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
@@ -116,7 +116,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
+ public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -144,13 +144,13 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
- public updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
+ public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -162,13 +162,13 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
- public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> {
+ public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -179,11 +179,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable {
+ public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling addPet.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -192,8 +196,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -246,8 +250,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -278,15 +282,17 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
- public findPetsByStatusWithHttpInfo(status?: Array, extraHttpRequestParams?: any): Observable {
+ public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/findByStatus';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'status' is not null or undefined
+ if (status === null || status === undefined) {
+ throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
+ }
if (status) {
- status.forEach((element) => {
- queryParameters.append('status', element);
- })
+ queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -295,8 +301,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -327,15 +333,17 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
- public findPetsByTagsWithHttpInfo(tags?: Array, extraHttpRequestParams?: any): Observable {
+ public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/findByTags';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'tags' is not null or undefined
+ if (tags === null || tags === undefined) {
+ throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
+ }
if (tags) {
- tags.forEach((element) => {
- queryParameters.append('tags', element);
- })
+ queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -344,8 +352,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -373,8 +381,8 @@ export class PetApi {
/**
* Find pet by ID
- * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- * @param petId ID of pet that needs to be fetched
+ * Returns a single pet
+ * @param petId ID of pet to return
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/${petId}'
@@ -392,8 +400,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (api_key) required
@@ -401,15 +409,6 @@ export class PetApi {
headers.set('api_key', this.configuration.apiKey);
}
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
@@ -429,11 +428,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable {
+ public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling updatePet.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -442,8 +445,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -479,7 +482,7 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
- public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable {
+ public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
@@ -498,8 +501,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -562,8 +565,7 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/json'
];
// authentication (petstore_auth) required
diff --git a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts
index ab4ef909a5fa..2bb34f08e5d2 100644
--- a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts
+++ b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -51,7 +51,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -66,7 +66,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -76,13 +76,13 @@ export class StoreApi {
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
- public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable {
+ public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable {
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -92,13 +92,13 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
- public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable {
+ public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable {
return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -125,8 +125,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -158,8 +158,7 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/json'
];
// authentication (api_key) required
@@ -186,7 +185,7 @@ export class StoreApi {
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
- public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable {
+ public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
@@ -202,8 +201,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -225,19 +224,23 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
- public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable {
+ public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/store/order';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling placeOrder.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
diff --git a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts
index b1095986e922..533bbbefeb34 100644
--- a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts
+++ b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -45,13 +45,13 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
- public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
+ public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.createUserWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -61,13 +61,13 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithArrayInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> {
+ public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -77,13 +77,13 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithListInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> {
+ public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -99,7 +99,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -115,7 +115,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
- public loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable {
+ public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable {
return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -147,7 +147,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -158,13 +158,13 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
- public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
+ public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -175,19 +175,23 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
- public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable {
+ public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUser.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -212,19 +216,23 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithArrayInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable {
+ public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/createWithArray';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -249,19 +257,23 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithListInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable {
+ public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/createWithList';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -302,8 +314,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -341,8 +353,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -365,11 +377,19 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
- public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable {
+ public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/login';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'username' is not null or undefined
+ if (username === null || username === undefined) {
+ throw new Error('Required parameter username was null or undefined when calling loginUser.');
+ }
+ // verify required parameter 'password' is not null or undefined
+ if (password === null || password === undefined) {
+ throw new Error('Required parameter password was null or undefined when calling loginUser.');
+ }
if (username !== undefined) {
queryParameters.set('username', username);
}
@@ -384,8 +404,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -417,8 +437,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -441,7 +461,7 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
- public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable {
+ public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
@@ -451,14 +471,18 @@ export class UserApi {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling updateUser.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
diff --git a/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts b/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts
new file mode 100644
index 000000000000..f86e84f93a3a
--- /dev/null
+++ b/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts
@@ -0,0 +1,25 @@
+/**
+ * Swagger Petstore
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+import * as models from './models';
+
+/**
+ * Describes the result of uploading an image resource
+ */
+export interface ApiResponse {
+ code?: number;
+
+ type?: string;
+
+ message?: string;
+
+}
diff --git a/samples/client/petstore/typescript-angular2/default/model/Category.ts b/samples/client/petstore/typescript-angular2/default/model/Category.ts
index ffdacd4f707d..254c3003c89a 100644
--- a/samples/client/petstore/typescript-angular2/default/model/Category.ts
+++ b/samples/client/petstore/typescript-angular2/default/model/Category.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A category for a pet
+ */
export interface Category {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/default/model/Order.ts b/samples/client/petstore/typescript-angular2/default/model/Order.ts
index 9c47071c5b67..2b6c7aeebd66 100644
--- a/samples/client/petstore/typescript-angular2/default/model/Order.ts
+++ b/samples/client/petstore/typescript-angular2/default/model/Order.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * An order for a pets from the pet store
+ */
export interface Order {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/default/model/Pet.ts b/samples/client/petstore/typescript-angular2/default/model/Pet.ts
index d64dc809e532..b878cadb9058 100644
--- a/samples/client/petstore/typescript-angular2/default/model/Pet.ts
+++ b/samples/client/petstore/typescript-angular2/default/model/Pet.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A pet for sale in the pet store
+ */
export interface Pet {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/default/model/Tag.ts b/samples/client/petstore/typescript-angular2/default/model/Tag.ts
index 8a3b99ae9ca4..8cbdc4fa145e 100644
--- a/samples/client/petstore/typescript-angular2/default/model/Tag.ts
+++ b/samples/client/petstore/typescript-angular2/default/model/Tag.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A tag for a pet
+ */
export interface Tag {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/default/model/User.ts b/samples/client/petstore/typescript-angular2/default/model/User.ts
index 43d00f7b318e..fbf75dfe28e3 100644
--- a/samples/client/petstore/typescript-angular2/default/model/User.ts
+++ b/samples/client/petstore/typescript-angular2/default/model/User.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A User who is purchasing from the pet store
+ */
export interface User {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/default/model/models.ts b/samples/client/petstore/typescript-angular2/default/model/models.ts
index 92dac02846c2..f53c1dd42bdd 100644
--- a/samples/client/petstore/typescript-angular2/default/model/models.ts
+++ b/samples/client/petstore/typescript-angular2/default/model/models.ts
@@ -1,3 +1,4 @@
+export * from './ApiResponse';
export * from './Category';
export * from './Order';
export * from './Pet';
diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts
index ddebacbbc883..ca01b4ca3401 100644
--- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts
+++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -45,13 +45,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
+ public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.addPetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -68,7 +68,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -78,13 +78,13 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
- public findPetsByStatus(status?: Array, extraHttpRequestParams?: any): Observable> {
+ public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> {
return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -94,21 +94,21 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
- public findPetsByTags(tags?: Array, extraHttpRequestParams?: any): Observable> {
+ public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> {
return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
/**
* Find pet by ID
- * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- * @param petId ID of pet that needs to be fetched
+ * Returns a single pet
+ * @param petId ID of pet to return
*/
public getPetById(petId: number, extraHttpRequestParams?: any): Observable {
return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams)
@@ -116,7 +116,7 @@ export class PetApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
+ public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -144,13 +144,13 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
- public updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
+ public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> {
return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -162,13 +162,13 @@ export class PetApi {
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
- public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> {
+ public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable {
return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -179,11 +179,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable {
+ public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling addPet.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -192,8 +196,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -246,8 +250,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -278,15 +282,17 @@ export class PetApi {
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
*/
- public findPetsByStatusWithHttpInfo(status?: Array, extraHttpRequestParams?: any): Observable {
+ public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/findByStatus';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'status' is not null or undefined
+ if (status === null || status === undefined) {
+ throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
+ }
if (status) {
- status.forEach((element) => {
- queryParameters.append('status', element);
- })
+ queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -295,8 +301,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -327,15 +333,17 @@ export class PetApi {
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
*/
- public findPetsByTagsWithHttpInfo(tags?: Array, extraHttpRequestParams?: any): Observable {
+ public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/findByTags';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'tags' is not null or undefined
+ if (tags === null || tags === undefined) {
+ throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
+ }
if (tags) {
- tags.forEach((element) => {
- queryParameters.append('tags', element);
- })
+ queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
}
// to determine the Content-Type header
@@ -344,8 +352,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -373,8 +381,8 @@ export class PetApi {
/**
* Find pet by ID
- * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- * @param petId ID of pet that needs to be fetched
+ * Returns a single pet
+ * @param petId ID of pet to return
*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/${petId}'
@@ -392,8 +400,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (api_key) required
@@ -401,15 +409,6 @@ export class PetApi {
headers.set('api_key', this.configuration.apiKey);
}
- // authentication (petstore_auth) required
- // oauth required
- if (this.configuration.accessToken) {
- let accessToken = typeof this.configuration.accessToken === 'function'
- ? this.configuration.accessToken()
- : this.configuration.accessToken;
- headers.set('Authorization', 'Bearer ' + accessToken);
- }
-
let requestOptions: RequestOptionsArgs = new RequestOptions({
method: RequestMethod.Get,
headers: headers,
@@ -429,11 +428,15 @@ export class PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable {
+ public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling updatePet.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
'application/json',
@@ -442,8 +445,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -479,7 +482,7 @@ export class PetApi {
* @param name Updated name of the pet
* @param status Updated status of the pet
*/
- public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable {
+ public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/pet/${petId}'
.replace('${' + 'petId' + '}', String(petId));
@@ -498,8 +501,8 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
// authentication (petstore_auth) required
@@ -562,8 +565,7 @@ export class PetApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/json'
];
// authentication (petstore_auth) required
diff --git a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts
index ab4ef909a5fa..2bb34f08e5d2 100644
--- a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts
+++ b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -51,7 +51,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -66,7 +66,7 @@ export class StoreApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -76,13 +76,13 @@ export class StoreApi {
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
- public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable {
+ public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable {
return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -92,13 +92,13 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
- public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable {
+ public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable {
return this.placeOrderWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -125,8 +125,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -158,8 +158,7 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/json'
];
// authentication (api_key) required
@@ -186,7 +185,7 @@ export class StoreApi {
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
- public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable {
+ public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/store/order/${orderId}'
.replace('${' + 'orderId' + '}', String(orderId));
@@ -202,8 +201,8 @@ export class StoreApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -225,19 +224,23 @@ export class StoreApi {
*
* @param body order placed for purchasing the pet
*/
- public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable {
+ public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/store/order';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling placeOrder.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
diff --git a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts
index b1095986e922..533bbbefeb34 100644
--- a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts
+++ b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -45,13 +45,13 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
- public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
+ public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.createUserWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -61,13 +61,13 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithArrayInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> {
+ public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -77,13 +77,13 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithListInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> {
+ public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> {
return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -99,7 +99,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -115,7 +115,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -126,13 +126,13 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
- public loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable {
+ public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable {
return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -147,7 +147,7 @@ export class UserApi {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -158,13 +158,13 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
- public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> {
+ public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> {
return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
- return response.json();
+ return response.json() || {};
}
});
}
@@ -175,19 +175,23 @@ export class UserApi {
* This can only be done by the logged in user.
* @param body Created user object
*/
- public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable {
+ public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUser.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -212,19 +216,23 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithArrayInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable {
+ public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/createWithArray';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -249,19 +257,23 @@ export class UserApi {
*
* @param body List of user object
*/
- public createUsersWithListInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable {
+ public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/createWithList';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
@@ -302,8 +314,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -341,8 +353,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -365,11 +377,19 @@ export class UserApi {
* @param username The user name for login
* @param password The password for login in clear text
*/
- public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable {
+ public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/login';
let queryParameters = new URLSearchParams();
let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845
+ // verify required parameter 'username' is not null or undefined
+ if (username === null || username === undefined) {
+ throw new Error('Required parameter username was null or undefined when calling loginUser.');
+ }
+ // verify required parameter 'password' is not null or undefined
+ if (password === null || password === undefined) {
+ throw new Error('Required parameter password was null or undefined when calling loginUser.');
+ }
if (username !== undefined) {
queryParameters.set('username', username);
}
@@ -384,8 +404,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -417,8 +437,8 @@ export class UserApi {
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
let requestOptions: RequestOptionsArgs = new RequestOptions({
@@ -441,7 +461,7 @@ export class UserApi {
* @param username name that need to be deleted
* @param body Updated user object
*/
- public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable {
+ public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable {
const path = this.basePath + '/user/${username}'
.replace('${' + 'username' + '}', String(username));
@@ -451,14 +471,18 @@ export class UserApi {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
+ // verify required parameter 'body' is not null or undefined
+ if (body === null || body === undefined) {
+ throw new Error('Required parameter body was null or undefined when calling updateUser.');
+ }
// to determine the Content-Type header
let consumes: string[] = [
];
// to determine the Accept header
let produces: string[] = [
- 'application/json',
- 'application/xml'
+ 'application/xml',
+ 'application/json'
];
headers.set('Content-Type', 'application/json');
diff --git a/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts b/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts
new file mode 100644
index 000000000000..f86e84f93a3a
--- /dev/null
+++ b/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts
@@ -0,0 +1,25 @@
+/**
+ * Swagger Petstore
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
+ *
+ * OpenAPI spec version: 1.0.0
+ * Contact: apiteam@swagger.io
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ * Do not edit the class manually.
+ */
+
+import * as models from './models';
+
+/**
+ * Describes the result of uploading an image resource
+ */
+export interface ApiResponse {
+ code?: number;
+
+ type?: string;
+
+ message?: string;
+
+}
diff --git a/samples/client/petstore/typescript-angular2/npm/model/Category.ts b/samples/client/petstore/typescript-angular2/npm/model/Category.ts
index ffdacd4f707d..254c3003c89a 100644
--- a/samples/client/petstore/typescript-angular2/npm/model/Category.ts
+++ b/samples/client/petstore/typescript-angular2/npm/model/Category.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A category for a pet
+ */
export interface Category {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/npm/model/Order.ts b/samples/client/petstore/typescript-angular2/npm/model/Order.ts
index 9c47071c5b67..2b6c7aeebd66 100644
--- a/samples/client/petstore/typescript-angular2/npm/model/Order.ts
+++ b/samples/client/petstore/typescript-angular2/npm/model/Order.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * An order for a pets from the pet store
+ */
export interface Order {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/npm/model/Pet.ts b/samples/client/petstore/typescript-angular2/npm/model/Pet.ts
index d64dc809e532..b878cadb9058 100644
--- a/samples/client/petstore/typescript-angular2/npm/model/Pet.ts
+++ b/samples/client/petstore/typescript-angular2/npm/model/Pet.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A pet for sale in the pet store
+ */
export interface Pet {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/npm/model/Tag.ts b/samples/client/petstore/typescript-angular2/npm/model/Tag.ts
index 8a3b99ae9ca4..8cbdc4fa145e 100644
--- a/samples/client/petstore/typescript-angular2/npm/model/Tag.ts
+++ b/samples/client/petstore/typescript-angular2/npm/model/Tag.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A tag for a pet
+ */
export interface Tag {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/npm/model/User.ts b/samples/client/petstore/typescript-angular2/npm/model/User.ts
index 43d00f7b318e..fbf75dfe28e3 100644
--- a/samples/client/petstore/typescript-angular2/npm/model/User.ts
+++ b/samples/client/petstore/typescript-angular2/npm/model/User.ts
@@ -1,9 +1,9 @@
/**
* Swagger Petstore
- * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
+ * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
- * Contact: apiteam@wordnik.com
+ * Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
@@ -12,6 +12,9 @@
import * as models from './models';
+/**
+ * A User who is purchasing from the pet store
+ */
export interface User {
id?: number;
diff --git a/samples/client/petstore/typescript-angular2/npm/model/models.ts b/samples/client/petstore/typescript-angular2/npm/model/models.ts
index 92dac02846c2..f53c1dd42bdd 100644
--- a/samples/client/petstore/typescript-angular2/npm/model/models.ts
+++ b/samples/client/petstore/typescript-angular2/npm/model/models.ts
@@ -1,3 +1,4 @@
+export * from './ApiResponse';
export * from './Category';
export * from './Order';
export * from './Pet';