forked from loafle/openapi-generator-original
[JS] fix template directory for ES5 (#6253)
* fix #5845 (template dir) * fix js petstore test case
This commit is contained in:
@@ -217,6 +217,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
|
if (additionalProperties.containsKey(USE_ES6)) {
|
||||||
|
setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6));
|
||||||
|
} else {
|
||||||
|
setUseES6(true); // default to ES6
|
||||||
|
}
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
|
|
||||||
// default HIDE_GENERATION_TIMESTAMP to true
|
// default HIDE_GENERATION_TIMESTAMP to true
|
||||||
@@ -266,11 +271,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
if (additionalProperties.containsKey(EMIT_JS_DOC)) {
|
if (additionalProperties.containsKey(EMIT_JS_DOC)) {
|
||||||
setEmitJSDoc(convertPropertyToBooleanAndWriteBack(EMIT_JS_DOC));
|
setEmitJSDoc(convertPropertyToBooleanAndWriteBack(EMIT_JS_DOC));
|
||||||
}
|
}
|
||||||
if (additionalProperties.containsKey(USE_ES6)) {
|
|
||||||
setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6));
|
|
||||||
} else {
|
|
||||||
setUseES6(true); // default to ES6
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -173,6 +173,12 @@ Class | Method | HTTP request | Description
|
|||||||
- **API key parameter name**: api_key
|
- **API key parameter name**: api_key
|
||||||
- **Location**: HTTP header
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
### http_basic_test
|
### http_basic_test
|
||||||
|
|
||||||
- **Type**: HTTP basic authentication
|
- **Type**: HTTP basic authentication
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ To test class name in snake case
|
|||||||
### Example
|
### Example
|
||||||
```javascript
|
```javascript
|
||||||
import SwaggerPetstore from 'swagger_petstore';
|
import SwaggerPetstore from 'swagger_petstore';
|
||||||
|
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||||
|
|
||||||
|
// Configure API key authorization: api_key_query
|
||||||
|
let api_key_query = defaultClient.authentications['api_key_query'];
|
||||||
|
api_key_query.apiKey = 'YOUR API KEY';
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//api_key_query.apiKeyPrefix = 'Token';
|
||||||
|
|
||||||
let apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
let apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
||||||
|
|
||||||
@@ -43,7 +50,7 @@ Name | Type | Description | Notes
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key_query](../README.md#api_key_query)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export default class ApiClient {
|
|||||||
*/
|
*/
|
||||||
this.authentications = {
|
this.authentications = {
|
||||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||||
|
'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'},
|
||||||
'http_basic_test': {type: 'basic'},
|
'http_basic_test': {type: 'basic'},
|
||||||
'petstore_auth': {type: 'oauth2'}
|
'petstore_auth': {type: 'oauth2'}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default class Fake_classname_tags123Api {
|
|||||||
let formParams = {
|
let formParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
let authNames = [];
|
let authNames = ['api_key_query'];
|
||||||
let contentTypes = ['application/json'];
|
let contentTypes = ['application/json'];
|
||||||
let accepts = ['application/json'];
|
let accepts = ['application/json'];
|
||||||
let returnType = Client;
|
let returnType = Client;
|
||||||
|
|||||||
@@ -170,6 +170,12 @@ Class | Method | HTTP request | Description
|
|||||||
- **API key parameter name**: api_key
|
- **API key parameter name**: api_key
|
||||||
- **Location**: HTTP header
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
### http_basic_test
|
### http_basic_test
|
||||||
|
|
||||||
- **Type**: HTTP basic authentication
|
- **Type**: HTTP basic authentication
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ To test class name in snake case
|
|||||||
### Example
|
### Example
|
||||||
```javascript
|
```javascript
|
||||||
import SwaggerPetstore from 'swagger_petstore';
|
import SwaggerPetstore from 'swagger_petstore';
|
||||||
|
let defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||||
|
|
||||||
|
// Configure API key authorization: api_key_query
|
||||||
|
let api_key_query = defaultClient.authentications['api_key_query'];
|
||||||
|
api_key_query.apiKey = 'YOUR API KEY';
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//api_key_query.apiKeyPrefix = 'Token';
|
||||||
|
|
||||||
let apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
let apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
||||||
|
|
||||||
@@ -41,7 +48,7 @@ Name | Type | Description | Notes
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key_query](../README.md#api_key_query)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export default class ApiClient {
|
|||||||
*/
|
*/
|
||||||
this.authentications = {
|
this.authentications = {
|
||||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||||
|
'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'},
|
||||||
'http_basic_test': {type: 'basic'},
|
'http_basic_test': {type: 'basic'},
|
||||||
'petstore_auth': {type: 'oauth2'}
|
'petstore_auth': {type: 'oauth2'}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export default class Fake_classname_tags123Api {
|
|||||||
let formParams = {
|
let formParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
let authNames = [];
|
let authNames = ['api_key_query'];
|
||||||
let contentTypes = ['application/json'];
|
let contentTypes = ['application/json'];
|
||||||
let accepts = ['application/json'];
|
let accepts = ['application/json'];
|
||||||
let returnType = Client;
|
let returnType = Client;
|
||||||
|
|||||||
@@ -195,6 +195,12 @@ Class | Method | HTTP request | Description
|
|||||||
- **API key parameter name**: api_key
|
- **API key parameter name**: api_key
|
||||||
- **Location**: HTTP header
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
### http_basic_test
|
### http_basic_test
|
||||||
|
|
||||||
- **Type**: HTTP basic authentication
|
- **Type**: HTTP basic authentication
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ To test class name in snake case
|
|||||||
### Example
|
### Example
|
||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger_petstore');
|
var SwaggerPetstore = require('swagger_petstore');
|
||||||
|
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||||
|
|
||||||
|
// Configure API key authorization: api_key_query
|
||||||
|
var api_key_query = defaultClient.authentications['api_key_query'];
|
||||||
|
api_key_query.apiKey = 'YOUR API KEY';
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//api_key_query.apiKeyPrefix = 'Token';
|
||||||
|
|
||||||
var apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
var apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
||||||
|
|
||||||
@@ -41,7 +48,7 @@ Name | Type | Description | Notes
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key_query](../README.md#api_key_query)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
*/
|
*/
|
||||||
this.authentications = {
|
this.authentications = {
|
||||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||||
|
'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'},
|
||||||
'http_basic_test': {type: 'basic'},
|
'http_basic_test': {type: 'basic'},
|
||||||
'petstore_auth': {type: 'oauth2'}
|
'petstore_auth': {type: 'oauth2'}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
var formParams = {
|
var formParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var authNames = [];
|
var authNames = ['api_key_query'];
|
||||||
var contentTypes = ['application/json'];
|
var contentTypes = ['application/json'];
|
||||||
var accepts = ['application/json'];
|
var accepts = ['application/json'];
|
||||||
var returnType = Client;
|
var returnType = Client;
|
||||||
|
|||||||
@@ -198,6 +198,12 @@ Class | Method | HTTP request | Description
|
|||||||
- **API key parameter name**: api_key
|
- **API key parameter name**: api_key
|
||||||
- **Location**: HTTP header
|
- **Location**: HTTP header
|
||||||
|
|
||||||
|
### api_key_query
|
||||||
|
|
||||||
|
- **Type**: API key
|
||||||
|
- **API key parameter name**: api_key_query
|
||||||
|
- **Location**: URL query string
|
||||||
|
|
||||||
### http_basic_test
|
### http_basic_test
|
||||||
|
|
||||||
- **Type**: HTTP basic authentication
|
- **Type**: HTTP basic authentication
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ To test class name in snake case
|
|||||||
### Example
|
### Example
|
||||||
```javascript
|
```javascript
|
||||||
var SwaggerPetstore = require('swagger_petstore');
|
var SwaggerPetstore = require('swagger_petstore');
|
||||||
|
var defaultClient = SwaggerPetstore.ApiClient.instance;
|
||||||
|
|
||||||
|
// Configure API key authorization: api_key_query
|
||||||
|
var api_key_query = defaultClient.authentications['api_key_query'];
|
||||||
|
api_key_query.apiKey = 'YOUR API KEY';
|
||||||
|
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||||
|
//api_key_query.apiKeyPrefix = 'Token';
|
||||||
|
|
||||||
var apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
var apiInstance = new SwaggerPetstore.Fake_classname_tags123Api();
|
||||||
|
|
||||||
@@ -44,7 +51,7 @@ Name | Type | Description | Notes
|
|||||||
|
|
||||||
### Authorization
|
### Authorization
|
||||||
|
|
||||||
No authorization required
|
[api_key_query](../README.md#api_key_query)
|
||||||
|
|
||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
*/
|
*/
|
||||||
this.authentications = {
|
this.authentications = {
|
||||||
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||||
|
'api_key_query': {type: 'apiKey', 'in': 'query', name: 'api_key_query'},
|
||||||
'http_basic_test': {type: 'basic'},
|
'http_basic_test': {type: 'basic'},
|
||||||
'petstore_auth': {type: 'oauth2'}
|
'petstore_auth': {type: 'oauth2'}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
var formParams = {
|
var formParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var authNames = [];
|
var authNames = ['api_key_query'];
|
||||||
var contentTypes = ['application/json'];
|
var contentTypes = ['application/json'];
|
||||||
var accepts = ['application/json'];
|
var accepts = ['application/json'];
|
||||||
var returnType = Client;
|
var returnType = Client;
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ describe('ApiClient', function() {
|
|||||||
expect(apiClient.authentications).to.eql({
|
expect(apiClient.authentications).to.eql({
|
||||||
petstore_auth: {type: 'oauth2'},
|
petstore_auth: {type: 'oauth2'},
|
||||||
http_basic_test: {type: 'basic'},
|
http_basic_test: {type: 'basic'},
|
||||||
api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'}
|
api_key: {type: 'apiKey', 'in': 'header', name: 'api_key'},
|
||||||
|
api_key_query: {type: 'apiKey', 'in': 'query', name: 'api_key_query'},
|
||||||
/* commented out the following as these fake security def (testing purpose)
|
/* commented out the following as these fake security def (testing purpose)
|
||||||
* has been removed from the spec, we'll add it back after updating the
|
* has been removed from the spec, we'll add it back after updating the
|
||||||
* petstore server
|
* petstore server
|
||||||
|
|||||||
Reference in New Issue
Block a user