forked from loafle/openapi-generator-original
[JS] fix NPE for null string and improve Travis config file (#2553)
* fix NPE with null string * update travis for nodejs * update js samples
This commit is contained in:
parent
977df6e232
commit
18b500218a
@ -205,7 +205,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHelp() {
|
public String getHelp() {
|
||||||
return "Generates a Javascript client library.";
|
return "Generates a JavaScript client library.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -340,6 +340,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
supportingFiles.add(new SupportingFile("index.mustache", createPath(sourceFolder, invokerPackage), "index.js"));
|
supportingFiles.add(new SupportingFile("index.mustache", createPath(sourceFolder, invokerPackage), "index.js"));
|
||||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", createPath(sourceFolder, invokerPackage), "ApiClient.js"));
|
supportingFiles.add(new SupportingFile("ApiClient.mustache", createPath(sourceFolder, invokerPackage), "ApiClient.js"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1124,17 +1125,6 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
return codegenModel;
|
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
|
@Override
|
||||||
public String toEnumName(CodegenProperty property) {
|
public String toEnumName(CodegenProperty property) {
|
||||||
return sanitizeName(camelize(property.name)) + "Enum";
|
return sanitizeName(camelize(property.name)) + "Enum";
|
||||||
@ -1166,12 +1156,18 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String escapeQuotationMark(String input) {
|
public String escapeQuotationMark(String input) {
|
||||||
|
if (input == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
// remove ', " to avoid code injection
|
// remove ', " to avoid code injection
|
||||||
return input.replace("\"", "").replace("'", "");
|
return input.replace("\"", "").replace("'", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String escapeUnsafeCharacters(String input) {
|
public String escapeUnsafeCharacters(String input) {
|
||||||
|
if (input == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return input.replace("*/", "*_/").replace("/*", "/_*");
|
return input.replace("*/", "*_/").replace("/*", "/_*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
cache: npm
|
||||||
node_js:
|
node_js:
|
||||||
- "6"
|
- "6"
|
||||||
- "6.1"
|
- "6.1"
|
||||||
- "5"
|
|
||||||
- "5.11"
|
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
cache: npm
|
||||||
node_js:
|
node_js:
|
||||||
- "6"
|
|
||||||
- "6.1"
|
|
||||||
- "5"
|
- "5"
|
||||||
- "5.11"
|
- "5.11"
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
cache: npm
|
||||||
node_js:
|
node_js:
|
||||||
- "6"
|
- "6"
|
||||||
- "6.1"
|
- "6.1"
|
||||||
- "5"
|
|
||||||
- "5.11"
|
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
cache: npm
|
||||||
node_js:
|
node_js:
|
||||||
- "6"
|
- "6"
|
||||||
- "6.1"
|
- "6.1"
|
||||||
- "5"
|
|
||||||
- "5.11"
|
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
cache: npm
|
||||||
node_js:
|
node_js:
|
||||||
- "6"
|
|
||||||
- "6.1"
|
|
||||||
- "5"
|
- "5"
|
||||||
- "5.11"
|
- "5.11"
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
cache: npm
|
||||||
node_js:
|
node_js:
|
||||||
- "6"
|
|
||||||
- "6.1"
|
|
||||||
- "5"
|
- "5"
|
||||||
- "5.11"
|
- "5.11"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user