forked from loafle/openapi-generator-original
Update the for play 2.7 (#7398)
* Fix the new package that deal with Configuration (the old one is depecrated) * First version to support Play Framework 2.7 * Fix small problems that prevent compilation of each samples. Now everything is compiling perfectly
This commit is contained in:
committed by
GitHub
parent
684b77166b
commit
09200eb04e
@@ -38,8 +38,8 @@ public class PetApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result addPet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@@ -53,8 +53,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deletePet(Long petId) throws Exception {
|
||||
String valueapiKey = request().getHeader("api_key");
|
||||
public Result deletePet(Http.Request request, Long petId) throws Exception {
|
||||
String valueapiKey = request.header("api_key").get();
|
||||
String apiKey;
|
||||
if (valueapiKey != null) {
|
||||
apiKey = valueapiKey;
|
||||
@@ -65,8 +65,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByStatus() throws Exception {
|
||||
String[] statusArray = request().queryString().get("status");
|
||||
public Result findPetsByStatus(Http.Request request) throws Exception {
|
||||
String[] statusArray = request.queryString().get("status");
|
||||
if (statusArray == null) {
|
||||
throw new IllegalArgumentException("'status' parameter is required");
|
||||
}
|
||||
@@ -82,8 +82,8 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result findPetsByTags() throws Exception {
|
||||
String[] tagsArray = request().queryString().get("tags");
|
||||
public Result findPetsByTags(Http.Request request) throws Exception {
|
||||
String[] tagsArray = request.queryString().get("tags");
|
||||
if (tagsArray == null) {
|
||||
throw new IllegalArgumentException("'tags' parameter is required");
|
||||
}
|
||||
@@ -99,13 +99,13 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getPetById(Long petId) throws Exception {
|
||||
public Result getPetById(Http.Request request, Long petId) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updatePet(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
@@ -119,15 +119,15 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updatePetWithForm(Long petId) throws Exception {
|
||||
String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
public Result updatePetWithForm(Http.Request request, Long petId) throws Exception {
|
||||
String valuename = (request.body().asMultipartFormData().asFormUrlEncoded().get("name"))[0];
|
||||
String name;
|
||||
if (valuename != null) {
|
||||
name = valuename;
|
||||
} else {
|
||||
name = null;
|
||||
}
|
||||
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String valuestatus = (request.body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
|
||||
String status;
|
||||
if (valuestatus != null) {
|
||||
status = valuestatus;
|
||||
@@ -138,15 +138,15 @@ public class PetApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result uploadFile(Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
public Result uploadFile(Http.Request request, Long petId) throws Exception {
|
||||
String valueadditionalMetadata = (request.body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0];
|
||||
String additionalMetadata;
|
||||
if (valueadditionalMetadata != null) {
|
||||
additionalMetadata = valueadditionalMetadata;
|
||||
} else {
|
||||
additionalMetadata = null;
|
||||
}
|
||||
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
|
||||
Http.MultipartFormData.FilePart file = request.body().asMultipartFormData().getFile("file");
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,23 +37,23 @@ public class StoreApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result deleteOrder(String orderId) throws Exception {
|
||||
public Result deleteOrder(Http.Request request, String orderId) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getInventory() throws Exception {
|
||||
public Result getInventory(Http.Request request) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
public Result getOrderById(Http.Request request, @Min(1) @Max(5)Long orderId) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result placeOrder(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
|
||||
@@ -37,8 +37,8 @@ public class UserApiController extends Controller {
|
||||
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUser(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
@@ -52,8 +52,8 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithArrayInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@@ -69,8 +69,8 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result createUsersWithListInput(Http.Request request) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
@@ -86,25 +86,25 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result deleteUser(String username) throws Exception {
|
||||
public Result deleteUser(Http.Request request, String username) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result getUserByName(String username) throws Exception {
|
||||
public Result getUserByName(Http.Request request, String username) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result loginUser() throws Exception {
|
||||
String valueusername = request().getQueryString("username");
|
||||
public Result loginUser(Http.Request request) throws Exception {
|
||||
String valueusername = request.getQueryString("username");
|
||||
String username;
|
||||
if (valueusername != null) {
|
||||
username = valueusername;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'username' parameter is required");
|
||||
}
|
||||
String valuepassword = request().getQueryString("password");
|
||||
String valuepassword = request.getQueryString("password");
|
||||
String password;
|
||||
if (valuepassword != null) {
|
||||
password = valuepassword;
|
||||
@@ -115,13 +115,13 @@ public class UserApiController extends Controller {
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result logoutUser() throws Exception {
|
||||
public Result logoutUser(Http.Request request) throws Exception {
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
public Result updateUser(Http.Request request, String username) throws Exception {
|
||||
JsonNode nodebody = request.body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
|
||||
Reference in New Issue
Block a user