forked from loafle/openapi-generator-original
fix string comparison (#376)
This commit is contained in:
parent
3608a14b40
commit
9ecd3586b5
@ -21,11 +21,10 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
|
||||
|
||||
public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig {
|
||||
|
||||
@ -54,7 +53,7 @@ public class AdaCodegen extends AbstractAdaCodegen implements CodegenConfig {
|
||||
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
|
||||
packageName = (String) additionalProperties.get(CodegenConstants.PACKAGE_NAME);
|
||||
}
|
||||
if (packageName == "") {
|
||||
if (StringUtils.isEmpty(packageName)) {
|
||||
packageName = modelPackage;
|
||||
}
|
||||
String srcPrefix = "src" + File.separator;
|
||||
|
@ -170,7 +170,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
|
||||
if (response != null) {
|
||||
CodegenProperty cm = fromProperty("response", response);
|
||||
op.vendorExtensions.put("x-codegen-response", cm);
|
||||
if (cm.datatype == "HttpContent") {
|
||||
if ("HttpContent".equals(cm.datatype)) {
|
||||
op.vendorExtensions.put("x-codegen-response-ishttpcontent", true);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class CppQt5ClientCodegen extends AbstractCppCodegen implements CodegenCo
|
||||
outputFolder = "generated-code/qt5cpp";
|
||||
|
||||
// set modelNamePrefix as default for QT5CPP
|
||||
if ("".equals(modelNamePrefix)) {
|
||||
if (StringUtils.isEmpty(modelNamePrefix)) {
|
||||
modelNamePrefix = PREFIX;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ public class CppRestClientCodegen extends AbstractCppCodegen {
|
||||
if (response != null) {
|
||||
CodegenProperty cm = fromProperty("response", response);
|
||||
op.vendorExtensions.put("x-codegen-response", cm);
|
||||
if (cm.datatype == "HttpContent") {
|
||||
if ("HttpContent".equals(cm.datatype)) {
|
||||
op.vendorExtensions.put("x-codegen-response-ishttpcontent", true);
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ public class CppTizenClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
// throw exception if method name is empty
|
||||
if ("".equals(operationId)) {
|
||||
if (StringUtils.isEmpty(operationId)) {
|
||||
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ package org.openapitools.codegen.languages;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
@ -107,7 +108,7 @@ public class JavaInflectorServerCodegen extends AbstractJavaCodegen {
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath == "") {
|
||||
if (StringUtils.isEmpty(basePath)) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
|
@ -19,6 +19,7 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
@ -147,7 +148,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath == "") {
|
||||
if (StringUtils.isEmpty(basePath)) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
@ -156,7 +157,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
}
|
||||
List<CodegenOperation> opList = operations.get(basePath);
|
||||
if (opList == null) {
|
||||
if (opList == null || opList.isEmpty()) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
operations.put(basePath, opList);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
|
||||
import java.util.*;
|
||||
@ -171,7 +170,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath == "") {
|
||||
if (StringUtils.isEmpty(basePath)) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
@ -180,7 +179,7 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
}
|
||||
List<CodegenOperation> opList = operations.get(basePath);
|
||||
if (opList == null) {
|
||||
if (opList == null || opList.isEmpty()) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
operations.put(basePath, opList);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public class JavaMSF4JServerCodegen extends AbstractJavaJAXRSServerCodegen {
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath == "") {
|
||||
if (StringUtils.isEmpty(basePath)) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
|
@ -126,7 +126,7 @@ public class JavaResteasyEapServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath == "") {
|
||||
if (StringUtils.isEmpty("")) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
@ -135,7 +135,7 @@ public class JavaResteasyEapServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
}
|
||||
List<CodegenOperation> opList = operations.get(basePath);
|
||||
if (opList == null) {
|
||||
if (opList == null || opList.isEmpty()) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
operations.put(basePath, opList);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
@ -129,7 +128,7 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen im
|
||||
basePath = basePath.substring(0, pos);
|
||||
}
|
||||
|
||||
if (basePath == "") {
|
||||
if (StringUtils.isEmpty(basePath)) {
|
||||
basePath = "default";
|
||||
} else {
|
||||
if (co.path.startsWith("/" + basePath)) {
|
||||
@ -138,7 +137,7 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen im
|
||||
co.subresourceOperation = !co.path.isEmpty();
|
||||
}
|
||||
List<CodegenOperation> opList = operations.get(basePath);
|
||||
if (opList == null) {
|
||||
if (opList == null || opList.isEmpty()) {
|
||||
opList = new ArrayList<CodegenOperation>();
|
||||
operations.put(basePath, opList);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user