Skip to content

Commit f0f2147

Browse files
authored
Use JS ES6 as the default (#1825)
* set JS ES6 as the default * update doc
1 parent 651395d commit f0f2147

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+725
-630
lines changed

bin/javascript-es6-petstore.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ fi
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
3030
ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \
3131
-i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \
32-
-o samples/client/petstore/javascript-es6 \
33-
--additional-properties useES6=true $@"
32+
-o samples/client/petstore/javascript-es6 $@"
3433

3534
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags

docs/generators/c.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
CONFIG OPTIONS for c
3+
4+
sortParamsByRequiredFlag
5+
Sort method arguments to place required parameters before optional parameters. (Default: true)
6+
7+
ensureUniqueParams
8+
Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true)
9+
10+
allowUnicodeIdentifiers
11+
boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false)
12+
13+
prependFormOrBodyParameters
14+
Add form or body parameters to the beginning of the parameter list. (Default: false)
15+
16+
hideGenerationTimestamp
17+
Hides the generation timestamp when files are generated. (Default: true)
18+
19+
Back to the [generators list](README.md)

docs/generators/cpp-qt5-client.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
CONFIG OPTIONS for cpp-qt5-client
3+
4+
sortParamsByRequiredFlag
5+
Sort method arguments to place required parameters before optional parameters. (Default: true)
6+
7+
ensureUniqueParams
8+
Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true)
9+
10+
allowUnicodeIdentifiers
11+
boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false)
12+
13+
prependFormOrBodyParameters
14+
Add form or body parameters to the beginning of the parameter list. (Default: false)
15+
16+
cppNamespace
17+
C++ namespace (convention: name::space::for::api). (Default: OpenAPI)
18+
19+
cppNamespace
20+
C++ namespace (convention: name::space::for::api). (Default: OpenAPI)
21+
22+
optionalProjectFile
23+
Generate client.pri. (Default: true)
24+
25+
Back to the [generators list](README.md)

docs/generators/erlang-proper.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
CONFIG OPTIONS for erlang-proper
3+
4+
packageName
5+
Erlang application name (convention: lowercase). (Default: openapi)
6+
7+
packageName
8+
Erlang application version (Default: 1.0.0)
9+
10+
Back to the [generators list](README.md)

docs/generators/graphql-schema.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
CONFIG OPTIONS for graphql-schema
3+
4+
packageName
5+
GraphQL package name (convention: lowercase). (Default: openapi2graphql)
6+
7+
packageVersion
8+
GraphQL package version. (Default: 1.0.0)
9+
10+
hideGenerationTimestamp
11+
Hides the generation timestamp when files are generated. (Default: true)
12+
13+
Back to the [generators list](README.md)

docs/generators/graphql-server.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
CONFIG OPTIONS for graphql-server
3+
4+
packageName
5+
GraphQL express server package name (convention: lowercase). (Default: openapi3graphql-server)
6+
7+
packageVersion
8+
GraphQL express server package version. (Default: 1.0.0)
9+
10+
hideGenerationTimestamp
11+
Hides the generation timestamp when files are generated. (Default: true)
12+
13+
Back to the [generators list](README.md)

docs/generators/javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ CONFIG OPTIONS for javascript
5959
Hides the generation timestamp when files are generated. (Default: true)
6060

6161
useES6
62-
use JavaScript ES6 (ECMAScript 6) (beta). Default is ES5. (Default: false)
62+
use JavaScript ES6 (ECMAScript 6) (beta). Default is ES6. (Default: true)
6363

6464
modelPropertyNaming
6565
Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase)

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
103103
protected String modelDocPath = "docs/";
104104
protected String apiTestPath = "api/";
105105
protected String modelTestPath = "model/";
106-
protected boolean useES6 = false; // default is ES5
106+
protected boolean useES6 = true; // default is ES5
107107
private String modelPropertyNaming = "camelCase";
108108

109109
public JavascriptClientCodegen() {
@@ -207,8 +207,8 @@ public JavascriptClientCodegen() {
207207
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
208208
.defaultValue(Boolean.TRUE.toString()));
209209
cliOptions.add(new CliOption(USE_ES6,
210-
"use JavaScript ES6 (ECMAScript 6) (beta). Default is ES5.")
211-
.defaultValue(Boolean.FALSE.toString()));
210+
"use JavaScript ES6 (ECMAScript 6) (beta). Default is ES6.")
211+
.defaultValue(Boolean.TRUE.toString()));
212212
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
213213
}
214214

samples/client/petstore/javascript-es6/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ var OpenApiPetstore = require('open_api_petstore');
7272

7373

7474
var api = new OpenApiPetstore.AnotherFakeApi()
75-
var client = new OpenApiPetstore.Client(); // {Client} client model
75+
var body = new OpenApiPetstore.Client(); // {Client} client model
7676
var callback = function(error, data, response) {
7777
if (error) {
7878
console.error(error);
7979
} else {
8080
console.log('API called successfully. Returned data: ' + data);
8181
}
8282
};
83-
api.call123testSpecialTags(client, callback);
83+
api.call123testSpecialTags(body, callback);
8484

8585
```
8686

samples/client/petstore/javascript-es6/docs/AnotherFakeApi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Method | HTTP request | Description
99

1010
<a name="call123testSpecialTags"></a>
1111
# **call123testSpecialTags**
12-
> Client call123testSpecialTags(client)
12+
> Client call123testSpecialTags(body)
1313
1414
To test special tags
1515

@@ -20,8 +20,8 @@ To test special tags and operation ID starting with number
2020
import OpenApiPetstore from 'open_api_petstore';
2121

2222
let apiInstance = new OpenApiPetstore.AnotherFakeApi();
23-
let client = new OpenApiPetstore.Client(); // Client | client model
24-
apiInstance.call123testSpecialTags(client, (error, data, response) => {
23+
let body = new OpenApiPetstore.Client(); // Client | client model
24+
apiInstance.call123testSpecialTags(body, (error, data, response) => {
2525
if (error) {
2626
console.error(error);
2727
} else {
@@ -34,7 +34,7 @@ apiInstance.call123testSpecialTags(client, (error, data, response) => {
3434

3535
Name | Type | Description | Notes
3636
------------- | ------------- | ------------- | -------------
37-
**client** | [**Client**](Client.md)| client model |
37+
**body** | [**Client**](Client.md)| client model |
3838

3939
### Return type
4040

samples/client/petstore/javascript-es6/docs/FakeApi.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import OpenApiPetstore from 'open_api_petstore';
7676

7777
let apiInstance = new OpenApiPetstore.FakeApi();
7878
let opts = {
79-
'outerComposite': new OpenApiPetstore.OuterComposite() // OuterComposite | Input composite as post body
79+
'body': new OpenApiPetstore.OuterComposite() // OuterComposite | Input composite as post body
8080
};
8181
apiInstance.fakeOuterCompositeSerialize(opts, (error, data, response) => {
8282
if (error) {
@@ -91,7 +91,7 @@ apiInstance.fakeOuterCompositeSerialize(opts, (error, data, response) => {
9191

9292
Name | Type | Description | Notes
9393
------------- | ------------- | ------------- | -------------
94-
**outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
94+
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
9595

9696
### Return type
9797

@@ -196,7 +196,7 @@ No authorization required
196196

197197
<a name="testBodyWithFileSchema"></a>
198198
# **testBodyWithFileSchema**
199-
> testBodyWithFileSchema(fileSchemaTestClass)
199+
> testBodyWithFileSchema(body)
200200
201201

202202

@@ -207,8 +207,8 @@ For this test, the body for this request much reference a schema named &#x60;Fil
207207
import OpenApiPetstore from 'open_api_petstore';
208208

209209
let apiInstance = new OpenApiPetstore.FakeApi();
210-
let fileSchemaTestClass = new OpenApiPetstore.FileSchemaTestClass(); // FileSchemaTestClass |
211-
apiInstance.testBodyWithFileSchema(fileSchemaTestClass, (error, data, response) => {
210+
let body = new OpenApiPetstore.FileSchemaTestClass(); // FileSchemaTestClass |
211+
apiInstance.testBodyWithFileSchema(body, (error, data, response) => {
212212
if (error) {
213213
console.error(error);
214214
} else {
@@ -221,7 +221,7 @@ apiInstance.testBodyWithFileSchema(fileSchemaTestClass, (error, data, response)
221221

222222
Name | Type | Description | Notes
223223
------------- | ------------- | ------------- | -------------
224-
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
224+
**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
225225

226226
### Return type
227227

@@ -238,7 +238,7 @@ No authorization required
238238

239239
<a name="testBodyWithQueryParams"></a>
240240
# **testBodyWithQueryParams**
241-
> testBodyWithQueryParams(query, user)
241+
> testBodyWithQueryParams(query, body)
242242
243243

244244

@@ -248,8 +248,8 @@ import OpenApiPetstore from 'open_api_petstore';
248248

249249
let apiInstance = new OpenApiPetstore.FakeApi();
250250
let query = "query_example"; // String |
251-
let user = new OpenApiPetstore.User(); // User |
252-
apiInstance.testBodyWithQueryParams(query, user, (error, data, response) => {
251+
let body = new OpenApiPetstore.User(); // User |
252+
apiInstance.testBodyWithQueryParams(query, body, (error, data, response) => {
253253
if (error) {
254254
console.error(error);
255255
} else {
@@ -263,7 +263,7 @@ apiInstance.testBodyWithQueryParams(query, user, (error, data, response) => {
263263
Name | Type | Description | Notes
264264
------------- | ------------- | ------------- | -------------
265265
**query** | **String**| |
266-
**user** | [**User**](User.md)| |
266+
**body** | [**User**](User.md)| |
267267

268268
### Return type
269269

@@ -280,7 +280,7 @@ No authorization required
280280

281281
<a name="testClientModel"></a>
282282
# **testClientModel**
283-
> Client testClientModel(client)
283+
> Client testClientModel(body)
284284
285285
To test \&quot;client\&quot; model
286286

@@ -291,8 +291,8 @@ To test \&quot;client\&quot; model
291291
import OpenApiPetstore from 'open_api_petstore';
292292

293293
let apiInstance = new OpenApiPetstore.FakeApi();
294-
let client = new OpenApiPetstore.Client(); // Client | client model
295-
apiInstance.testClientModel(client, (error, data, response) => {
294+
let body = new OpenApiPetstore.Client(); // Client | client model
295+
apiInstance.testClientModel(body, (error, data, response) => {
296296
if (error) {
297297
console.error(error);
298298
} else {
@@ -305,7 +305,7 @@ apiInstance.testClientModel(client, (error, data, response) => {
305305

306306
Name | Type | Description | Notes
307307
------------- | ------------- | ------------- | -------------
308-
**client** | [**Client**](Client.md)| client model |
308+
**body** | [**Client**](Client.md)| client model |
309309

310310
### Return type
311311

@@ -510,7 +510,7 @@ No authorization required
510510

511511
<a name="testInlineAdditionalProperties"></a>
512512
# **testInlineAdditionalProperties**
513-
> testInlineAdditionalProperties(requestBody)
513+
> testInlineAdditionalProperties(param)
514514
515515
test inline additionalProperties
516516

@@ -519,8 +519,8 @@ test inline additionalProperties
519519
import OpenApiPetstore from 'open_api_petstore';
520520

521521
let apiInstance = new OpenApiPetstore.FakeApi();
522-
let requestBody = {key: "null"}; // {String: String} | request body
523-
apiInstance.testInlineAdditionalProperties(requestBody, (error, data, response) => {
522+
let param = {key: "null"}; // {String: String} | request body
523+
apiInstance.testInlineAdditionalProperties(param, (error, data, response) => {
524524
if (error) {
525525
console.error(error);
526526
} else {
@@ -533,7 +533,7 @@ apiInstance.testInlineAdditionalProperties(requestBody, (error, data, response)
533533

534534
Name | Type | Description | Notes
535535
------------- | ------------- | ------------- | -------------
536-
**requestBody** | [**{String: String}**](String.md)| request body |
536+
**param** | [**{String: String}**](String.md)| request body |
537537

538538
### Return type
539539

samples/client/petstore/javascript-es6/docs/FakeClassnameTags123Api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Method | HTTP request | Description
99

1010
<a name="testClassname"></a>
1111
# **testClassname**
12-
> Client testClassname(client)
12+
> Client testClassname(body)
1313
1414
To test class name in snake case
1515

@@ -27,8 +27,8 @@ api_key_query.apiKey = 'YOUR API KEY';
2727
//api_key_query.apiKeyPrefix = 'Token';
2828

2929
let apiInstance = new OpenApiPetstore.FakeClassnameTags123Api();
30-
let client = new OpenApiPetstore.Client(); // Client | client model
31-
apiInstance.testClassname(client, (error, data, response) => {
30+
let body = new OpenApiPetstore.Client(); // Client | client model
31+
apiInstance.testClassname(body, (error, data, response) => {
3232
if (error) {
3333
console.error(error);
3434
} else {
@@ -41,7 +41,7 @@ apiInstance.testClassname(client, (error, data, response) => {
4141

4242
Name | Type | Description | Notes
4343
------------- | ------------- | ------------- | -------------
44-
**client** | [**Client**](Client.md)| client model |
44+
**body** | [**Client**](Client.md)| client model |
4545

4646
### Return type
4747

samples/client/petstore/javascript-es6/docs/MapTest.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Name | Type | Description | Notes
1313
## Enum: {String: String}
1414

1515

16+
* `UPPER` (value: `"UPPER"`)
17+
18+
* `lower` (value: `"lower"`)
19+
1620

1721

1822

0 commit comments

Comments
 (0)