forked from loafle/openapi-generator-original
[cleanup] erefactor/EclipseJdt - Invert equals arguments if parameter is constant string (#9111)
EclipseJdt cleanup 'InvertEquals' applied by erefactor. For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php For erefactor see https://github.com/cal101/erefactor
This commit is contained in:
parent
6daecb88c2
commit
7816ea076e
@ -92,7 +92,7 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen {
|
|||||||
|
|
||||||
// override cliOptions from AbstractPhpCodegen
|
// override cliOptions from AbstractPhpCodegen
|
||||||
for (CliOption co : cliOptions) {
|
for (CliOption co : cliOptions) {
|
||||||
if (co.getOpt().equals(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION)) {
|
if (AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION.equals(co.getOpt())) {
|
||||||
co.setDescription("naming convention of variable name, e.g. camelCase.");
|
co.setDescription("naming convention of variable name, e.g. camelCase.");
|
||||||
co.setDefault("camelCase");
|
co.setDefault("camelCase");
|
||||||
break;
|
break;
|
||||||
|
@ -256,7 +256,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
|||||||
@Override
|
@Override
|
||||||
public String apiFilename(String templateName, String tag) {
|
public String apiFilename(String templateName, String tag) {
|
||||||
String suffix = apiTemplateFiles().get(templateName);
|
String suffix = apiTemplateFiles().get(templateName);
|
||||||
if (templateName.equals("api_controller.mustache"))
|
if ("api_controller.mustache".equals(templateName))
|
||||||
return controllerFileFolder() + File.separator + toControllerName(tag) + suffix;
|
return controllerFileFolder() + File.separator + toControllerName(tag) + suffix;
|
||||||
|
|
||||||
return apiFileFolder() + File.separator + toApiFilename(tag) + suffix;
|
return apiFileFolder() + File.separator + toApiFilename(tag) + suffix;
|
||||||
@ -421,7 +421,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
|||||||
// @todo: The default values for headers, forms and query params are handled
|
// @todo: The default values for headers, forms and query params are handled
|
||||||
// in DefaultCodegen fromParameter with no real possibility to override
|
// in DefaultCodegen fromParameter with no real possibility to override
|
||||||
// the functionality. Thus we are handling quoting of string values here
|
// the functionality. Thus we are handling quoting of string values here
|
||||||
if (param.dataType.equals("string") && param.defaultValue != null && !param.defaultValue.isEmpty()) {
|
if ("string".equals(param.dataType) && param.defaultValue != null && !param.defaultValue.isEmpty()) {
|
||||||
param.defaultValue = "'" + param.defaultValue + "'";
|
param.defaultValue = "'" + param.defaultValue + "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -429,7 +429,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg
|
|||||||
// Create a variable to display the correct return type in comments for interfaces
|
// Create a variable to display the correct return type in comments for interfaces
|
||||||
if (op.returnType != null) {
|
if (op.returnType != null) {
|
||||||
op.vendorExtensions.put("x-comment-type", op.returnType);
|
op.vendorExtensions.put("x-comment-type", op.returnType);
|
||||||
if (op.returnContainer != null && op.returnContainer.equals("array")) {
|
if (op.returnContainer != null && "array".equals(op.returnContainer)) {
|
||||||
op.vendorExtensions.put("x-comment-type", op.returnType + "[]");
|
op.vendorExtensions.put("x-comment-type", op.returnType + "[]");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -547,7 +547,7 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
|
|||||||
* @return the sanitized value for enum
|
* @return the sanitized value for enum
|
||||||
*/
|
*/
|
||||||
public String toEnumValue(String value, String datatype) {
|
public String toEnumValue(String value, String datatype) {
|
||||||
if (datatype.equals("int") || datatype.equals("float")) {
|
if ("int".equals(datatype) || "float".equals(datatype)) {
|
||||||
return value;
|
return value;
|
||||||
} else {
|
} else {
|
||||||
return ensureQuotes(value);
|
return ensureQuotes(value);
|
||||||
|
@ -584,7 +584,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMimetypeUnknown(String mimetype) {
|
private boolean isMimetypeUnknown(String mimetype) {
|
||||||
return mimetype.equals("*/*");
|
return "*/*".equals(mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -864,7 +864,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if (producesXml) {
|
if (producesXml) {
|
||||||
outputMime = xmlMimeType;
|
outputMime = xmlMimeType;
|
||||||
} else if (producesPlainText) {
|
} else if (producesPlainText) {
|
||||||
if (rsp.dataType.equals(bytesType)) {
|
if (bytesType.equals(rsp.dataType)) {
|
||||||
outputMime = octetMimeType;
|
outputMime = octetMimeType;
|
||||||
} else {
|
} else {
|
||||||
outputMime = plainTextMimeType;
|
outputMime = plainTextMimeType;
|
||||||
@ -907,7 +907,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
// and string/bytes - that is we don't auto-detect whether
|
// and string/bytes - that is we don't auto-detect whether
|
||||||
// base64 encoding should be done. They both look like
|
// base64 encoding should be done. They both look like
|
||||||
// 'producesBytes'.
|
// 'producesBytes'.
|
||||||
if (rsp.dataType.equals(bytesType)) {
|
if (bytesType.equals(rsp.dataType)) {
|
||||||
rsp.vendorExtensions.put("x-produces-bytes", true);
|
rsp.vendorExtensions.put("x-produces-bytes", true);
|
||||||
} else {
|
} else {
|
||||||
rsp.vendorExtensions.put("x-produces-plain-text", true);
|
rsp.vendorExtensions.put("x-produces-plain-text", true);
|
||||||
@ -917,7 +917,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
// If the data type is just "object", then ensure that the
|
// If the data type is just "object", then ensure that the
|
||||||
// Rust data type is "serde_json::Value". This allows us
|
// Rust data type is "serde_json::Value". This allows us
|
||||||
// to define APIs that can return arbitrary JSON bodies.
|
// to define APIs that can return arbitrary JSON bodies.
|
||||||
if (rsp.dataType.equals("object")) {
|
if ("object".equals(rsp.dataType)) {
|
||||||
rsp.dataType = "serde_json::Value";
|
rsp.dataType = "serde_json::Value";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -935,7 +935,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (CodegenProperty header : rsp.headers) {
|
for (CodegenProperty header : rsp.headers) {
|
||||||
if (header.dataType.equals(uuidType)) {
|
if (uuidType.equals(header.dataType)) {
|
||||||
additionalProperties.put("apiUsesUuid", true);
|
additionalProperties.put("apiUsesUuid", true);
|
||||||
}
|
}
|
||||||
header.nameInCamelCase = toModelName(header.baseName);
|
header.nameInCamelCase = toModelName(header.baseName);
|
||||||
@ -948,7 +948,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (CodegenProperty header : op.responseHeaders) {
|
for (CodegenProperty header : op.responseHeaders) {
|
||||||
if (header.dataType.equals(uuidType)) {
|
if (uuidType.equals(header.dataType)) {
|
||||||
additionalProperties.put("apiUsesUuid", true);
|
additionalProperties.put("apiUsesUuid", true);
|
||||||
}
|
}
|
||||||
header.nameInCamelCase = toModelName(header.baseName);
|
header.nameInCamelCase = toModelName(header.baseName);
|
||||||
@ -1043,7 +1043,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (CodegenProperty header : op.responseHeaders) {
|
for (CodegenProperty header : op.responseHeaders) {
|
||||||
if (header.dataType.equals(uuidType)) {
|
if (uuidType.equals(header.dataType)) {
|
||||||
additionalProperties.put("apiUsesUuid", true);
|
additionalProperties.put("apiUsesUuid", true);
|
||||||
}
|
}
|
||||||
header.nameInCamelCase = toModelName(header.baseName);
|
header.nameInCamelCase = toModelName(header.baseName);
|
||||||
@ -1280,7 +1280,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (CodegenProperty prop : model.vars) {
|
for (CodegenProperty prop : model.vars) {
|
||||||
if (prop.dataType.equals(uuidType)) {
|
if (uuidType.equals(prop.dataType)) {
|
||||||
additionalProperties.put("apiUsesUuid", true);
|
additionalProperties.put("apiUsesUuid", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1289,7 +1289,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
prop.vendorExtensions.put("x-item-xml-name", xmlName);
|
prop.vendorExtensions.put("x-item-xml-name", xmlName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop.dataType.equals(uuidType)) {
|
if (uuidType.equals(prop.dataType)) {
|
||||||
additionalProperties.put("apiUsesUuid", true);
|
additionalProperties.put("apiUsesUuid", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1383,11 +1383,11 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
@Override
|
@Override
|
||||||
public String toDefaultValue(Schema p) {
|
public String toDefaultValue(Schema p) {
|
||||||
String defaultValue = null;
|
String defaultValue = null;
|
||||||
if ((ModelUtils.isNullable(p)) && (p.getDefault() != null) && (p.getDefault().toString().equalsIgnoreCase("null")))
|
if ((ModelUtils.isNullable(p)) && (p.getDefault() != null) && ("null".equalsIgnoreCase(p.getDefault().toString())))
|
||||||
return "swagger::Nullable::Null";
|
return "swagger::Nullable::Null";
|
||||||
else if (ModelUtils.isBooleanSchema(p)) {
|
else if (ModelUtils.isBooleanSchema(p)) {
|
||||||
if (p.getDefault() != null) {
|
if (p.getDefault() != null) {
|
||||||
if (p.getDefault().toString().equalsIgnoreCase("false"))
|
if ("false".equalsIgnoreCase(p.getDefault().toString()))
|
||||||
defaultValue = "false";
|
defaultValue = "false";
|
||||||
else
|
else
|
||||||
defaultValue = "true";
|
defaultValue = "true";
|
||||||
@ -1560,12 +1560,12 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
LOGGER.trace("Post processing model: {}", cm);
|
LOGGER.trace("Post processing model: {}", cm);
|
||||||
|
|
||||||
if (cm.dataType != null && cm.dataType.equals("object")) {
|
if (cm.dataType != null && "object".equals(cm.dataType)) {
|
||||||
// Object isn't a sensible default. Instead, we set it to
|
// Object isn't a sensible default. Instead, we set it to
|
||||||
// 'null'. This ensures that we treat this model as a struct
|
// 'null'. This ensures that we treat this model as a struct
|
||||||
// with multiple parameters.
|
// with multiple parameters.
|
||||||
cm.dataType = null;
|
cm.dataType = null;
|
||||||
} else if (cm.dataType != null && cm.dataType.equals("map")) {
|
} else if (cm.dataType != null && "map".equals(cm.dataType)) {
|
||||||
if (!cm.allVars.isEmpty() || cm.additionalPropertiesType == null) {
|
if (!cm.allVars.isEmpty() || cm.additionalPropertiesType == null) {
|
||||||
// We don't yet support `additionalProperties` that also have
|
// We don't yet support `additionalProperties` that also have
|
||||||
// properties. If we see variables, we ignore the
|
// properties. If we see variables, we ignore the
|
||||||
@ -1639,7 +1639,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
param.vendorExtensions.put("x-example", "???");
|
param.vendorExtensions.put("x-example", "???");
|
||||||
op.vendorExtensions.put("x-no-client-example", Boolean.TRUE);
|
op.vendorExtensions.put("x-no-client-example", Boolean.TRUE);
|
||||||
}
|
}
|
||||||
} else if ((param.dataFormat != null) && ((param.dataFormat.equals("date-time")) || (param.dataFormat.equals("date")))) {
|
} else if ((param.dataFormat != null) && (("date-time".equals(param.dataFormat)) || ("date".equals(param.dataFormat)))) {
|
||||||
param.vendorExtensions.put("x-format-string", "{:?}");
|
param.vendorExtensions.put("x-format-string", "{:?}");
|
||||||
param.vendorExtensions.put("x-example", "None");
|
param.vendorExtensions.put("x-example", "None");
|
||||||
} else {
|
} else {
|
||||||
|
@ -271,7 +271,7 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
|||||||
if (!param.required) {
|
if (!param.required) {
|
||||||
param.vendorExtensions.put("x-has-default-value", param.defaultValue != null);
|
param.vendorExtensions.put("x-has-default-value", param.defaultValue != null);
|
||||||
// Escaping default string values
|
// Escaping default string values
|
||||||
if (param.defaultValue != null && param.dataType.equals("String")) {
|
if (param.defaultValue != null && "String".equals(param.dataType)) {
|
||||||
param.defaultValue = String.format(Locale.ROOT, "\"%s\"", param.defaultValue);
|
param.defaultValue = String.format(Locale.ROOT, "\"%s\"", param.defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ public class ScalaAkkaHttpServerCodegen extends AbstractScalaCodegen implements
|
|||||||
operationSpecificMarshallers.add(marshaller);
|
operationSpecificMarshallers.add(marshaller);
|
||||||
}
|
}
|
||||||
response.vendorExtensions.put("x-empty-response", response.baseType == null && response.message == null);
|
response.vendorExtensions.put("x-empty-response", response.baseType == null && response.message == null);
|
||||||
response.vendorExtensions.put("x-is-default", response.code.equals("0"));
|
response.vendorExtensions.put("x-is-default", "0".equals(response.code));
|
||||||
}
|
}
|
||||||
op.vendorExtensions.put("x-specific-marshallers", operationSpecificMarshallers);
|
op.vendorExtensions.put("x-specific-marshallers", operationSpecificMarshallers);
|
||||||
op.vendorExtensions.put("x-file-params", fileParams);
|
op.vendorExtensions.put("x-file-params", fileParams);
|
||||||
|
@ -316,7 +316,7 @@ public class ScalaFinchServerCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
//All path parameters are String initially, for primitives these need to be converted
|
//All path parameters are String initially, for primitives these need to be converted
|
||||||
private String toPathParameter(CodegenParameter p, String paramType, Boolean canBeOptional) {
|
private String toPathParameter(CodegenParameter p, String paramType, Boolean canBeOptional) {
|
||||||
|
|
||||||
Boolean isNotAString = !p.dataType.equals("String");
|
Boolean isNotAString = !"String".equals(p.dataType);
|
||||||
|
|
||||||
return paramType + (canBeOptional && !p.required ? "Option" : "") + "(\"" + p.baseName + "\")" + (isNotAString ? toPrimitive(p.dataType, p.required, canBeOptional) : "");
|
return paramType + (canBeOptional && !p.required ? "Option" : "") + "(\"" + p.baseName + "\")" + (isNotAString ? toPrimitive(p.dataType, p.required, canBeOptional) : "");
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ public class ScalaGatlingCodegen extends AbstractScalaCodegen implements Codegen
|
|||||||
if (operation.getParameters() != null) {
|
if (operation.getParameters() != null) {
|
||||||
|
|
||||||
for (Parameter parameter : operation.getParameters()) {
|
for (Parameter parameter : operation.getParameters()) {
|
||||||
if (parameter.getIn().equalsIgnoreCase("header")) {
|
if ("header".equalsIgnoreCase(parameter.getIn())) {
|
||||||
headerParameters.add(parameter);
|
headerParameters.add(parameter);
|
||||||
}
|
}
|
||||||
/* need to revise below as form parameter is no longer in the parameter list
|
/* need to revise below as form parameter is no longer in the parameter list
|
||||||
@ -287,10 +287,10 @@ public class ScalaGatlingCodegen extends AbstractScalaCodegen implements Codegen
|
|||||||
formParameters.add(parameter);
|
formParameters.add(parameter);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (parameter.getIn().equalsIgnoreCase("query")) {
|
if ("query".equalsIgnoreCase(parameter.getIn())) {
|
||||||
queryParameters.add(parameter);
|
queryParameters.add(parameter);
|
||||||
}
|
}
|
||||||
if (parameter.getIn().equalsIgnoreCase("path")) {
|
if ("path".equalsIgnoreCase(parameter.getIn())) {
|
||||||
pathParameters.add(parameter);
|
pathParameters.add(parameter);
|
||||||
}
|
}
|
||||||
/* TODO need to revise below as body is no longer in the parameter
|
/* TODO need to revise below as body is no longer in the parameter
|
||||||
|
@ -380,9 +380,9 @@ public class ScalaSttpClientCodegen extends AbstractScalaCodegen implements Code
|
|||||||
@Override
|
@Override
|
||||||
public void updateAdditionalProperties(Map<String, Object> additionalProperties) {
|
public void updateAdditionalProperties(Map<String, Object> additionalProperties) {
|
||||||
String value = getValue(additionalProperties);
|
String value = getValue(additionalProperties);
|
||||||
if (value.equals(CIRCE) || value.equals(JSON4S)) {
|
if (CIRCE.equals(value) || JSON4S.equals(value)) {
|
||||||
additionalProperties.put(CIRCE, value.equals(CIRCE));
|
additionalProperties.put(CIRCE, CIRCE.equals(value));
|
||||||
additionalProperties.put(JSON4S, value.equals(JSON4S));
|
additionalProperties.put(JSON4S, JSON4S.equals(value));
|
||||||
} else {
|
} else {
|
||||||
IllegalArgumentException exception =
|
IllegalArgumentException exception =
|
||||||
new IllegalArgumentException("Invalid json library: " + value + ". Must be " + CIRCE + " " +
|
new IllegalArgumentException("Invalid json library: " + value + ". Must be " + CIRCE + " " +
|
||||||
|
@ -358,13 +358,13 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
|
|
||||||
if (!this.interfaceOnly) {
|
if (!this.interfaceOnly) {
|
||||||
if (library.equals(SPRING_BOOT)) {
|
if (SPRING_BOOT.equals(library)) {
|
||||||
supportingFiles.add(new SupportingFile("openapi2SpringBoot.mustache",
|
supportingFiles.add(new SupportingFile("openapi2SpringBoot.mustache",
|
||||||
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "OpenAPI2SpringBoot.java"));
|
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "OpenAPI2SpringBoot.java"));
|
||||||
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache",
|
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache",
|
||||||
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "RFC3339DateFormat.java"));
|
(sourceFolder + File.separator + basePackage).replace(".", java.io.File.separator), "RFC3339DateFormat.java"));
|
||||||
}
|
}
|
||||||
if (library.equals(SPRING_MVC_LIBRARY)) {
|
if (SPRING_MVC_LIBRARY.equals(library)) {
|
||||||
supportingFiles.add(new SupportingFile("webApplication.mustache",
|
supportingFiles.add(new SupportingFile("webApplication.mustache",
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java"));
|
||||||
supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache",
|
supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache",
|
||||||
@ -374,7 +374,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache",
|
supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache",
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "RFC3339DateFormat.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "RFC3339DateFormat.java"));
|
||||||
}
|
}
|
||||||
if (library.equals(SPRING_CLOUD_LIBRARY)) {
|
if (SPRING_CLOUD_LIBRARY.equals(library)) {
|
||||||
supportingFiles.add(new SupportingFile("apiKeyRequestInterceptor.mustache",
|
supportingFiles.add(new SupportingFile("apiKeyRequestInterceptor.mustache",
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "ApiKeyRequestInterceptor.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "ApiKeyRequestInterceptor.java"));
|
||||||
supportingFiles.add(new SupportingFile("clientConfiguration.mustache",
|
supportingFiles.add(new SupportingFile("clientConfiguration.mustache",
|
||||||
@ -398,7 +398,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
("src/main/resources").replace("/", java.io.File.separator), "openapi.yaml"));
|
("src/main/resources").replace("/", java.io.File.separator), "openapi.yaml"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.openapiDocketConfig && !library.equals(SPRING_CLOUD_LIBRARY) && !this.reactive && !this.apiFirst) {
|
} else if (this.openapiDocketConfig && !SPRING_CLOUD_LIBRARY.equals(library) && !this.reactive && !this.apiFirst) {
|
||||||
supportingFiles.add(new SupportingFile("openapiDocumentationConfig.mustache",
|
supportingFiles.add(new SupportingFile("openapiDocumentationConfig.mustache",
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIDocumentationConfig.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "OpenAPIDocumentationConfig.java"));
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
if ("threetenbp".equals(dateLibrary)) {
|
if ("threetenbp".equals(dateLibrary)) {
|
||||||
supportingFiles.add(new SupportingFile("customInstantDeserializer.mustache",
|
supportingFiles.add(new SupportingFile("customInstantDeserializer.mustache",
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "CustomInstantDeserializer.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "CustomInstantDeserializer.java"));
|
||||||
if (library.equals(SPRING_BOOT) || library.equals(SPRING_CLOUD_LIBRARY)) {
|
if (SPRING_BOOT.equals(library) || SPRING_CLOUD_LIBRARY.equals(library)) {
|
||||||
supportingFiles.add(new SupportingFile("jacksonConfiguration.mustache",
|
supportingFiles.add(new SupportingFile("jacksonConfiguration.mustache",
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "JacksonConfiguration.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "JacksonConfiguration.java"));
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||||
if ((library.equals(SPRING_BOOT) || library.equals(SPRING_MVC_LIBRARY)) && !useTags) {
|
if ((SPRING_BOOT.equals(library) || SPRING_MVC_LIBRARY.equals(library)) && !useTags) {
|
||||||
String basePath = resourcePath;
|
String basePath = resourcePath;
|
||||||
if (basePath.startsWith("/")) {
|
if (basePath.startsWith("/")) {
|
||||||
basePath = basePath.substring(1);
|
basePath = basePath.substring(1);
|
||||||
@ -510,7 +510,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
basePath = basePath.substring(0, pos);
|
basePath = basePath.substring(0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basePath.equals("")) {
|
if ("".equals(basePath)) {
|
||||||
basePath = "default";
|
basePath = "default";
|
||||||
} else {
|
} else {
|
||||||
co.subresourceOperation = !co.path.isEmpty();
|
co.subresourceOperation = !co.path.isEmpty();
|
||||||
@ -682,7 +682,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
||||||
generateYAMLSpecFile(objs);
|
generateYAMLSpecFile(objs);
|
||||||
if (library.equals(SPRING_CLOUD_LIBRARY)) {
|
if (SPRING_CLOUD_LIBRARY.equals(library)) {
|
||||||
List<CodegenSecurity> authMethods = (List<CodegenSecurity>) objs.get("authMethods");
|
List<CodegenSecurity> authMethods = (List<CodegenSecurity>) objs.get("authMethods");
|
||||||
if (authMethods != null) {
|
if (authMethods != null) {
|
||||||
for (CodegenSecurity authMethod : authMethods) {
|
for (CodegenSecurity authMethod : authMethods) {
|
||||||
|
@ -534,12 +534,12 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(String dataType) {
|
public boolean isDataTypeFile(String dataType) {
|
||||||
return dataType != null && dataType.equals("URL");
|
return dataType != null && "URL".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeBinary(final String dataType) {
|
public boolean isDataTypeBinary(final String dataType) {
|
||||||
return dataType != null && dataType.equals("Data");
|
return dataType != null && "Data".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -546,12 +546,12 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(String dataType) {
|
public boolean isDataTypeFile(String dataType) {
|
||||||
return dataType != null && dataType.equals("URL");
|
return dataType != null && "URL".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeBinary(final String dataType) {
|
public boolean isDataTypeBinary(final String dataType) {
|
||||||
return dataType != null && dataType.equals("Data");
|
return dataType != null && "Data".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -384,7 +384,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(final String dataType) {
|
public boolean isDataTypeFile(final String dataType) {
|
||||||
return dataType != null && dataType.equals("Blob");
|
return dataType != null && "Blob".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,7 +94,7 @@ public class TypeScriptAureliaClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
|
|
||||||
// Collect models to be imported
|
// Collect models to be imported
|
||||||
for (CodegenParameter param : op.allParams) {
|
for (CodegenParameter param : op.allParams) {
|
||||||
if (!param.isPrimitiveType && !param.isArray && !param.dataType.equals("any")) {
|
if (!param.isPrimitiveType && !param.isArray && !"any".equals(param.dataType)) {
|
||||||
modelImports.add(param.dataType);
|
modelImports.add(param.dataType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -783,15 +783,15 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
}
|
}
|
||||||
additionalProperties.put("platforms", platforms);
|
additionalProperties.put("platforms", platforms);
|
||||||
|
|
||||||
additionalProperties.putIfAbsent(FILE_CONTENT_DATA_TYPE, propPlatform.equals("node") ? "Buffer" : "Blob");
|
additionalProperties.putIfAbsent(FILE_CONTENT_DATA_TYPE, "node".equals(propPlatform) ? "Buffer" : "Blob");
|
||||||
|
|
||||||
if (!propPlatform.equals("deno")) {
|
if (!"deno".equals(propPlatform)) {
|
||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
|
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
|
||||||
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
|
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propPlatform.equals("deno")) {
|
if ("deno".equals(propPlatform)) {
|
||||||
additionalProperties.put("extensionForDeno", ".ts");
|
additionalProperties.put("extensionForDeno", ".ts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(final String dataType) {
|
public boolean isDataTypeFile(final String dataType) {
|
||||||
return dataType != null && dataType.equals("Blob");
|
return dataType != null && "Blob".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,7 +216,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(final String dataType) {
|
public boolean isDataTypeFile(final String dataType) {
|
||||||
return dataType != null && dataType.equals("Blob");
|
return dataType != null && "Blob".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,7 +82,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(final String dataType) {
|
public boolean isDataTypeFile(final String dataType) {
|
||||||
return dataType != null && dataType.equals("RequestFile");
|
return dataType != null && "RequestFile".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,7 +98,7 @@ public class TypeScriptRxjsClientCodegen extends AbstractTypeScriptClientCodegen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDataTypeFile(final String dataType) {
|
public boolean isDataTypeFile(final String dataType) {
|
||||||
return dataType != null && dataType.equals("Blob");
|
return dataType != null && "Blob".equals(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ class OpenApiParameterValidations extends GenericValidator<ParameterWrapper> {
|
|||||||
*/
|
*/
|
||||||
private static ValidationRule.Result apacheNginxHeaderCheck(ParameterWrapper parameterWrapper) {
|
private static ValidationRule.Result apacheNginxHeaderCheck(ParameterWrapper parameterWrapper) {
|
||||||
Parameter parameter = parameterWrapper.getParameter();
|
Parameter parameter = parameterWrapper.getParameter();
|
||||||
if (parameter == null || !parameter.getIn().equals("header")) return ValidationRule.Pass.empty();
|
if (parameter == null || !"header".equals(parameter.getIn())) return ValidationRule.Pass.empty();
|
||||||
ValidationRule.Result result = ValidationRule.Pass.empty();
|
ValidationRule.Result result = ValidationRule.Pass.empty();
|
||||||
|
|
||||||
String headerName = parameter.getName();
|
String headerName = parameter.getName();
|
||||||
|
@ -270,11 +270,11 @@ public class DefaultCodegenTest {
|
|||||||
CodegenProperty map_without_additional_properties_cp = null;
|
CodegenProperty map_without_additional_properties_cp = null;
|
||||||
|
|
||||||
for(CodegenProperty cp: cm.vars) {
|
for(CodegenProperty cp: cm.vars) {
|
||||||
if (cp.baseName.equals("map_string")) {
|
if ("map_string".equals(cp.baseName)) {
|
||||||
map_string_cp = cp;
|
map_string_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_with_additional_properties")) {
|
} else if ("map_with_additional_properties".equals(cp.baseName)) {
|
||||||
map_with_additional_properties_cp = cp;
|
map_with_additional_properties_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_without_additional_properties")) {
|
} else if ("map_without_additional_properties".equals(cp.baseName)) {
|
||||||
map_without_additional_properties_cp = cp;
|
map_without_additional_properties_cp = cp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,11 +359,11 @@ public class DefaultCodegenTest {
|
|||||||
CodegenProperty map_without_additional_properties_cp = null;
|
CodegenProperty map_without_additional_properties_cp = null;
|
||||||
|
|
||||||
for(CodegenProperty cp: cm.vars) {
|
for(CodegenProperty cp: cm.vars) {
|
||||||
if (cp.baseName.equals("map_string")) {
|
if ("map_string".equals(cp.baseName)) {
|
||||||
map_string_cp = cp;
|
map_string_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_with_additional_properties")) {
|
} else if ("map_with_additional_properties".equals(cp.baseName)) {
|
||||||
map_with_additional_properties_cp = cp;
|
map_with_additional_properties_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_without_additional_properties")) {
|
} else if ("map_without_additional_properties".equals(cp.baseName)) {
|
||||||
map_without_additional_properties_cp = cp;
|
map_without_additional_properties_cp = cp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,15 +439,15 @@ public class DefaultCodegenTest {
|
|||||||
CodegenProperty empty_map_cp = null;
|
CodegenProperty empty_map_cp = null;
|
||||||
|
|
||||||
for(CodegenProperty cp: cm.vars) {
|
for(CodegenProperty cp: cm.vars) {
|
||||||
if (cp.baseName.equals("map_with_undeclared_properties_string")) {
|
if ("map_with_undeclared_properties_string".equals(cp.baseName)) {
|
||||||
map_with_undeclared_properties_string_cp = cp;
|
map_with_undeclared_properties_string_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_with_undeclared_properties_anytype_1")) {
|
} else if ("map_with_undeclared_properties_anytype_1".equals(cp.baseName)) {
|
||||||
map_with_undeclared_properties_anytype_1_cp = cp;
|
map_with_undeclared_properties_anytype_1_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_with_undeclared_properties_anytype_2")) {
|
} else if ("map_with_undeclared_properties_anytype_2".equals(cp.baseName)) {
|
||||||
map_with_undeclared_properties_anytype_2_cp = cp;
|
map_with_undeclared_properties_anytype_2_cp = cp;
|
||||||
} else if (cp.baseName.equals("map_with_undeclared_properties_anytype_3")) {
|
} else if ("map_with_undeclared_properties_anytype_3".equals(cp.baseName)) {
|
||||||
map_with_undeclared_properties_anytype_3_cp = cp;
|
map_with_undeclared_properties_anytype_3_cp = cp;
|
||||||
} else if (cp.baseName.equals("empty_map")) {
|
} else if ("empty_map".equals(cp.baseName)) {
|
||||||
empty_map_cp = cp;
|
empty_map_cp = cp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ public class DefaultCodegenTest {
|
|||||||
// make sure that fruit has the property color
|
// make sure that fruit has the property color
|
||||||
boolean colorSeen = false;
|
boolean colorSeen = false;
|
||||||
for (CodegenProperty cp : fruit.vars) {
|
for (CodegenProperty cp : fruit.vars) {
|
||||||
if (cp.name.equals("color")) {
|
if ("color".equals(cp.name)) {
|
||||||
colorSeen = true;
|
colorSeen = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ public class DefaultCodegenTest {
|
|||||||
Assert.assertTrue(colorSeen);
|
Assert.assertTrue(colorSeen);
|
||||||
colorSeen = false;
|
colorSeen = false;
|
||||||
for (CodegenProperty cp : fruit.optionalVars) {
|
for (CodegenProperty cp : fruit.optionalVars) {
|
||||||
if (cp.name.equals("color")) {
|
if ("color".equals(cp.name)) {
|
||||||
colorSeen = true;
|
colorSeen = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user