forked from loafle/openapi-generator-original
[Play Framework] Regenerate the samples. It was very outdated (#3760)
* Generate the samples for Play Framework. It was very outdated * Add java-play-framework to the ensure-up-to-date script * Update samples
This commit is contained in:
committed by
GitHub
parent
e1116814c4
commit
f94ff32b0c
@@ -11,10 +11,10 @@ import java.util.Objects;
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||
public class Category {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
private String name;
|
||||
|
||||
public Category id(Long id) {
|
||||
this.id = id;
|
||||
|
||||
@@ -11,13 +11,13 @@ import java.util.Objects;
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||
public class ModelApiResponse {
|
||||
@JsonProperty("code")
|
||||
private Integer code = null;
|
||||
private Integer code;
|
||||
|
||||
@JsonProperty("type")
|
||||
private String type = null;
|
||||
private String type;
|
||||
|
||||
@JsonProperty("message")
|
||||
private String message = null;
|
||||
private String message;
|
||||
|
||||
public ModelApiResponse code(Integer code) {
|
||||
this.code = code;
|
||||
|
||||
@@ -12,16 +12,16 @@ import java.util.Objects;
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||
public class Order {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("petId")
|
||||
private Long petId = null;
|
||||
private Long petId;
|
||||
|
||||
@JsonProperty("quantity")
|
||||
private Integer quantity = null;
|
||||
private Integer quantity;
|
||||
|
||||
@JsonProperty("shipDate")
|
||||
private OffsetDateTime shipDate = null;
|
||||
private OffsetDateTime shipDate;
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
@@ -46,18 +46,18 @@ public class Order {
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static StatusEnum fromValue(String text) {
|
||||
public static StatusEnum fromValue(String value) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@JsonProperty("status")
|
||||
private StatusEnum status = null;
|
||||
private StatusEnum status;
|
||||
|
||||
@JsonProperty("complete")
|
||||
private Boolean complete = false;
|
||||
|
||||
@@ -15,13 +15,13 @@ import java.util.Objects;
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||
public class Pet {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("category")
|
||||
private Category category = null;
|
||||
private Category category;
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
private String name;
|
||||
|
||||
@JsonProperty("photoUrls")
|
||||
private List<String> photoUrls = new ArrayList<>();
|
||||
@@ -52,18 +52,18 @@ public class Pet {
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static StatusEnum fromValue(String text) {
|
||||
public static StatusEnum fromValue(String value) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@JsonProperty("status")
|
||||
private StatusEnum status = null;
|
||||
private StatusEnum status;
|
||||
|
||||
public Pet id(Long id) {
|
||||
this.id = id;
|
||||
|
||||
@@ -11,10 +11,10 @@ import java.util.Objects;
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||
public class Tag {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("name")
|
||||
private String name = null;
|
||||
private String name;
|
||||
|
||||
public Tag id(Long id) {
|
||||
this.id = id;
|
||||
|
||||
@@ -11,28 +11,28 @@ import java.util.Objects;
|
||||
@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
|
||||
public class User {
|
||||
@JsonProperty("id")
|
||||
private Long id = null;
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("username")
|
||||
private String username = null;
|
||||
private String username;
|
||||
|
||||
@JsonProperty("firstName")
|
||||
private String firstName = null;
|
||||
private String firstName;
|
||||
|
||||
@JsonProperty("lastName")
|
||||
private String lastName = null;
|
||||
private String lastName;
|
||||
|
||||
@JsonProperty("email")
|
||||
private String email = null;
|
||||
private String email;
|
||||
|
||||
@JsonProperty("password")
|
||||
private String password = null;
|
||||
private String password;
|
||||
|
||||
@JsonProperty("phone")
|
||||
private String phone = null;
|
||||
private String phone;
|
||||
|
||||
@JsonProperty("userStatus")
|
||||
private Integer userStatus = null;
|
||||
private Integer userStatus;
|
||||
|
||||
public User id(Long id) {
|
||||
this.id = id;
|
||||
|
||||
@@ -35,14 +35,14 @@ public class PetApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result addPet() throws Exception {
|
||||
JsonNode nodepet = request().body().asJson();
|
||||
Pet pet;
|
||||
if (nodepet != null) {
|
||||
pet = mapper.readValue(nodepet.toString(), Pet.class);
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'Pet' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.addPet(pet);
|
||||
imp.addPet(body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@@ -106,14 +106,14 @@ public class PetApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result updatePet() throws Exception {
|
||||
JsonNode nodepet = request().body().asJson();
|
||||
Pet pet;
|
||||
if (nodepet != null) {
|
||||
pet = mapper.readValue(nodepet.toString(), Pet.class);
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
Pet body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Pet.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'Pet' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updatePet(pet);
|
||||
imp.updatePet(body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@@ -124,14 +124,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;
|
||||
}
|
||||
imp.updatePetWithForm(petId, name, status);
|
||||
return ok();
|
||||
@@ -144,7 +144,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");
|
||||
ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file);
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.io.FileInputStream;
|
||||
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public void addPet(Pet pet) throws Exception {
|
||||
public void addPet(Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePet(Pet pet) throws Exception {
|
||||
public void updatePet(Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface PetApiControllerImpInterface {
|
||||
void addPet(Pet pet) throws Exception;
|
||||
void addPet(Pet body) throws Exception;
|
||||
|
||||
void deletePet(Long petId, String apiKey) throws Exception;
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface PetApiControllerImpInterface {
|
||||
|
||||
Pet getPetById(Long petId) throws Exception;
|
||||
|
||||
void updatePet(Pet pet) throws Exception;
|
||||
void updatePet(Pet body) throws Exception;
|
||||
|
||||
void updatePetWithForm(Long petId, String name, String status) throws Exception;
|
||||
|
||||
|
||||
@@ -54,14 +54,14 @@ public class StoreApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result placeOrder() throws Exception {
|
||||
JsonNode nodeorder = request().body().asJson();
|
||||
Order order;
|
||||
if (nodeorder != null) {
|
||||
order = mapper.readValue(nodeorder.toString(), Order.class);
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
Order body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), Order.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'Order' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
Order obj = imp.placeOrder(order);
|
||||
Order obj = imp.placeOrder(body);
|
||||
JsonNode result = mapper.valueToTree(obj);
|
||||
return ok(result);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order order) throws Exception {
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public interface StoreApiControllerImpInterface {
|
||||
|
||||
Order getOrderById(Long orderId) throws Exception;
|
||||
|
||||
Order placeOrder(Order order) throws Exception;
|
||||
Order placeOrder(Order body) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -34,40 +34,40 @@ public class UserApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result createUser() throws Exception {
|
||||
JsonNode nodeuser = request().body().asJson();
|
||||
User user;
|
||||
if (nodeuser != null) {
|
||||
user = mapper.readValue(nodeuser.toString(), User.class);
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'User' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUser(user);
|
||||
imp.createUser(body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithArrayInput() throws Exception {
|
||||
JsonNode nodeuser = request().body().asJson();
|
||||
List<User> user;
|
||||
if (nodeuser != null) {
|
||||
user = mapper.readValue(nodeuser.toString(), new TypeReference<List<User>>(){});
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
} else {
|
||||
throw new IllegalArgumentException("'User' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithArrayInput(user);
|
||||
imp.createUsersWithArrayInput(body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@ApiAction
|
||||
public Result createUsersWithListInput() throws Exception {
|
||||
JsonNode nodeuser = request().body().asJson();
|
||||
List<User> user;
|
||||
if (nodeuser != null) {
|
||||
user = mapper.readValue(nodeuser.toString(), new TypeReference<List<User>>(){});
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
List<User> body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), new TypeReference<List<User>>(){});
|
||||
} else {
|
||||
throw new IllegalArgumentException("'User' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.createUsersWithListInput(user);
|
||||
imp.createUsersWithListInput(body);
|
||||
return ok();
|
||||
}
|
||||
|
||||
@@ -113,14 +113,14 @@ public class UserApiController extends Controller {
|
||||
|
||||
@ApiAction
|
||||
public Result updateUser(String username) throws Exception {
|
||||
JsonNode nodeuser = request().body().asJson();
|
||||
User user;
|
||||
if (nodeuser != null) {
|
||||
user = mapper.readValue(nodeuser.toString(), User.class);
|
||||
JsonNode nodebody = request().body().asJson();
|
||||
User body;
|
||||
if (nodebody != null) {
|
||||
body = mapper.readValue(nodebody.toString(), User.class);
|
||||
} else {
|
||||
throw new IllegalArgumentException("'User' parameter is required");
|
||||
throw new IllegalArgumentException("'body' parameter is required");
|
||||
}
|
||||
imp.updateUser(username, user);
|
||||
imp.updateUser(username, body);
|
||||
return ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,17 +11,17 @@ import java.io.FileInputStream;
|
||||
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public void createUser(User user) throws Exception {
|
||||
public void createUser(User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithArrayInput(List<User> user) throws Exception {
|
||||
public void createUsersWithArrayInput(List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUsersWithListInput(List<User> user) throws Exception {
|
||||
public void createUsersWithListInput(List<User> body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUser(String username, User user) throws Exception {
|
||||
public void updateUser(String username, User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("RedundantThrows")
|
||||
public interface UserApiControllerImpInterface {
|
||||
void createUser(User user) throws Exception;
|
||||
void createUser(User body) throws Exception;
|
||||
|
||||
void createUsersWithArrayInput(List<User> user) throws Exception;
|
||||
void createUsersWithArrayInput(List<User> body) throws Exception;
|
||||
|
||||
void createUsersWithListInput(List<User> user) throws Exception;
|
||||
void createUsersWithListInput(List<User> body) throws Exception;
|
||||
|
||||
void deleteUser(String username) throws Exception;
|
||||
|
||||
@@ -25,6 +25,6 @@ public interface UserApiControllerImpInterface {
|
||||
|
||||
void logoutUser() throws Exception;
|
||||
|
||||
void updateUser(String username, User user) throws Exception;
|
||||
void updateUser(String username, User body) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -79,6 +79,6 @@ public class OpenAPIUtils {
|
||||
}
|
||||
|
||||
public static String formatDatetime(Date date) {
|
||||
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX").format(date);
|
||||
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT).format(date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user