forked from loafle/openapi-generator-original
Multiple enhancements to typescript fetch generator (#145)
This commit is contained in:
parent
1e596496a5
commit
5344a02bbc
@ -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;
|
||||
|
@ -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) {
|
||||
@ -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);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
export enum {{classname}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}} = <any> {{{value}}}{{^-last}},{{/-last}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export namespace {{classname}} {
|
||||
export enum {{enumName}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}} = <any> {{{value}}}{{^-last}},{{/-last}}
|
||||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^8.0.9",
|
||||
"typescript": "^2.0"
|
||||
"typescript": "^2.4"
|
||||
}{{#npmRepository}},{{/npmRepository}}
|
||||
{{#npmRepository}}
|
||||
"publishConfig":{
|
||||
|
@ -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) {
|
||||
@ -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);
|
||||
}
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
@ -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);
|
||||
}
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
{
|
||||
"name": "@swagger/typescript-fetch-petstore",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.10.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.19.tgz",
|
||||
"integrity": "sha512-+PU57o6DtOSx0/algmxgCwWrmCiomwC/K+LPfXonT0tQMbNTjHEqVzwL9dFEhFoPmLFIiSWjRorLH6Z0hJMT+Q==",
|
||||
"dev": true
|
||||
},
|
||||
"encoding": {
|
||||
"version": "0.1.12",
|
||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
|
||||
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
|
||||
"requires": {
|
||||
"iconv-lite": "~0.4.13"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
|
||||
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
|
||||
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
|
||||
"requires": {
|
||||
"encoding": "^0.1.11",
|
||||
"is-stream": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"portable-fetch": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/portable-fetch/-/portable-fetch-3.0.0.tgz",
|
||||
"integrity": "sha1-PL9KptvFpXNLQcBBnJJzMTv9mtg=",
|
||||
"requires": {
|
||||
"node-fetch": "^1.0.1",
|
||||
"whatwg-fetch": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
|
||||
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
|
||||
"dev": true
|
||||
},
|
||||
"whatwg-fetch": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
|
||||
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^8.0.9",
|
||||
"typescript": "^2.0"
|
||||
"typescript": "^2.4"
|
||||
},
|
||||
"publishConfig":{
|
||||
"registry":"https://skimdb.npmjs.com/registry"
|
||||
|
@ -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) {
|
||||
@ -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);
|
||||
}
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
@ -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);
|
||||
}
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
{
|
||||
"name": "@swagger/typescript-fetch-petstore",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "8.10.19",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.19.tgz",
|
||||
"integrity": "sha512-+PU57o6DtOSx0/algmxgCwWrmCiomwC/K+LPfXonT0tQMbNTjHEqVzwL9dFEhFoPmLFIiSWjRorLH6Z0hJMT+Q==",
|
||||
"dev": true
|
||||
},
|
||||
"encoding": {
|
||||
"version": "0.1.12",
|
||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
|
||||
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
|
||||
"requires": {
|
||||
"iconv-lite": "~0.4.13"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
|
||||
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
|
||||
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
|
||||
"requires": {
|
||||
"encoding": "^0.1.11",
|
||||
"is-stream": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"portable-fetch": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/portable-fetch/-/portable-fetch-3.0.0.tgz",
|
||||
"integrity": "sha1-PL9KptvFpXNLQcBBnJJzMTv9mtg=",
|
||||
"requires": {
|
||||
"node-fetch": "^1.0.1",
|
||||
"whatwg-fetch": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "2.9.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
|
||||
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
|
||||
"dev": true
|
||||
},
|
||||
"whatwg-fetch": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
|
||||
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^8.0.9",
|
||||
"typescript": "^2.0"
|
||||
"typescript": "^2.4"
|
||||
},
|
||||
"publishConfig":{
|
||||
"registry":"https://skimdb.npmjs.com/registry"
|
||||
|
@ -1,47 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/isomorphic-fetch@0.0.34":
|
||||
version "0.0.34"
|
||||
resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.34.tgz#3c3483e606c041378438e951464f00e4e60706d6"
|
||||
|
||||
"@types/node@^8.0.9":
|
||||
version "8.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.17.tgz#677bc8c118cfb76013febb62ede1f31d2c7222a1"
|
||||
|
||||
encoding@^0.1.11:
|
||||
version "0.1.12"
|
||||
resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb"
|
||||
dependencies:
|
||||
iconv-lite "~0.4.13"
|
||||
|
||||
iconv-lite@~0.4.13:
|
||||
version "0.4.18"
|
||||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2"
|
||||
|
||||
is-stream@^1.0.1:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
|
||||
isomorphic-fetch@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9"
|
||||
dependencies:
|
||||
node-fetch "^1.0.1"
|
||||
whatwg-fetch ">=0.10.0"
|
||||
|
||||
node-fetch@^1.0.1:
|
||||
version "1.7.1"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.1.tgz#899cb3d0a3c92f952c47f1b876f4c8aeabd400d5"
|
||||
dependencies:
|
||||
encoding "^0.1.11"
|
||||
is-stream "^1.0.1"
|
||||
|
||||
typescript@^2.0:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844"
|
||||
|
||||
whatwg-fetch@>=0.10.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user