typescript-node: clean up require and import (#6947)

* Fix for issue 4656 typescript-node generate invalid require statement instead of import statement

* Fixed broken link under testing templates

* Result of run generate-samples.sh / typescript-node*

* import stmt depending on flag supportsES6

* Update petstore sample for typescript-node

* import ... from stmt for http/request module

* update samples

* update doc

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
Daniel Ludwig 2020-07-31 11:58:43 +02:00 committed by GitHub
parent 0f3edb13f5
commit b838e1885f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 30 additions and 21 deletions

View File

@ -87,8 +87,7 @@ To add test cases (optional) covering the change in the code generator, please r
To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/tree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.

View File

@ -91,8 +91,7 @@ To add test cases (optional) covering the change in the code generator, please r
To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/tree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.

View File

@ -1,6 +1,7 @@
{{>licenseInfo}}
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
{{#imports}}

View File

@ -4,7 +4,7 @@ export * from '{{{ classFilename }}}';
{{/model}}
{{/models}}
import localVarRequest = require('request');
import localVarRequest from 'request';
{{#models}}
{{#model}}

View File

@ -4,6 +4,8 @@
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"strict": true,
"moduleResolution": "node",
"removeComments": true,

View File

@ -10,8 +10,9 @@
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { ApiResponse } from '../model/apiResponse';

View File

@ -10,8 +10,9 @@
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { Order } from '../model/order';

View File

@ -10,8 +10,9 @@
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { User } from '../model/user';

View File

@ -5,7 +5,7 @@ export * from './pet';
export * from './tag';
export * from './user';
import localVarRequest = require('request');
import localVarRequest from 'request';
import { ApiResponse } from './apiResponse';
import { Category } from './category';

View File

@ -10,8 +10,9 @@
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { ApiResponse } from '../model/apiResponse';

View File

@ -10,8 +10,9 @@
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { Order } from '../model/order';

View File

@ -10,8 +10,9 @@
* Do not edit the class manually.
*/
import localVarRequest = require('request');
import http = require('http');
import localVarRequest from 'request';
import http from 'http';
/* tslint:disable:no-unused-locals */
import { User } from '../model/user';

View File

@ -5,7 +5,7 @@ export * from './pet';
export * from './tag';
export * from './user';
import localVarRequest = require('request');
import localVarRequest from 'request';
import { ApiResponse } from './apiResponse';
import { Category } from './category';

View File

@ -4,6 +4,8 @@
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "ES5",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"strict": true,
"moduleResolution": "node",
"removeComments": true,