From 2b84118c9f1872753741150390d9ec56c87a7803 Mon Sep 17 00:00:00 2001 From: Jeffrey Slort Date: Thu, 25 Jan 2018 14:20:58 +0100 Subject: [PATCH] removed isomorphic-fetch typing dependency (#6894) * removed isomorphic-fetch typing dependency removed postinstall command * space * regenerated samples * updated security samples * fixed missing url module * added prepublish hook * regenerated samples * added npm build to build --- README.md | 2 +- .../typescript-fetch/custom.d.mustache | 3 +- .../typescript-fetch/package.mustache | 3 +- .../typescript-fetch/.swagger-codegen/VERSION | 2 +- .../typescript-fetch/api.ts | 28 +++++++++---------- .../typescript-fetch/custom.d.ts | 3 +- .../typescript-fetch/git_push.sh | 2 +- .../builds/default/.swagger-codegen/VERSION | 2 +- .../builds/default/custom.d.ts | 3 +- .../es6-target/.swagger-codegen/VERSION | 2 +- .../builds/es6-target/custom.d.ts | 3 +- .../builds/es6-target/package.json | 3 +- .../with-npm-version/.swagger-codegen/VERSION | 2 +- .../builds/with-npm-version/custom.d.ts | 3 +- .../builds/with-npm-version/package.json | 3 +- .../builds/with-npm-version/pom.xml | 14 ++++++++++ 16 files changed, 47 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index b3d0e23e3b..0153206894 100644 --- a/README.md +++ b/README.md @@ -1099,7 +1099,7 @@ The Swagger Codegen project is intended as a benefit for users of the Swagger / * Generated code is intentionally _not_ subject to the parent project license When code is generated from this project, it shall be considered **AS IS** and owned by the user of the software. There are no warranties--expressed or implied--for generated code. You can do what you wish with it, and once generated, the code is your responsibility and subject to the licensing terms that you deem appropriate. - + License ------- diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/custom.d.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/custom.d.mustache index 02f969575e..9a5ceb3588 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-fetch/custom.d.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/custom.d.mustache @@ -1 +1,2 @@ -declare module 'portable-fetch'; \ No newline at end of file +declare module 'portable-fetch'; +declare module 'url'; \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache b/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache index 13ce093776..1eae586cf4 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache @@ -14,13 +14,12 @@ "typings": "./dist/index.d.ts", "scripts" : { "build": "tsc --outDir dist/", - "postinstall": "npm run build" + "prepublishOnly": "npm run build" }, "dependencies": { "portable-fetch": "^3.0.0" }, "devDependencies": { - "@types/isomorphic-fetch": "0.0.34", "@types/node": "^8.0.9", "typescript": "^2.0" }{{#npmRepository}},{{/npmRepository}} diff --git a/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION b/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION index f9f7450d13..855ff9501e 100644 --- a/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION +++ b/samples/client/petstore-security-test/typescript-fetch/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-fetch/api.ts b/samples/client/petstore-security-test/typescript-fetch/api.ts index 866ba88d58..027bc94391 100644 --- a/samples/client/petstore-security-test/typescript-fetch/api.ts +++ b/samples/client/petstore-security-test/typescript-fetch/api.ts @@ -89,7 +89,7 @@ export interface ModelReturn { * @type {number} * @memberof ModelReturn */ - return?: number; + _return?: number; } @@ -102,11 +102,11 @@ export const FakeApiFetchParamCreator = function (configuration?: Configuration) /** * * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [testCodeInjectEndRnNR] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options: any = {}): FetchArgs { + testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, options: any = {}): FetchArgs { const localVarPath = `/fake`; const localVarUrlObj = url.parse(localVarPath, true); const localVarRequestOptions = Object.assign({ method: 'PUT' }, options); @@ -114,8 +114,8 @@ export const FakeApiFetchParamCreator = function (configuration?: Configuration) const localVarQueryParameter = {} as any; const localVarFormParams = new url.URLSearchParams(); - if (test code inject * ' " =end rn n r !== undefined) { - localVarFormParams.set('test code inject */ ' " =end -- \r\n \n \r', test code inject * ' " =end rn n r as any); + if (testCodeInjectEndRnNR !== undefined) { + localVarFormParams.set('test code inject */ ' " =end -- \r\n \n \r', testCodeInjectEndRnNR as any); } localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; @@ -143,12 +143,12 @@ export const FakeApiFp = function(configuration?: Configuration) { /** * * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [testCodeInjectEndRnNR] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = FakeApiFetchParamCreator(configuration).testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options); + testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = FakeApiFetchParamCreator(configuration).testCodeInjectEndRnNR(testCodeInjectEndRnNR, options); return (fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH) => { return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) { @@ -171,12 +171,12 @@ export const FakeApiFactory = function (configuration?: Configuration, fetch?: F /** * * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param {string} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {string} [testCodeInjectEndRnNR] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param {*} [options] Override http request option. * @throws {RequiredError} */ - testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any) { - return FakeApiFp(configuration).testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options)(fetch, basePath); + testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, options?: any) { + return FakeApiFp(configuration).testCodeInjectEndRnNR(testCodeInjectEndRnNR, options)(fetch, basePath); }, }; }; @@ -191,13 +191,13 @@ export class FakeApi extends BaseAPI { /** * * @summary To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * @param {} [test code inject * ' " =end rn n r] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * @param {} [testCodeInjectEndRnNR] To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FakeApi */ - public testCodeInjectEndRnNR(test code inject * ' " =end rn n r?: string, options?: any) { - return FakeApiFp(this.configuration).testCodeInjectEndRnNR(test code inject * ' " =end rn n r, options)(this.fetch, this.basePath); + public testCodeInjectEndRnNR(testCodeInjectEndRnNR?: string, options?: any) { + return FakeApiFp(this.configuration).testCodeInjectEndRnNR(testCodeInjectEndRnNR, options)(this.fetch, this.basePath); } } diff --git a/samples/client/petstore-security-test/typescript-fetch/custom.d.ts b/samples/client/petstore-security-test/typescript-fetch/custom.d.ts index 02f969575e..9a5ceb3588 100644 --- a/samples/client/petstore-security-test/typescript-fetch/custom.d.ts +++ b/samples/client/petstore-security-test/typescript-fetch/custom.d.ts @@ -1 +1,2 @@ -declare module 'portable-fetch'; \ No newline at end of file +declare module 'portable-fetch'; +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore-security-test/typescript-fetch/git_push.sh b/samples/client/petstore-security-test/typescript-fetch/git_push.sh index 1eb5727f6c..a1ff4c9bcb 100644 --- a/samples/client/petstore-security-test/typescript-fetch/git_push.sh +++ b/samples/client/petstore-security-test/typescript-fetch/git_push.sh @@ -36,7 +36,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION index a6254504e4..855ff9501e 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-fetch/builds/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1 \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/default/custom.d.ts b/samples/client/petstore/typescript-fetch/builds/default/custom.d.ts index 02f969575e..9a5ceb3588 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/custom.d.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/custom.d.ts @@ -1 +1,2 @@ -declare module 'portable-fetch'; \ No newline at end of file +declare module 'portable-fetch'; +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION index a6254504e4..855ff9501e 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1 \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/custom.d.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/custom.d.ts index 02f969575e..9a5ceb3588 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/custom.d.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/custom.d.ts @@ -1 +1,2 @@ -declare module 'portable-fetch'; \ No newline at end of file +declare module 'portable-fetch'; +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/package.json b/samples/client/petstore/typescript-fetch/builds/es6-target/package.json index 5fd44fc4e7..9e1c7628b3 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/package.json +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/package.json @@ -14,13 +14,12 @@ "typings": "./dist/index.d.ts", "scripts" : { "build": "tsc --outDir dist/", - "postinstall": "npm run build" + "prepublishOnly": "npm run build" }, "dependencies": { "portable-fetch": "^3.0.0" }, "devDependencies": { - "@types/isomorphic-fetch": "0.0.34", "@types/node": "^8.0.9", "typescript": "^2.0" }, diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION index a6254504e4..855ff9501e 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.1 \ No newline at end of file +2.4.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/custom.d.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/custom.d.ts index 02f969575e..9a5ceb3588 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/custom.d.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/custom.d.ts @@ -1 +1,2 @@ -declare module 'portable-fetch'; \ No newline at end of file +declare module 'portable-fetch'; +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json index 5fd44fc4e7..9e1c7628b3 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json @@ -14,13 +14,12 @@ "typings": "./dist/index.d.ts", "scripts" : { "build": "tsc --outDir dist/", - "postinstall": "npm run build" + "prepublishOnly": "npm run build" }, "dependencies": { "portable-fetch": "^3.0.0" }, "devDependencies": { - "@types/isomorphic-fetch": "0.0.34", "@types/node": "^8.0.9", "typescript": "^2.0" }, diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml b/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml index 210ee3c10a..b7725ec230 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/pom.xml @@ -39,6 +39,20 @@ + + npm-build + integration-test + + exec + + + npm + + run + build + + + npm-test integration-test