Update java play framework samples OAS2 (#286)

* Regenerate play framework examples
* Add 'samples.ci' for manual files and update scripts
This commit is contained in:
Jérémie Bresson
2018-05-03 08:19:59 +02:00
committed by GitHub
parent 9cf185912c
commit 0ba2a9a250
155 changed files with 6808 additions and 5263 deletions

View File

@@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

View File

@@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@@ -10,6 +10,6 @@ public class ApiDocController extends Controller {
}
public Result api() {
return redirect("/assets/lib/swagger-ui/index.html?/url=/assets/swagger.json");
return redirect("/assets/lib/swagger-ui/index.html?/url=/assets/openapi.json");
}
}

View File

@@ -42,18 +42,18 @@ public class PetApiController extends Controller {
@ApiAction
public CompletionStage<Result> addPet() throws Exception {
JsonNode nodebody = request().body().asJson();
Pet body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class);
JsonNode nodepet = request().body().asJson();
Pet pet;
if (nodepet != null) {
pet = mapper.readValue(nodepet.toString(), Pet.class);
if (configuration.getBoolean("useInputBeanValidation")) {
SwaggerUtils.validate(body);
SwaggerUtils.validate(pet);
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'Pet' parameter is required");
}
return CompletableFuture.supplyAsync(() -> {
imp.addPet(body)
imp.addPet(pet)
return ok();
});
}
@@ -145,18 +145,18 @@ public class PetApiController extends Controller {
@ApiAction
public CompletionStage<Result> updatePet() throws Exception {
JsonNode nodebody = request().body().asJson();
Pet body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Pet.class);
JsonNode nodepet = request().body().asJson();
Pet pet;
if (nodepet != null) {
pet = mapper.readValue(nodepet.toString(), Pet.class);
if (configuration.getBoolean("useInputBeanValidation")) {
SwaggerUtils.validate(body);
SwaggerUtils.validate(pet);
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'Pet' parameter is required");
}
return CompletableFuture.supplyAsync(() -> {
imp.updatePet(body)
imp.updatePet(pet)
return ok();
});
}
@@ -168,14 +168,14 @@ public class PetApiController extends Controller {
if (valuename != null) {
name = valuename;
} else {
name = null;
name = "null";
}
String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0];
String status;
if (valuestatus != null) {
status = valuestatus;
} else {
status = null;
status = "null";
}
return CompletableFuture.supplyAsync(() -> {
imp.updatePetWithForm(petId, name, status)
@@ -190,7 +190,7 @@ public class PetApiController extends Controller {
if (valueadditionalMetadata != null) {
additionalMetadata = valueadditionalMetadata;
} else {
additionalMetadata = null;
additionalMetadata = "null";
}
Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file");
CompletionStage<ModelApiResponse> stage = imp.uploadFile(petId, additionalMetadata, file).thenApply(obj -> {

View File

@@ -13,7 +13,7 @@ import javax.validation.constraints.*;
public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override
public void addPet(Pet body) throws Exception {
public void addPet(Pet pet) throws Exception {
//Do your magic!!!
}
@@ -47,7 +47,7 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
}
@Override
public void updatePet(Pet body) throws Exception {
public void updatePet(Pet pet) throws Exception {
//Do your magic!!!
}

View File

@@ -15,7 +15,7 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows")
public interface PetApiControllerImpInterface {
void addPet(Pet body) throws Exception;
void addPet(Pet pet) throws Exception;
void deletePet(Long petId, String apiKey) throws Exception;
@@ -25,7 +25,7 @@ public interface PetApiControllerImpInterface {
CompletionStage<Pet> getPetById(Long petId) throws Exception;
void updatePet(Pet body) throws Exception;
void updatePet(Pet pet) throws Exception;
void updatePetWithForm(Long petId, String name, String status) throws Exception;

View File

@@ -74,17 +74,17 @@ public class StoreApiController extends Controller {
@ApiAction
public CompletionStage<Result> placeOrder() throws Exception {
JsonNode nodebody = request().body().asJson();
Order body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), Order.class);
JsonNode nodeorder = request().body().asJson();
Order order;
if (nodeorder != null) {
order = mapper.readValue(nodeorder.toString(), Order.class);
if (configuration.getBoolean("useInputBeanValidation")) {
SwaggerUtils.validate(body);
SwaggerUtils.validate(order);
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'Order' parameter is required");
}
CompletionStage<Order> stage = imp.placeOrder(body).thenApply(obj -> {
CompletionStage<Order> stage = imp.placeOrder(order).thenApply(obj -> {
if (configuration.getBoolean("useOutputBeanValidation")) {
SwaggerUtils.validate(obj);
}

View File

@@ -33,7 +33,7 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
}
@Override
public CompletionStage<Order> placeOrder(Order body) throws Exception {
public CompletionStage<Order> placeOrder(Order order) throws Exception {
//Do your magic!!!
return CompletableFuture.supplyAsync(() -> {
return new Order();

View File

@@ -20,6 +20,6 @@ public interface StoreApiControllerImpInterface {
CompletionStage<Order> getOrderById( @Min(1) @Max(5)Long orderId) throws Exception;
CompletionStage<Order> placeOrder(Order body) throws Exception;
CompletionStage<Order> placeOrder(Order order) throws Exception;
}

View File

@@ -41,58 +41,58 @@ public class UserApiController extends Controller {
@ApiAction
public CompletionStage<Result> createUser() throws Exception {
JsonNode nodebody = request().body().asJson();
User body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class);
JsonNode nodeuser = request().body().asJson();
User user;
if (nodeuser != null) {
user = mapper.readValue(nodeuser.toString(), User.class);
if (configuration.getBoolean("useInputBeanValidation")) {
SwaggerUtils.validate(body);
SwaggerUtils.validate(user);
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'User' parameter is required");
}
return CompletableFuture.supplyAsync(() -> {
imp.createUser(body)
imp.createUser(user)
return ok();
});
}
@ApiAction
public CompletionStage<Result> createUsersWithArrayInput() throws Exception {
JsonNode nodebody = request().body().asJson();
List<User> body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
JsonNode nodeuser = request().body().asJson();
List<User> user;
if (nodeuser != null) {
user = mapper.readValue(nodeuser.toString(), new TypeReference<List<User>>(){});
if (configuration.getBoolean("useInputBeanValidation")) {
for (User curItem : body) {
for (User curItem : user) {
SwaggerUtils.validate(curItem);
}
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'User' parameter is required");
}
return CompletableFuture.supplyAsync(() -> {
imp.createUsersWithArrayInput(body)
imp.createUsersWithArrayInput(user)
return ok();
});
}
@ApiAction
public CompletionStage<Result> createUsersWithListInput() throws Exception {
JsonNode nodebody = request().body().asJson();
List<User> body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
JsonNode nodeuser = request().body().asJson();
List<User> user;
if (nodeuser != null) {
user = mapper.readValue(nodeuser.toString(), new TypeReference<List<User>>(){});
if (configuration.getBoolean("useInputBeanValidation")) {
for (User curItem : body) {
for (User curItem : user) {
SwaggerUtils.validate(curItem);
}
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'User' parameter is required");
}
return CompletableFuture.supplyAsync(() -> {
imp.createUsersWithListInput(body)
imp.createUsersWithListInput(user)
return ok();
});
}
@@ -154,18 +154,18 @@ public class UserApiController extends Controller {
@ApiAction
public CompletionStage<Result> updateUser(String username) throws Exception {
JsonNode nodebody = request().body().asJson();
User body;
if (nodebody != null) {
body = mapper.readValue(nodebody.toString(), User.class);
JsonNode nodeuser = request().body().asJson();
User user;
if (nodeuser != null) {
user = mapper.readValue(nodeuser.toString(), User.class);
if (configuration.getBoolean("useInputBeanValidation")) {
SwaggerUtils.validate(body);
SwaggerUtils.validate(user);
}
} else {
throw new IllegalArgumentException("'body' parameter is required");
throw new IllegalArgumentException("'User' parameter is required");
}
return CompletableFuture.supplyAsync(() -> {
imp.updateUser(username, body)
imp.updateUser(username, user)
return ok();
});
}

View File

@@ -12,17 +12,17 @@ import javax.validation.constraints.*;
public class UserApiControllerImp implements UserApiControllerImpInterface {
@Override
public void createUser(User body) throws Exception {
public void createUser(User user) throws Exception {
//Do your magic!!!
}
@Override
public void createUsersWithArrayInput(List<User> body) throws Exception {
public void createUsersWithArrayInput(List<User> user) throws Exception {
//Do your magic!!!
}
@Override
public void createUsersWithListInput(List<User> body) throws Exception {
public void createUsersWithListInput(List<User> user) throws Exception {
//Do your magic!!!
}
@@ -53,7 +53,7 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
}
@Override
public void updateUser(String username, User body) throws Exception {
public void updateUser(String username, User user) throws Exception {
//Do your magic!!!
}

View File

@@ -14,11 +14,11 @@ import javax.validation.constraints.*;
@SuppressWarnings("RedundantThrows")
public interface UserApiControllerImpInterface {
void createUser(User body) throws Exception;
void createUser(User user) throws Exception;
void createUsersWithArrayInput(List<User> body) throws Exception;
void createUsersWithArrayInput(List<User> user) throws Exception;
void createUsersWithListInput(List<User> body) throws Exception;
void createUsersWithListInput(List<User> user) throws Exception;
void deleteUser(String username) throws Exception;
@@ -28,6 +28,6 @@ public interface UserApiControllerImpInterface {
void logoutUser() throws Exception;
void updateUser(String username, User body) throws Exception;
void updateUser(String username, User user) throws Exception;
}

View File

@@ -1,4 +1,4 @@
name := """swagger-java-playframework"""
name := """openapi-java-playframework"""
version := "1.0-SNAPSHOT"