mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Beautify typescript angular output
This commit is contained in:
parent
88ed496b44
commit
bc8eae838c
@ -6,11 +6,11 @@
|
|||||||
module {{package}} {
|
module {{package}} {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
{{#description}}
|
{{#description}}
|
||||||
/**
|
/**
|
||||||
* {{&description}}
|
* {{&description}}
|
||||||
*/
|
*/
|
||||||
{{/description}}
|
{{/description}}
|
||||||
export class {{classname}} {
|
export class {{classname}} {
|
||||||
private basePath = '{{contextPath}}';
|
private basePath = '{{contextPath}}';
|
||||||
|
|
||||||
@ -21,24 +21,37 @@ module {{package}} {
|
|||||||
this.basePath = basePath;
|
this.basePath = basePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
|
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
|
||||||
var path = this.basePath + '{{path}}';
|
var path = this.basePath + '{{path}}';
|
||||||
{{#pathParams}}
|
|
||||||
|
{{#pathParams}}
|
||||||
path = path.replace('{' + '{{paramName}}' + '}', String({{paramName}}));
|
path = path.replace('{' + '{{paramName}}' + '}', String({{paramName}}));
|
||||||
{{/pathParams}}
|
|
||||||
|
{{/pathParams}}
|
||||||
var queryParameters: any = {};
|
var queryParameters: any = {};
|
||||||
var headerParams: any = {};
|
var headerParams: any = {};
|
||||||
{{#allParams}}{{#required}}
|
|
||||||
|
{{#allParams}}
|
||||||
|
{{#required}}
|
||||||
// verify required parameter '{{paramName}}' is set
|
// verify required parameter '{{paramName}}' is set
|
||||||
if (!{{paramName}}) {
|
if (!{{paramName}}) {
|
||||||
throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}');
|
throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}');
|
||||||
}
|
}
|
||||||
{{/required}}{{/allParams}}
|
|
||||||
{{#queryParams}}if ({{paramName}} !== undefined) {
|
{{/required}}
|
||||||
|
{{/allParams}}
|
||||||
|
{{#queryParams}}
|
||||||
|
if ({{paramName}} !== undefined) {
|
||||||
queryParameters['{{paramName}}'] = {{paramName}};
|
queryParameters['{{paramName}}'] = {{paramName}};
|
||||||
}{{/queryParams}}
|
}
|
||||||
{{#headerParams}}headerParams['{{paramName}}'] = {{paramName}};{{/headerParams}}
|
|
||||||
|
{{/queryParams}}
|
||||||
|
{{#headerParams}}
|
||||||
|
headerParams['{{paramName}}'] = {{paramName}};
|
||||||
|
|
||||||
|
{{/headerParams}}
|
||||||
var httpRequestParams: any = {
|
var httpRequestParams: any = {
|
||||||
method: '{{httpMethod}}',
|
method: '{{httpMethod}}',
|
||||||
url: path,
|
url: path,
|
||||||
@ -59,7 +72,7 @@ module {{package}} {
|
|||||||
|
|
||||||
return this.$http(httpRequestParams);
|
return this.$http(httpRequestParams);
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user