diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java index dc5835dfdd2..729f78e3017 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavascriptClientCodegen.java @@ -217,6 +217,11 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo @Override public void processOpts() { + if (additionalProperties.containsKey(USE_ES6)) { + setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6)); + } else { + setUseES6(true); // default to ES6 + } super.processOpts(); // default HIDE_GENERATION_TIMESTAMP to true @@ -266,11 +271,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo if (additionalProperties.containsKey(EMIT_JS_DOC)) { setEmitJSDoc(convertPropertyToBooleanAndWriteBack(EMIT_JS_DOC)); } - if (additionalProperties.containsKey(USE_ES6)) { - setUseES6(convertPropertyToBooleanAndWriteBack(USE_ES6)); - } else { - setUseES6(true); // default to ES6 - } } @Override diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index 35810e96c73..3c84a23057e 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -173,6 +173,12 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + ### http_basic_test - **Type**: HTTP basic authentication diff --git a/samples/client/petstore/javascript-es6/docs/Fake_classname_tags123Api.md b/samples/client/petstore/javascript-es6/docs/Fake_classname_tags123Api.md index 04cc7717ea6..dfe4d0735fe 100644 --- a/samples/client/petstore/javascript-es6/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/javascript-es6/docs/Fake_classname_tags123Api.md @@ -16,6 +16,13 @@ To test class name in snake case ### Example ```javascript 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(); @@ -43,7 +50,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index d47828d2a41..a2556b62caa 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -42,6 +42,7 @@ export default class ApiClient { */ this.authentications = { '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'}, 'petstore_auth': {type: 'oauth2'} } diff --git a/samples/client/petstore/javascript-es6/src/api/Fake_classname_tags123Api.js b/samples/client/petstore/javascript-es6/src/api/Fake_classname_tags123Api.js index 43cb8ffd875..7c4e36454cb 100644 --- a/samples/client/petstore/javascript-es6/src/api/Fake_classname_tags123Api.js +++ b/samples/client/petstore/javascript-es6/src/api/Fake_classname_tags123Api.js @@ -66,7 +66,7 @@ export default class Fake_classname_tags123Api { let formParams = { }; - let authNames = []; + let authNames = ['api_key_query']; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Client; diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index 062b3dd1a27..833e2d74828 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -170,6 +170,12 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + ### http_basic_test - **Type**: HTTP basic authentication diff --git a/samples/client/petstore/javascript-promise-es6/docs/Fake_classname_tags123Api.md b/samples/client/petstore/javascript-promise-es6/docs/Fake_classname_tags123Api.md index 44a60363364..bdd0abf3287 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/javascript-promise-es6/docs/Fake_classname_tags123Api.md @@ -16,6 +16,13 @@ To test class name in snake case ### Example ```javascript 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(); @@ -41,7 +48,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index c7dcea0de86..b68c9055546 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -42,6 +42,7 @@ export default class ApiClient { */ this.authentications = { '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'}, 'petstore_auth': {type: 'oauth2'} } diff --git a/samples/client/petstore/javascript-promise-es6/src/api/Fake_classname_tags123Api.js b/samples/client/petstore/javascript-promise-es6/src/api/Fake_classname_tags123Api.js index fae03ec6568..43f98a3e94f 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/Fake_classname_tags123Api.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/Fake_classname_tags123Api.js @@ -58,7 +58,7 @@ export default class Fake_classname_tags123Api { let formParams = { }; - let authNames = []; + let authNames = ['api_key_query']; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Client; diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index ac95cead92a..50b4721e60e 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -195,6 +195,12 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + ### http_basic_test - **Type**: HTTP basic authentication diff --git a/samples/client/petstore/javascript-promise/docs/Fake_classname_tags123Api.md b/samples/client/petstore/javascript-promise/docs/Fake_classname_tags123Api.md index 6ba27ee832f..4b72d28d5d6 100644 --- a/samples/client/petstore/javascript-promise/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/javascript-promise/docs/Fake_classname_tags123Api.md @@ -16,6 +16,13 @@ To test class name in snake case ### Example ```javascript 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(); @@ -41,7 +48,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index 5c5f317fa97..0d8ec3e5007 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -57,6 +57,7 @@ */ this.authentications = { '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'}, 'petstore_auth': {type: 'oauth2'} }; diff --git a/samples/client/petstore/javascript-promise/src/api/Fake_classname_tags123Api.js b/samples/client/petstore/javascript-promise/src/api/Fake_classname_tags123Api.js index 7d9a624e19e..0fd0a3001d3 100644 --- a/samples/client/petstore/javascript-promise/src/api/Fake_classname_tags123Api.js +++ b/samples/client/petstore/javascript-promise/src/api/Fake_classname_tags123Api.js @@ -74,7 +74,7 @@ var formParams = { }; - var authNames = []; + var authNames = ['api_key_query']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = Client; diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index ce63693fa15..89263d30f51 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -198,6 +198,12 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key - **Location**: HTTP header +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + ### http_basic_test - **Type**: HTTP basic authentication diff --git a/samples/client/petstore/javascript/docs/Fake_classname_tags123Api.md b/samples/client/petstore/javascript/docs/Fake_classname_tags123Api.md index 017483b51a6..56b882b9671 100644 --- a/samples/client/petstore/javascript/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/javascript/docs/Fake_classname_tags123Api.md @@ -16,6 +16,13 @@ To test class name in snake case ### Example ```javascript 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(); @@ -44,7 +51,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[api_key_query](../README.md#api_key_query) ### HTTP request headers diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index b56bc9b4e5f..5ea52184385 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -57,6 +57,7 @@ */ this.authentications = { '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'}, 'petstore_auth': {type: 'oauth2'} }; diff --git a/samples/client/petstore/javascript/src/api/Fake_classname_tags123Api.js b/samples/client/petstore/javascript/src/api/Fake_classname_tags123Api.js index 67c002e26c0..66dd5358704 100644 --- a/samples/client/petstore/javascript/src/api/Fake_classname_tags123Api.js +++ b/samples/client/petstore/javascript/src/api/Fake_classname_tags123Api.js @@ -82,7 +82,7 @@ var formParams = { }; - var authNames = []; + var authNames = ['api_key_query']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = Client; diff --git a/samples/client/petstore/javascript/test/ApiClientTest.js b/samples/client/petstore/javascript/test/ApiClientTest.js index 3a2c041b796..c0f5c82c219 100755 --- a/samples/client/petstore/javascript/test/ApiClientTest.js +++ b/samples/client/petstore/javascript/test/ApiClientTest.js @@ -14,7 +14,8 @@ describe('ApiClient', function() { expect(apiClient.authentications).to.eql({ petstore_auth: {type: 'oauth2'}, 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) * has been removed from the spec, we'll add it back after updating the * petstore server