Skip to content
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

Multiple enhancements to typescript fetch generator #145

Merged
merged 7 commits into from Jul 18, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -54,7 +54,7 @@ public class CodegenProperty implements Cloneable {
public boolean exclusiveMinimum;
public boolean exclusiveMaximum;
public boolean hasMore, required, secondaryParam;
public boolean hasMoreNonReadOnly; // for model constructor, true if next properyt is not readonly
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
public boolean isPrimitiveType, isContainer, isNotContainer;
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile, isBoolean, isDate, isDateTime, isUuid;
public boolean isListContainer, isMapContainer;
Expand Down
Expand Up @@ -44,7 +44,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
Expand All @@ -61,7 +61,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down
Expand Up @@ -6,7 +6,7 @@
export enum {{classname}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = <any> {{{value}}}{{^-last}},{{/-last}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
Expand Up @@ -32,7 +32,7 @@ export namespace {{classname}} {
export enum {{enumName}} {
{{#allowableValues}}
{{#enumVars}}
{{{name}}} = <any> {{{value}}}{{^-last}},{{/-last}}
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
Expand Down
Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.0"
"typescript": "^2.4"
}{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}}
"publishConfig":{
Expand Down
16 changes: 8 additions & 8 deletions samples/client/petstore/typescript-fetch/builds/default/api.ts
Expand Up @@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
Expand All @@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down Expand Up @@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}

Expand Down Expand Up @@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

Expand Down
Expand Up @@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
Expand All @@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down Expand Up @@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}

Expand Down Expand Up @@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

Expand Down

This file was deleted.

Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.0"
"typescript": "^2.4"
},
"publishConfig":{
"registry":"https://skimdb.npmjs.com/registry"
Expand Down
Expand Up @@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
Expand All @@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down Expand Up @@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}

Expand Down Expand Up @@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

Expand Down
Expand Up @@ -55,7 +55,7 @@ export interface FetchArgs {
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration;
protected configuration: Configuration | undefined;

constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = portableFetch) {
if (configuration) {
Expand All @@ -72,7 +72,7 @@ export class BaseAPI {
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError"
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
Expand Down Expand Up @@ -178,9 +178,9 @@ export namespace Order {
* @enum {string}
*/
export enum StatusEnum {
Placed = <any> 'placed',
Approved = <any> 'approved',
Delivered = <any> 'delivered'
Placed = 'placed',
Approved = 'approved',
Delivered = 'delivered'
}
}

Expand Down Expand Up @@ -238,9 +238,9 @@ export namespace Pet {
* @enum {string}
*/
export enum StatusEnum {
Available = <any> 'available',
Pending = <any> 'pending',
Sold = <any> 'sold'
Available = 'available',
Pending = 'pending',
Sold = 'sold'
}
}

Expand Down

This file was deleted.

Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "^8.0.9",
"typescript": "^2.0"
"typescript": "^2.4"
},
"publishConfig":{
"registry":"https://skimdb.npmjs.com/registry"
Expand Down