forked from loafle/openapi-generator-original
Fixing squid:S1488 - Local Variables should not be declared and then immediately returned or thrown
This commit is contained in:
@@ -390,8 +390,7 @@ public class CodegenConfigurator {
|
||||
|
||||
if (isNotEmpty(configFile)) {
|
||||
try {
|
||||
CodegenConfigurator result = Json.mapper().readValue(new File(configFile), CodegenConfigurator.class);
|
||||
return result;
|
||||
return Json.mapper().readValue(new File(configFile), CodegenConfigurator.class);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Unable to deserialize config file: " + configFile, e);
|
||||
}
|
||||
|
||||
@@ -88,10 +88,9 @@ public class ExampleGenerator {
|
||||
} else if (property instanceof ArrayProperty) {
|
||||
Property innerType = ((ArrayProperty) property).getItems();
|
||||
if (innerType != null) {
|
||||
Object[] output = new Object[]{
|
||||
return new Object[]{
|
||||
resolvePropertyToExample(mediaType, innerType, processedModels)
|
||||
};
|
||||
return output;
|
||||
}
|
||||
} else if (property instanceof DateProperty) {
|
||||
return new java.util.Date(System.currentTimeMillis());
|
||||
|
||||
@@ -42,8 +42,7 @@ public class ApiInvoker {
|
||||
try {
|
||||
if ("List".equals(containerType)) {
|
||||
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
|
||||
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
||||
return response;
|
||||
return (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
||||
} else if (String.class.equals(cls)) {
|
||||
if (json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) {
|
||||
return json.substring(1, json.length() - 2);
|
||||
|
||||
@@ -28,8 +28,7 @@ public class ApiInvoker {
|
||||
try {
|
||||
if ("List".equals(containerType)) {
|
||||
JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls);
|
||||
List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
||||
return response;
|
||||
return (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo);
|
||||
} else if (String.class.equals(cls)) {
|
||||
if (json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) {
|
||||
return json.substring(1, json.length() - 2);
|
||||
|
||||
@@ -22,7 +22,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
ApiInfo apiInfo() {
|
||||
ApiInfo apiInfo = new ApiInfo(
|
||||
return new ApiInfo(
|
||||
"Swagger Petstore",
|
||||
"This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
|
||||
"1.0.0",
|
||||
@@ -30,7 +30,6 @@ public class SwaggerConfig {
|
||||
"apiteam@swagger.io",
|
||||
"Apache 2.0",
|
||||
"http://www.apache.org/licenses/LICENSE-2.0.html" );
|
||||
return apiInfo;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user