diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java index b985bed98ce7..23404c781441 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java @@ -205,7 +205,7 @@ public String getName() { @Override public String getHelp() { - return "Generates a Javascript client library."; + return "Generates a JavaScript client library."; } @Override @@ -340,6 +340,7 @@ public void preprocessOpenAPI(OpenAPI openAPI) { supportingFiles.add(new SupportingFile("index.mustache", createPath(sourceFolder, invokerPackage), "index.js")); supportingFiles.add(new SupportingFile("ApiClient.mustache", createPath(sourceFolder, invokerPackage), "ApiClient.js")); + } @Override @@ -980,7 +981,7 @@ public Map postProcessOperationsWithModels(Map o if (hasOptionalParams) { argList.add("opts"); - } + } if (!usePromises) { argList.add("callback"); @@ -1124,17 +1125,6 @@ private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, Code return codegenModel; } - /* - private static String sanitizePackageName(String packageName) { // FIXME parameter should not be assigned. Also declare it as "final" - packageName = packageName.trim(); - packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_"); - if (Strings.isNullOrEmpty(packageName)) { - return "invalidPackageName"; - } - return packageName; - } - */ - @Override public String toEnumName(CodegenProperty property) { return sanitizeName(camelize(property.name)) + "Enum"; @@ -1166,12 +1156,18 @@ public String toEnumValue(String value, String datatype) { @Override public String escapeQuotationMark(String input) { + if (input == null) { + return ""; + } // remove ', " to avoid code injection return input.replace("\"", "").replace("'", ""); } @Override public String escapeUnsafeCharacters(String input) { + if (input == null) { + return ""; + } return input.replace("*/", "*_/").replace("/*", "/_*"); } diff --git a/modules/openapi-generator/src/main/resources/Javascript/es6/travis.yml b/modules/openapi-generator/src/main/resources/Javascript/es6/travis.yml index e49f4692f7c8..0968f7a43333 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/es6/travis.yml +++ b/modules/openapi-generator/src/main/resources/Javascript/es6/travis.yml @@ -1,7 +1,5 @@ language: node_js +cache: npm node_js: - "6" - "6.1" - - "5" - - "5.11" - diff --git a/modules/openapi-generator/src/main/resources/Javascript/travis.yml b/modules/openapi-generator/src/main/resources/Javascript/travis.yml index e49f4692f7c8..1b1103e7bd1b 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/travis.yml +++ b/modules/openapi-generator/src/main/resources/Javascript/travis.yml @@ -1,7 +1,5 @@ language: node_js +cache: npm node_js: - - "6" - - "6.1" - "5" - "5.11" - diff --git a/samples/client/petstore/javascript-es6/.travis.yml b/samples/client/petstore/javascript-es6/.travis.yml index e49f4692f7c8..0968f7a43333 100644 --- a/samples/client/petstore/javascript-es6/.travis.yml +++ b/samples/client/petstore/javascript-es6/.travis.yml @@ -1,7 +1,5 @@ language: node_js +cache: npm node_js: - "6" - "6.1" - - "5" - - "5.11" - diff --git a/samples/client/petstore/javascript-promise-es6/.travis.yml b/samples/client/petstore/javascript-promise-es6/.travis.yml index e49f4692f7c8..0968f7a43333 100644 --- a/samples/client/petstore/javascript-promise-es6/.travis.yml +++ b/samples/client/petstore/javascript-promise-es6/.travis.yml @@ -1,7 +1,5 @@ language: node_js +cache: npm node_js: - "6" - "6.1" - - "5" - - "5.11" - diff --git a/samples/client/petstore/javascript-promise/.travis.yml b/samples/client/petstore/javascript-promise/.travis.yml index e49f4692f7c8..1b1103e7bd1b 100644 --- a/samples/client/petstore/javascript-promise/.travis.yml +++ b/samples/client/petstore/javascript-promise/.travis.yml @@ -1,7 +1,5 @@ language: node_js +cache: npm node_js: - - "6" - - "6.1" - "5" - "5.11" - diff --git a/samples/client/petstore/javascript/.travis.yml b/samples/client/petstore/javascript/.travis.yml index e49f4692f7c8..1b1103e7bd1b 100644 --- a/samples/client/petstore/javascript/.travis.yml +++ b/samples/client/petstore/javascript/.travis.yml @@ -1,7 +1,5 @@ language: node_js +cache: npm node_js: - - "6" - - "6.1" - "5" - "5.11" -