Skip to content

Commit

Permalink
Fixed spacing in model.mustache (#6788)
Browse files Browse the repository at this point in the history
* Added v4/v4.3 to typescript-angular-petsotre-all and renamed from angular2 to angular

* refactored typescript-angular-petstore-all.sh

* changed profile id for typescript-angularjs to properly have angularjs instead of just angular.

* Spacing at end of model template

* Corrected backwards compatible enum typing
  • Loading branch information
kenisteward authored and wing328 committed Oct 24, 2017
1 parent fe5c2e6 commit f7471ad
Show file tree
Hide file tree
Showing 61 changed files with 251 additions and 196 deletions.
8 changes: 8 additions & 0 deletions bin/typescript-angular-v2-petstore-all.sh → bin/typescript-angular-petstore-all.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ java $JAVA_OPTS -jar $executable $ags
echo "Typescript Petstore API client (with interfaces generated)"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2"
java $JAVA_OPTS -jar $executable $ags

echo "Typescript Petstore API client (v4 { Adding InjectionToken Over OpaqueToken })"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v4/npm --additional-properties ngVersion=4"
java $JAVA_OPTS -jar $executable $ags

echo "Typescript Petstore API client (v4.3 { Adding HttpClientModule over HttpModule })"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-angular -c bin/typescript-petstore-npm.json -o samples/client/petstore/typescript-angular-v4.3/npm --additional-properties ngVersion=4.3"
java $JAVA_OPTS -jar $executable $ags
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
call .\bin\windows\typescript-angular-v2-with-npm.bat
call .\bin\windows\typescript-angular-v2-interfaces.bat
call .\bin\windows\typescript-angular-v2.bat
call .\bin\windows\typescript-angular-v4-with-npm.bat
call .\bin\windows\typescript-angular-v4.3-with-npm.bat


Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
* 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.
*/
*/
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}};
export type {{enumName}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}};

export const {{enumName}} = {
{{#allowableValues}}
{{#enumVars}}
{{name}}: {{{value}}} as {{enumName}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
*/
{{/description}}
{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{datatype}}}{{/isEnum}};

{{/vars}}
}{{#hasEnums}}
export namespace {{classname}} {
{{#vars}}
{{#isEnum}}
export type {{enumName}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}} | {{/-last}}{{/enumVars}}{{/allowableValues}};
export const {{enumName}} = {
{{#allowableValues}}
{{#enumVars}}
{{name}}: {{{value}}} as {{enumName}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/isEnum}}
{{/vars}}
}{{/hasEnums}}

}{{/hasEnums}}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@
</modules>
</profile>
<profile>
<id>typescript-angular-client</id>
<id>typescript-angularjs-client</id>
<activation>
<property>
<name>env</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml.bash
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@
</modules>
</profile>
<profile>
<id>typescript-angular-client</id>
<id>typescript-angularjs-client</id>
<activation>
<property>
<name>env</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml.circleci
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
</modules>
</profile>
<profile>
<id>typescript-angular-client</id>
<id>typescript-angularjs-client</id>
<activation>
<property>
<name>env</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml.shippable
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@
</modules>
</profile>
<profile>
<id>typescript-angular-client</id>
<id>typescript-angularjs-client</id>
<activation>
<property>
<name>env</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@
*/



/**
* Describes the result of uploading an image resource
*/
export interface ApiResponse {
code?: number;

type?: string;

message?: string;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
*/



/**
* A category for a pet
*/
export interface Category {
id?: number;

name?: string;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@
*/



/**
* An order for a pets from the pet store
*/
export interface Order {
id?: number;

petId?: number;

quantity?: number;

shipDate?: Date;

/**
* Order Status
*/
status?: Order.StatusEnum;

complete?: boolean;

}
export namespace Order {
export type StatusEnum = 'placed' | 'approved' | 'delivered';
export const StatusEnum = {
Placed: 'placed' as StatusEnum,
Approved: 'approved' as StatusEnum,
Delivered: 'delivered' as StatusEnum
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

import { Category } from './category';
import { Tag } from './tag';

Expand All @@ -19,21 +18,20 @@ import { Tag } from './tag';
*/
export interface Pet {
id?: number;

category?: Category;

name: string;

photoUrls: Array<string>;

tags?: Array<Tag>;

/**
* pet status in the store
*/
status?: Pet.StatusEnum;

}
export namespace Pet {
export type StatusEnum = 'available' | 'pending' | 'sold';
export const StatusEnum = {
Available: 'available' as StatusEnum,
Pending: 'pending' as StatusEnum,
Sold: 'sold' as StatusEnum
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
*/



/**
* A tag for a pet
*/
export interface Tag {
id?: number;

name?: string;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,19 @@
*/



/**
* A User who is purchasing from the pet store
*/
export interface User {
id?: number;

username?: string;

firstName?: string;

lastName?: string;

email?: string;

password?: string;

phone?: string;

/**
* User Status
*/
userStatus?: number;

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

/* tslint:disable:no-unused-variable member-ordering */

import { Inject, Injectable, Optional } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@
*/



/**
* Describes the result of uploading an image resource
*/
export interface ApiResponse {
code?: number;

type?: string;

message?: string;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
*/



/**
* A category for a pet
*/
export interface Category {
id?: number;

name?: string;

}
12 changes: 5 additions & 7 deletions samples/client/petstore/typescript-angular-v2/npm/model/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@
*/



/**
* An order for a pets from the pet store
*/
export interface Order {
id?: number;

petId?: number;

quantity?: number;

shipDate?: Date;

/**
* Order Status
*/
status?: Order.StatusEnum;

complete?: boolean;

}
export namespace Order {
export type StatusEnum = 'placed' | 'approved' | 'delivered';
export const StatusEnum = {
Placed: 'placed' as StatusEnum,
Approved: 'approved' as StatusEnum,
Delivered: 'delivered' as StatusEnum
}
}
12 changes: 5 additions & 7 deletions samples/client/petstore/typescript-angular-v2/npm/model/pet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/

import { Category } from './category';
import { Tag } from './tag';

Expand All @@ -19,21 +18,20 @@ import { Tag } from './tag';
*/
export interface Pet {
id?: number;

category?: Category;

name: string;

photoUrls: Array<string>;

tags?: Array<Tag>;

/**
* pet status in the store
*/
status?: Pet.StatusEnum;

}
export namespace Pet {
export type StatusEnum = 'available' | 'pending' | 'sold';
export const StatusEnum = {
Available: 'available' as StatusEnum,
Pending: 'pending' as StatusEnum,
Sold: 'sold' as StatusEnum
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
*/



/**
* A tag for a pet
*/
export interface Tag {
id?: number;

name?: string;

}
Loading

0 comments on commit f7471ad

Please sign in to comment.