From f3f5fef2790813832b5ae6efb61faab5aeb588d0 Mon Sep 17 00:00:00 2001 From: Bodo Graumann Date: Sat, 18 Jan 2020 12:31:27 +0100 Subject: [PATCH] Typescript refactor: Platform select for browser and node (#4500) * Use string form of filename parameter This works for the form-data library and is also compatible with the browser FormData object. * Add new option to select platform node or browser When no platform is selected, a default is chosen by the framework option and likewise the file data type option is implied by the platform. * Remove redundant import of node dns module * Only use form-data library for node platform * Generate npm package from npmName option * Use method convertPropertyToBooleanAndWriteBack * Generate typescript samples with ensure-up-to-date --- bin/typescript.sh | 4 +- bin/utils/ensure-up-to-date | 1 + docs/generators/typescript.md | 1 + .../languages/TypeScriptClientCodegen.java | 69 ++++++++++++------- .../resources/typescript/api/api.mustache | 6 +- .../resources/typescript/http/http.mustache | 4 ++ .../resources/typescript/http/jquery.mustache | 5 +- .../resources/typescript/package.mustache | 15 ++-- .../builds/default/.openapi-generator/VERSION | 2 +- .../typescript/builds/default/apis/PetApi.ts | 2 +- .../typescript/builds/default/package.json | 11 ++- .../builds/jquery/.openapi-generator/VERSION | 2 +- .../typescript/builds/jquery/apis/PetApi.ts | 3 +- .../typescript/builds/jquery/apis/StoreApi.ts | 1 - .../typescript/builds/jquery/apis/UserApi.ts | 1 - .../typescript/builds/jquery/http/http.ts | 2 - .../typescript/builds/jquery/http/jquery.ts | 2 - .../builds/jquery/package-lock.json | 46 ------------- .../typescript/builds/jquery/package.json | 9 +-- .../typescript/tests/jquery/package-lock.json | 2 - .../tests/jquery/test/http/jquery.test.ts | 2 - 21 files changed, 82 insertions(+), 108 deletions(-) diff --git a/bin/typescript.sh b/bin/typescript.sh index 8a0de14cc0a..a94b40df114 100755 --- a/bin/typescript.sh +++ b/bin/typescript.sh @@ -28,10 +28,10 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" echo "Creating default (fetch) client!" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript -o samples/client/petstore/typescript/builds/default $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript -o samples/client/petstore/typescript/builds/default --additional-properties=platform=node,npmName=ts-petstore-client $@" java $JAVA_OPTS -jar $executable $ags echo "Creating jquery client!" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript -o samples/client/petstore/typescript/builds/jquery --additional-properties=framework=jquery,fileContentDataType=Blob $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript -o samples/client/petstore/typescript/builds/jquery --additional-properties=framework=jquery,npmName=ts-petstore-client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index f97dd12b8fe..e699ecff453 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -73,6 +73,7 @@ declare -a scripts=( "./bin/java-play-framework-petstore-server-all.sh" "./bin/elm-petstore-all.sh" "./bin/meta-codegen.sh" +"./bin/typescript.sh" # OTHERS "./bin/utils/export_docs_generators.sh" "./bin/utils/copy-to-website.sh" diff --git a/docs/generators/typescript.md b/docs/generators/typescript.md index 11ebf4ce291..c1599ef5021 100644 --- a/docs/generators/typescript.md +++ b/docs/generators/typescript.md @@ -13,4 +13,5 @@ sidebar_label: typescript |supportsES6|Generate code that conforms to ES6.| |false| |fileContentDataType|Specifies the type to use for the content of a file - i.e. Blob (Browser) / Buffer (node)| |Buffer| |useRxJS|Enable this to internally use rxjs observables. If disabled, a stub is used instead. This is required for the 'angular' framework.| |false| +|platform|Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise.| |null| |framework|Specify the framework which should be used in the client code.|
**fetch-api**
fetch-api
**jquery**
jquery
|fetch-api| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index b65346fbcbd..40e7103019a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -46,6 +46,9 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo private static final String FRAMEWORK_SWITCH = "framework"; private static final String FRAMEWORK_SWITCH_DESC = "Specify the framework which should be used in the client code."; private static final String[] FRAMEWORKS = { "fetch-api", "jquery" }; + private static final String PLATFORM_SWITCH = "platform"; + private static final String PLATFORM_SWITCH_DESC = "Specifies the platform the code should run on. The default is 'node' for the 'request' framework and 'browser' otherwise."; + private static final String[] PLATFORMS = { "browser", "node" }; private static final String FILE_CONTENT_DATA_TYPE= "fileContentDataType"; private static final String FILE_CONTENT_DATA_TYPE_DESC = "Specifies the type to use for the content of a file - i.e. Blob (Browser) / Buffer (node)"; private static final String USE_RXJS_SWITCH = "useRxJS"; @@ -142,6 +145,14 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo } frameworkOption.defaultValue(FRAMEWORKS[0]); + cliOptions.add(new CliOption(TypeScriptClientCodegen.PLATFORM_SWITCH, TypeScriptClientCodegen.PLATFORM_SWITCH_DESC)); + CliOption platformOption = new CliOption(TypeScriptClientCodegen.PLATFORM_SWITCH, TypeScriptClientCodegen.PLATFORM_SWITCH_DESC); + for (String option: TypeScriptClientCodegen.PLATFORMS) { + // TODO: improve description? + platformOption.addEnum(option, option); + } + platformOption.defaultValue(PLATFORMS[0]); + cliOptions.add(frameworkOption); @@ -191,16 +202,17 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo @Override public Map postProcessSupportingFileData(Map objs) { + final Object propFramework = additionalProperties.get(FRAMEWORK_SWITCH); + Map frameworks = new HashMap<>(); for (String framework: FRAMEWORKS) { - frameworks.put(framework, framework.equals(additionalProperties.get(FRAMEWORK_SWITCH))); + frameworks.put(framework, framework.equals(propFramework)); } - objs.put("framework", additionalProperties.get(FRAMEWORK_SWITCH)); + objs.put("framework", propFramework); objs.put("frameworks", frameworks); - - Object propDataType = additionalProperties.get(FILE_CONTENT_DATA_TYPE); - objs.put("fileContentDataType", propDataType == null ? "Buffer" : propDataType); - + + objs.put("fileContentDataType", additionalProperties.get(FILE_CONTENT_DATA_TYPE)); + return objs; } @@ -695,33 +707,40 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING)); } - if (additionalProperties.containsKey(CodegenConstants.SUPPORTS_ES6)) { - // convert to boolean - additionalProperties.put(CodegenConstants.SUPPORTS_ES6, - Boolean.valueOf(additionalProperties.get(CodegenConstants.SUPPORTS_ES6).toString()) - ); - } + convertPropertyToBooleanAndWriteBack(CodegenConstants.SUPPORTS_ES6); // change package names apiPackage = this.apiPackage + ".apis"; modelPackage = this.modelPackage + ".models"; testPackage = this.testPackage + ".tests"; - if (additionalProperties.containsKey(FRAMEWORK_SWITCH)) { - supportingFiles.add(new SupportingFile("generators/" + additionalProperties.get(FRAMEWORK_SWITCH) + ".mustache", "index.ts")); - } else { - additionalProperties.put(FRAMEWORK_SWITCH, FRAMEWORKS[0]); - supportingFiles.add(new SupportingFile("generators" + File.separator + FRAMEWORKS[0] + ".mustache", "index.ts")); - } - String httpLibName = this.getHttpLibForFramework(additionalProperties.get(FRAMEWORK_SWITCH).toString()); - supportingFiles.add(new SupportingFile("http" + File.separator + httpLibName + ".mustache", "http", httpLibName + ".ts")); + additionalProperties.putIfAbsent(FRAMEWORK_SWITCH, FRAMEWORKS[0]); + supportingFiles.add(new SupportingFile( + "generators" + File.separator + additionalProperties.get(FRAMEWORK_SWITCH) + ".mustache", + "index.ts" + )); - boolean useRxJS = false; - if (additionalProperties.containsKey(USE_RXJS_SWITCH)) { - // convert to boolean - useRxJS = Boolean.valueOf(additionalProperties.get(USE_RXJS_SWITCH).toString()); - additionalProperties.put(USE_RXJS_SWITCH, useRxJS); + String httpLibName = this.getHttpLibForFramework(additionalProperties.get(FRAMEWORK_SWITCH).toString()); + supportingFiles.add(new SupportingFile( + "http" + File.separator + httpLibName + ".mustache", + "http", httpLibName + ".ts" + )); + + Object propPlatform = additionalProperties.get(PLATFORM_SWITCH); + if (propPlatform == null) { + propPlatform = "browser"; + additionalProperties.put("platform", propPlatform); } + + Map platforms = new HashMap<>(); + for (String platform: PLATFORMS) { + platforms.put(platform, platform.equals(propPlatform)); + } + additionalProperties.put("platforms", platforms); + + additionalProperties.putIfAbsent(FILE_CONTENT_DATA_TYPE, propPlatform.equals("node") ? "Buffer" : "Blob"); + + final boolean useRxJS = convertPropertyToBooleanAndWriteBack(USE_RXJS_SWITCH); if (!useRxJS) { supportingFiles.add(new SupportingFile("rxjsStub.mustache", "", "rxjsStub.ts")); } diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache index ed67714c201..4ac32d6839d 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -2,7 +2,11 @@ import { BaseAPIRequestFactory, RequiredError } from './baseapi'; import {Configuration} from '../configuration'; import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; +{{#platforms}} +{{#node}} import * as FormData from "form-data"; +{{/node}} +{{/platforms}} import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; @@ -88,7 +92,7 @@ export class {{classname}}RequestFactory extends BaseAPIRequestFactory { localVarFormParams.append('{{baseName}}', {{paramName}} as any); {{/isFile}} {{#isFile}} - localVarFormParams.append('{{baseName}}', {{paramName}}.data, { "filename": {{paramName}}.name }); + localVarFormParams.append('{{baseName}}', {{paramName}}.data, {{paramName}}.name); {{/isFile}} } {{/isListContainer}} diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index a4b6edc4445..9effd770471 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -1,5 +1,9 @@ +{{#platforms}} +{{#node}} // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; +{{/node}} +{{/platforms}} // typings of url-parse are incorrect... // @ts-ignore import * as URLParse from "url-parse"; diff --git a/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache b/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache index 4d641b17bb7..dd08009ff3a 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/jquery.mustache @@ -3,8 +3,11 @@ import * as e6p from 'es6-promise' import { from, Observable } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub'{{/useRxJS}}; e6p.polyfill(); import * as $ from 'jquery'; +{{#platforms}} +{{#node}} import * as FormData from "form-data"; -import { resolve } from 'dns'; +{{/node}} +{{/platforms}} export class JQueryHttpLibrary implements HttpLibrary { diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index 16087369be4..ec0e6303f98 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -1,5 +1,5 @@ { - "name": "ts-petstore-client", + "name": "{{npmName}}", "version": "1.0.0", "description": "OpenAPI client for {{npmName}}", "author": "OpenAPI-Generator Contributors", @@ -7,8 +7,7 @@ "fetch", "typescript", "openapi-client", - "openapi-generator", - "{{npmName}}" + "openapi-generator" ], "license": "Unlicense", "main": "./dist/index.js", @@ -18,8 +17,6 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "es6-promise": "^4.2.4", - "@types/node": "*", {{#frameworks}} {{#fetch-api}} "isomorphic-fetch": "^2.2.1", @@ -30,11 +27,17 @@ "jquery": "^3.4.1", {{/jquery}} {{/frameworks}} - "btoa": "^1.2.1", + {{#platforms}} + {{#node}} + "@types/node": "*", "form-data": "^2.5.0", + {{/node}} + {{/platforms}} {{#useRxJS}} "rxjs": "^6.4.0", {{/useRxJS}} + "btoa": "^1.2.1", + "es6-promise": "^4.2.4", "url-parse": "^1.4.3" }, "devDependencies": { diff --git a/samples/client/petstore/typescript/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript/builds/default/.openapi-generator/VERSION index 717311e32e3..c3a2c7076fa 100644 --- a/samples/client/petstore/typescript/builds/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript/builds/default/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +4.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript/builds/default/apis/PetApi.ts index 83904063a7d..7f9e16f207a 100644 --- a/samples/client/petstore/typescript/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript/builds/default/apis/PetApi.ts @@ -365,7 +365,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { } if (file !== undefined) { // TODO: replace .append with .set - localVarFormParams.append('file', file.data, { "filename": file.name }); + localVarFormParams.append('file', file.data, file.name); } requestContext.setBody(localVarFormParams); diff --git a/samples/client/petstore/typescript/builds/default/package.json b/samples/client/petstore/typescript/builds/default/package.json index d1a961e18a0..70b348648e1 100644 --- a/samples/client/petstore/typescript/builds/default/package.json +++ b/samples/client/petstore/typescript/builds/default/package.json @@ -1,14 +1,13 @@ { "name": "ts-petstore-client", "version": "1.0.0", - "description": "OpenAPI client for ", + "description": "OpenAPI client for ts-petstore-client", "author": "OpenAPI-Generator Contributors", "keywords": [ "fetch", "typescript", "openapi-client", - "openapi-generator", - "" + "openapi-generator" ], "license": "Unlicense", "main": "./dist/index.js", @@ -18,12 +17,12 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "es6-promise": "^4.2.4", - "@types/node": "*", "isomorphic-fetch": "^2.2.1", "@types/isomorphic-fetch": "0.0.34", - "btoa": "^1.2.1", + "@types/node": "*", "form-data": "^2.5.0", + "btoa": "^1.2.1", + "es6-promise": "^4.2.4", "url-parse": "^1.4.3" }, "devDependencies": { diff --git a/samples/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION b/samples/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION index 717311e32e3..c3a2c7076fa 100644 --- a/samples/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript/builds/jquery/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +4.2.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts b/samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts index 83904063a7d..31693b0eb4c 100644 --- a/samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts +++ b/samples/client/petstore/typescript/builds/jquery/apis/PetApi.ts @@ -2,7 +2,6 @@ import { BaseAPIRequestFactory, RequiredError } from './baseapi'; import {Configuration} from '../configuration'; import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; @@ -365,7 +364,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory { } if (file !== undefined) { // TODO: replace .append with .set - localVarFormParams.append('file', file.data, { "filename": file.name }); + localVarFormParams.append('file', file.data, file.name); } requestContext.setBody(localVarFormParams); diff --git a/samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts b/samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts index 55769fdc249..4a6a0385645 100644 --- a/samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts +++ b/samples/client/petstore/typescript/builds/jquery/apis/StoreApi.ts @@ -2,7 +2,6 @@ import { BaseAPIRequestFactory, RequiredError } from './baseapi'; import {Configuration} from '../configuration'; import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; diff --git a/samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts b/samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts index b3040726a8f..bff513b7807 100644 --- a/samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts +++ b/samples/client/petstore/typescript/builds/jquery/apis/UserApi.ts @@ -2,7 +2,6 @@ import { BaseAPIRequestFactory, RequiredError } from './baseapi'; import {Configuration} from '../configuration'; import { RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {isCodeInRange} from '../util'; diff --git a/samples/client/petstore/typescript/builds/jquery/http/http.ts b/samples/client/petstore/typescript/builds/jquery/http/http.ts index 0e5f142952d..14c71de90df 100644 --- a/samples/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/client/petstore/typescript/builds/jquery/http/http.ts @@ -1,5 +1,3 @@ -// TODO: evaluate if we can easily get rid of this library -import * as FormData from "form-data"; // typings of url-parse are incorrect... // @ts-ignore import * as URLParse from "url-parse"; diff --git a/samples/client/petstore/typescript/builds/jquery/http/jquery.ts b/samples/client/petstore/typescript/builds/jquery/http/jquery.ts index 3803cc7dbd5..30bd09f56ca 100644 --- a/samples/client/petstore/typescript/builds/jquery/http/jquery.ts +++ b/samples/client/petstore/typescript/builds/jquery/http/jquery.ts @@ -3,8 +3,6 @@ import * as e6p from 'es6-promise' import { from, Observable } from '../rxjsStub'; e6p.polyfill(); import * as $ from 'jquery'; -import * as FormData from "form-data"; -import { resolve } from 'dns'; export class JQueryHttpLibrary implements HttpLibrary { diff --git a/samples/client/petstore/typescript/builds/jquery/package-lock.json b/samples/client/petstore/typescript/builds/jquery/package-lock.json index d64ff033dae..cdbe4eeddc4 100644 --- a/samples/client/petstore/typescript/builds/jquery/package-lock.json +++ b/samples/client/petstore/typescript/builds/jquery/package-lock.json @@ -12,72 +12,26 @@ "@types/sizzle": "*" } }, - "@types/node": { - "version": "12.12.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz", - "integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==" - }, "@types/sizzle": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==" }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, "btoa": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==" }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "es6-promise": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.6.tgz", "integrity": "sha512-aRVgGdnmW2OiySVPUC9e6m+plolMAJKjZnQlCwNSuK5yQ0JN61DZSO1X1Ufd1foqWRAlig0rhduTCHe7sVtK5Q==" }, - "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, "jquery": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" }, - "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" - }, - "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "requires": { - "mime-db": "1.40.0" - } - }, "querystringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", diff --git a/samples/client/petstore/typescript/builds/jquery/package.json b/samples/client/petstore/typescript/builds/jquery/package.json index fdcb5251e3c..0fc169d4880 100644 --- a/samples/client/petstore/typescript/builds/jquery/package.json +++ b/samples/client/petstore/typescript/builds/jquery/package.json @@ -1,14 +1,13 @@ { "name": "ts-petstore-client", "version": "1.0.0", - "description": "OpenAPI client for ", + "description": "OpenAPI client for ts-petstore-client", "author": "OpenAPI-Generator Contributors", "keywords": [ "fetch", "typescript", "openapi-client", - "openapi-generator", - "" + "openapi-generator" ], "license": "Unlicense", "main": "./dist/index.js", @@ -18,12 +17,10 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "es6-promise": "^4.2.4", - "@types/node": "*", "@types/jquery": "^3.3.29", "jquery": "^3.4.1", "btoa": "^1.2.1", - "form-data": "^2.5.0", + "es6-promise": "^4.2.4", "url-parse": "^1.4.3" }, "devDependencies": { diff --git a/samples/client/petstore/typescript/tests/jquery/package-lock.json b/samples/client/petstore/typescript/tests/jquery/package-lock.json index 356c53ecec6..f1ff014ed63 100644 --- a/samples/client/petstore/typescript/tests/jquery/package-lock.json +++ b/samples/client/petstore/typescript/tests/jquery/package-lock.json @@ -4679,10 +4679,8 @@ "version": "file:../../builds/jquery", "requires": { "@types/jquery": "^3.3.29", - "@types/node": "*", "btoa": "^1.2.1", "es6-promise": "^4.2.4", - "form-data": "^2.5.0", "jquery": "^3.4.1", "url-parse": "^1.4.3" }, diff --git a/samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts b/samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts index 8f46bc90c70..1290d544cf0 100644 --- a/samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts +++ b/samples/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts @@ -2,8 +2,6 @@ declare var QUnit: any; import * as petstore from "ts-petstore-client"; -import * as FormData from "form-data"; - let libs: { [key: string]: petstore.http.HttpLibrary } = { "jquery": new petstore.http.JQueryHttpLibrary() }