Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS] fix NPE for null string and improve Travis config file #2553

Merged
merged 3 commits into from
Mar 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public String getName() {

@Override
public String getHelp() {
return "Generates a Javascript client library.";
return "Generates a JavaScript client library.";
}

@Override
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -980,7 +981,7 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o

if (hasOptionalParams) {
argList.add("opts");
}
}

if (!usePromises) {
argList.add("callback");
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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("/*", "/_*");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

4 changes: 1 addition & 3 deletions samples/client/petstore/javascript-es6/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

4 changes: 1 addition & 3 deletions samples/client/petstore/javascript-promise-es6/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

4 changes: 1 addition & 3 deletions samples/client/petstore/javascript-promise/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"

4 changes: 1 addition & 3 deletions samples/client/petstore/javascript/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: node_js
cache: npm
node_js:
- "6"
- "6.1"
- "5"
- "5.11"