Skip to content

[TypeScript][Angular] Fixed spacing in model.mustache #6788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this

{{/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