From c54bceffe388e30ef0b559a02c7996e5444dc9c6 Mon Sep 17 00:00:00 2001 From: Kristof Vrolijkx Date: Tue, 19 Apr 2016 11:56:29 +0200 Subject: [PATCH] #1809 Some small template changes. --- modules/swagger-codegen-cli/pom.xml | 2 +- modules/swagger-codegen-maven-plugin/pom.xml | 2 +- modules/swagger-codegen/pom.xml | 2 +- .../languages/TypescriptAngular2ClientCodegen.java | 2 +- .../main/resources/typescript-angular2/api.mustache | 7 +++---- .../resources/typescript-angular2/model.d.mustache | 6 +++--- .../main/resources/typescript-angular2/model.mustache | 10 ++++------ modules/swagger-generator/pom.xml | 2 +- pom.xml | 2 +- 9 files changed, 16 insertions(+), 19 deletions(-) diff --git a/modules/swagger-codegen-cli/pom.xml b/modules/swagger-codegen-cli/pom.xml index 90a14b16deb..bcdf4fb1da2 100644 --- a/modules/swagger-codegen-cli/pom.xml +++ b/modules/swagger-codegen-cli/pom.xml @@ -3,7 +3,7 @@ io.swagger swagger-codegen-project - 2.1.6 + 2.1.7-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-codegen-maven-plugin/pom.xml b/modules/swagger-codegen-maven-plugin/pom.xml index b45e0d97874..10cd4e7d90f 100644 --- a/modules/swagger-codegen-maven-plugin/pom.xml +++ b/modules/swagger-codegen-maven-plugin/pom.xml @@ -6,7 +6,7 @@ io.swagger swagger-codegen-project - 2.1.6 + 2.1.7-SNAPSHOT ../.. swagger-codegen-maven-plugin diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index afaecfc3512..a5f8907c721 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -3,7 +3,7 @@ io.swagger swagger-codegen-project - 2.1.6 + 2.1.7-SNAPSHOT ../.. 4.0.0 diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypescriptAngular2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypescriptAngular2ClientCodegen.java index 676fabc5556..e23f4482dfa 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypescriptAngular2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypescriptAngular2ClientCodegen.java @@ -25,7 +25,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod @Override public String getName() { - return "TypeScript-Angular2"; + return "typescript-angular2"; } @Override 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 5c2d412d5c0..34a9b14da1e 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -2,7 +2,6 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from 'angu import {Injectable} from 'angular2/core'; import {Observable} from 'rxjs/Observable'; import * as model from "../model/model.d.ts" -import {AppSettings} from "../../AppSettings" /* tslint:disable:no-unused-variable member-ordering */ @@ -19,9 +18,9 @@ export class {{classname}} { protected basePath = '{{basePath}}'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http, appSettigs: AppSettings) { - if (appSettigs && appSettigs.apiBaseUrl) { - this.basePath = appSettigs.apiBaseUrl; + constructor(protected http: Http, basePath: string) { + if (basePath) { + this.basePath = basePath; } } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/model.d.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/model.d.mustache index 8973ef01ecd..e682f9bb2e7 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/model.d.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/model.d.mustache @@ -1,11 +1,11 @@ {{#models}} {{#model}} -export { {{{classname}}} } from './{{{ classname }}}'; +export * from './{{{ classname }}}'; {{/model}} {{/models}} -/* + {{#apiInfo}} {{#apis}} {{#operations}} @@ -13,5 +13,5 @@ export * from './{{classname}}'; {{/operations}} {{/apis}} {{/apiInfo}} -*/ + diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache index ff36a380e94..5272576afd8 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/model.mustache @@ -17,21 +17,19 @@ export interface {{classname}} {{#parent}}extends model.{{{parent}}} {{/parent}} */ {{/description}} - {{name}}?: {{#isEnum}}{{classname}}.{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; + {{name}}?: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}}; {{/vars}} } {{#hasEnums}} -export namespace {{classname}} { {{#vars}} {{#isEnum}} - export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} - {{.}} = '{{.}}',{{/values}}{{/allowableValues}} - } +export enum {{datatypeWithEnum}} { {{#allowableValues}}{{#values}} + {{.}} = '{{.}}',{{/values}}{{/allowableValues}} +} {{/isEnum}} {{/vars}} -} {{/hasEnums}} {{/model}} {{/models}} diff --git a/modules/swagger-generator/pom.xml b/modules/swagger-generator/pom.xml index 2d2b45d7892..ffd02dc352a 100644 --- a/modules/swagger-generator/pom.xml +++ b/modules/swagger-generator/pom.xml @@ -4,7 +4,7 @@ io.swagger swagger-codegen-project - 2.1.6 + 2.1.7-SNAPSHOT ../.. swagger-generator diff --git a/pom.xml b/pom.xml index 9ac1890ea91..e881d136cb2 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ swagger-codegen-project pom swagger-codegen-project - 2.1.6 + 2.1.7-SNAPSHOT https://github.com/swagger-api/swagger-codegen scm:git:git@github.com:swagger-api/swagger-codegen.git