forked from loafle/openapi-generator-original
Fix for missing headers (2.3.0) (#4329)
* Fix for #4322 Signed-off-by: Sebastian Haas <sebastian@haas.tech> * Run typescript-angular2-petstore-all.sh Signed-off-by: Sebastian Haas <sebastian@haas.tech>
This commit is contained in:
parent
4785451bf8
commit
1ee7907aaa
@ -102,10 +102,9 @@ export class {{classname}} {
|
||||
}
|
||||
{{/queryParams}}
|
||||
|
||||
{{#headers}}
|
||||
{{#headerParams}}
|
||||
headers.set('{{baseName}}', String({{paramName}}));
|
||||
|
||||
{{/headers}}
|
||||
{{/headerParams}}
|
||||
|
||||
// to determine the Content-Type header
|
||||
let consumes: string[] = [
|
||||
|
@ -54,6 +54,21 @@ export class PetService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Extends object by coping non-existing properties.
|
||||
* @param objA object to be extended
|
||||
* @param objB source object
|
||||
*/
|
||||
private extendObj<T1,T2>(objA: T1, objB: T2) {
|
||||
for(let key in objB){
|
||||
if(objB.hasOwnProperty(key)){
|
||||
objA[key] = objB[key];
|
||||
}
|
||||
}
|
||||
return <T1&T2>objA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
@ -227,10 +242,14 @@ export class PetService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -250,6 +269,7 @@ export class PetService {
|
||||
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
|
||||
}
|
||||
|
||||
headers.set('api_key', String(apiKey));
|
||||
|
||||
// to determine the Content-Type header
|
||||
let consumes: string[] = [
|
||||
@ -274,10 +294,14 @@ export class PetService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Delete,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -319,10 +343,14 @@ export class PetService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -364,10 +392,14 @@ export class PetService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -397,17 +429,17 @@ export class PetService {
|
||||
'application/xml'
|
||||
];
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey)
|
||||
{
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (this.configuration.accessToken)
|
||||
{
|
||||
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken);
|
||||
}
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey)
|
||||
{
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -415,10 +447,14 @@ export class PetService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -461,10 +497,14 @@ export class PetService {
|
||||
method: RequestMethod.Put,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -520,10 +560,14 @@ export class PetService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: formParams.toString(),
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -579,10 +623,14 @@ export class PetService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: formParams.toString(),
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,21 @@ export class StoreService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Extends object by coping non-existing properties.
|
||||
* @param objA object to be extended
|
||||
* @param objB source object
|
||||
*/
|
||||
private extendObj<T1,T2>(objA: T1, objB: T2) {
|
||||
for(let key in objB){
|
||||
if(objB.hasOwnProperty(key)){
|
||||
objA[key] = objB[key];
|
||||
}
|
||||
}
|
||||
return <T1&T2>objA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
@ -151,10 +166,14 @@ export class StoreService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Delete,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -191,10 +210,14 @@ export class StoreService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -231,10 +254,14 @@ export class StoreService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -269,10 +296,14 @@ export class StoreService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,21 @@ export class UserService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Extends object by coping non-existing properties.
|
||||
* @param objA object to be extended
|
||||
* @param objB source object
|
||||
*/
|
||||
private extendObj<T1,T2>(objA: T1, objB: T2) {
|
||||
for(let key in objB){
|
||||
if(objB.hasOwnProperty(key)){
|
||||
objA[key] = objB[key];
|
||||
}
|
||||
}
|
||||
return <T1&T2>objA;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
@ -215,10 +230,14 @@ export class UserService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -253,10 +272,14 @@ export class UserService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -291,10 +314,14 @@ export class UserService {
|
||||
method: RequestMethod.Post,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -331,10 +358,14 @@ export class UserService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Delete,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -371,10 +402,14 @@ export class UserService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -414,10 +449,14 @@ export class UserService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -449,10 +488,14 @@ export class UserService {
|
||||
let requestOptions: RequestOptionsArgs = new RequestOptions({
|
||||
method: RequestMethod.Get,
|
||||
headers: headers,
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
@ -492,10 +535,14 @@ export class UserService {
|
||||
method: RequestMethod.Put,
|
||||
headers: headers,
|
||||
body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612
|
||||
search: queryParameters,
|
||||
responseType: ResponseContentType.Json
|
||||
search: queryParameters
|
||||
});
|
||||
|
||||
// https://github.com/swagger-api/swagger-codegen/issues/4037
|
||||
if (extraHttpRequestParams) {
|
||||
requestOptions = this.extendObj(requestOptions, extraHttpRequestParams);
|
||||
}
|
||||
|
||||
return this.http.request(path, requestOptions);
|
||||
}
|
||||
|
||||
|
@ -2,3 +2,4 @@ export * from './api/api';
|
||||
export * from './model/models';
|
||||
export * from './variables';
|
||||
export * from './configuration';
|
||||
export * from './api.module';
|
@ -1,4 +1,4 @@
|
||||
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201611081538
|
||||
## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201612061154
|
||||
|
||||
### Building
|
||||
|
||||
@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's.
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201611081538 --save
|
||||
npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201612061154 --save
|
||||
```
|
||||
|
||||
_unPublished (not recommended):_
|
||||
|
@ -50,6 +50,7 @@ export class PetService {
|
||||
}
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,6 +269,7 @@ export class PetService {
|
||||
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
|
||||
}
|
||||
|
||||
headers.set('api_key', String(apiKey));
|
||||
|
||||
// to determine the Content-Type header
|
||||
let consumes: string[] = [
|
||||
@ -427,17 +429,17 @@ export class PetService {
|
||||
'application/xml'
|
||||
];
|
||||
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey)
|
||||
{
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
}
|
||||
// authentication (petstore_auth) required
|
||||
// oauth required
|
||||
if (this.configuration.accessToken)
|
||||
{
|
||||
headers.set('Authorization', 'Bearer ' + this.configuration.accessToken);
|
||||
}
|
||||
// authentication (api_key) required
|
||||
if (this.configuration.apiKey)
|
||||
{
|
||||
headers.set('api_key', this.configuration.apiKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -50,6 +50,7 @@ export class StoreService {
|
||||
}
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ export class UserService {
|
||||
}
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
this.basePath = basePath || configuration.basePath || this.basePath;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,24 @@
|
||||
export interface ConfigurationParameters {
|
||||
apiKey?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string;
|
||||
basePath?: string;
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
apiKey: string;
|
||||
username: string;
|
||||
password: string;
|
||||
accessToken: string;
|
||||
basePath: string;
|
||||
|
||||
|
||||
constructor(configurationParameters: ConfigurationParameters = {}) {
|
||||
this.apiKey = configurationParameters.apiKey;
|
||||
this.username = configurationParameters.username;
|
||||
this.password = configurationParameters.password;
|
||||
this.accessToken = configurationParameters.accessToken;
|
||||
this.basePath = configurationParameters.basePath;
|
||||
}
|
||||
}
|
@ -2,3 +2,4 @@ export * from './api/api';
|
||||
export * from './model/models';
|
||||
export * from './variables';
|
||||
export * from './configuration';
|
||||
export * from './api.module';
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@swagger/angular2-typescript-petstore",
|
||||
"version": "0.0.1-SNAPSHOT.201611081538",
|
||||
"version": "0.0.1-SNAPSHOT.201612061154",
|
||||
"description": "swagger client for @swagger/angular2-typescript-petstore",
|
||||
"author": "Swagger Codegen Contributors",
|
||||
"keywords": [
|
||||
@ -10,8 +10,7 @@
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "typings install && tsc --outDir dist/",
|
||||
"postinstall": "npm run build"
|
||||
"build": "typings install && tsc --outDir dist/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^2.0.0",
|
||||
@ -20,7 +19,7 @@
|
||||
"@angular/compiler": "^2.0.0",
|
||||
"core-js": "^2.4.0",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"rxjs": "5.0.0-beta.12",
|
||||
"zone.js": "^0.6.17"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -31,9 +30,9 @@
|
||||
"@angular/platform-browser": "^2.0.0",
|
||||
"core-js": "^2.4.0",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"rxjs": "5.0.0-beta.12",
|
||||
"zone.js": "^0.6.17",
|
||||
"typescript": "^1.8.10",
|
||||
"typescript": "^2.0.0",
|
||||
"typings": "^1.3.2"
|
||||
},
|
||||
"publishConfig":{
|
||||
|
@ -17,7 +17,8 @@
|
||||
"node_modules",
|
||||
"typings/main.d.ts",
|
||||
"typings/main",
|
||||
"lib"
|
||||
"lib",
|
||||
"dist"
|
||||
],
|
||||
"filesGlob": [
|
||||
"./model/*.ts",
|
||||
|
Loading…
x
Reference in New Issue
Block a user