From 4133cae2bce577f8e6f4d59d0d0c3387d5bd61e7 Mon Sep 17 00:00:00 2001 From: Martin Hardorf Date: Wed, 8 Jul 2015 11:19:25 +0200 Subject: [PATCH] Fixed mustache to handle non-required parameters --- .../src/main/resources/TypeScript-Angular/api.mustache | 4 ++-- .../src/main/resources/TypeScript-node/api.mustache | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache index 88f7f9ff15a..eb9e27fc06a 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-Angular/api.mustache @@ -22,7 +22,7 @@ module {{package}} { } } {{#operation}} - public {{nickname}} ({{#allParams}}{{paramName}}: {{{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}}'; {{#pathParams}} path = path.replace('{' + '{{paramName}}' + '}', String({{paramName}})); @@ -50,7 +50,7 @@ module {{package}} { }; if (extraHttpRequestParams) { - for (var k in extraHttpRequestParams){ + for (var k in extraHttpRequestParams) { if (extraHttpRequestParams.hasOwnProperty(k)) { httpRequestParams[k] = extraHttpRequestParams[k]; } diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index eb569cdc928..22775f70340 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -16,7 +16,7 @@ export class {{classname}} { } {{#operation}} - public {{nickname}} ({{#allParams}}{{paramName}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}} ) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}} }> { + public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.ClientResponse; {{#returnType}}body: {{{returnType}}}; {{/returnType}} }> { var path = this.url + this.basePath + '{{path}}'; {{#pathParams}}