forked from loafle/openapi-generator-original
[Java Play Framework] Remove most warnings + bug fixes (#6275)
* Removals of most of the warnings found by lint * Removals of most of the warnings found by lint (PART 2) * Removals of most of the warnings found by lint (PART 3) * Removals of most of the warnings found by lint (PART 4) * Removals of most of the warnings found by lint (PART 5) * Fix conversion error * Removal of unnecessary import. Other will need more complex login in the generator itself (not in the mustache files) * Add missing imports + fix to the regex. Generation of the samples
This commit is contained in:
committed by
wing328
parent
b0333af8bd
commit
ab28c7c825
@@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import swagger.SwaggerUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@@ -43,9 +43,7 @@ public class PetApiController extends Controller {
|
||||
body.validate();
|
||||
|
||||
imp.addPet(body);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -53,15 +51,13 @@ public class PetApiController extends Controller {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = (String)valueapiKey;
|
||||
apiKey = valueapiKey;
|
||||
|
||||
} else {
|
||||
apiKey = null;
|
||||
}
|
||||
imp.deletePet(petId, apiKey);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -78,8 +74,6 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -96,8 +90,6 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -106,8 +98,6 @@ public class PetApiController extends Controller {
|
||||
obj.validate();
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -119,9 +109,7 @@ public class PetApiController extends Controller {
|
||||
body.validate();
|
||||
|
||||
imp.updatePet(body);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -129,7 +117,7 @@ public class PetApiController extends Controller {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = (String)valuename;
|
||||
name = valuename;
|
||||
|
||||
} else {
|
||||
name = null;
|
||||
@@ -137,15 +125,13 @@ public class PetApiController extends Controller {
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = (String)valuestatus;
|
||||
status = valuestatus;
|
||||
|
||||
} else {
|
||||
status = null;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -153,17 +139,15 @@ public class PetApiController extends Controller {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = (String)valueadditionalMetadata;
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
obj.validate();
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.HashMap;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet body) throws Exception;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import swagger.SwaggerUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@@ -36,9 +36,7 @@ public class StoreApiController extends Controller {
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
imp.deleteOrder(orderId);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -46,8 +44,6 @@ public class StoreApiController extends Controller {
|
||||
Map<String, Integer> obj = imp.getInventory();
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -56,8 +52,6 @@ public class StoreApiController extends Controller {
|
||||
obj.validate();
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -72,7 +66,5 @@ public class StoreApiController extends Controller {
|
||||
obj.validate();
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.HashMap;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface StoreApiControllerImpInterface {
|
||||
void deleteOrder(String orderId) throws Exception;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import swagger.SwaggerUtils;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
@@ -42,9 +42,7 @@ public class UserApiController extends Controller {
|
||||
body.validate();
|
||||
|
||||
imp.createUser(body);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -58,9 +56,7 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
imp.createUsersWithArrayInput(body);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -74,17 +70,13 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
imp.createUsersWithListInput(body);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
imp.deleteUser(username);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -93,8 +85,6 @@ public class UserApiController extends Controller {
|
||||
obj.validate();
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -102,26 +92,22 @@ public class UserApiController extends Controller {
|
||||
String valueusername = request().getQueryString("username");
|
||||
String username;
|
||||
|
||||
username = (String)valueusername;
|
||||
username = valueusername;
|
||||
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String password;
|
||||
|
||||
password = (String)valuepassword;
|
||||
password = valuepassword;
|
||||
|
||||
String obj = imp.loginUser(username, password);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
imp.logoutUser();
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
@@ -133,8 +119,6 @@ public class UserApiController extends Controller {
|
||||
body.validate();
|
||||
|
||||
imp.updateUser(username, body);
|
||||
|
||||
return ok();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.HashMap;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User body) throws Exception;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user