Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Play Framework] Regenerate the samples. It was very outdated #3760

Merged
merged 4 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/utils/ensure-up-to-date
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ declare -a scripts=(
"./bin/dart-flutter-petstore.sh"
"./bin/dart-petstore.sh"
"./bin/dart2-petstore.sh"
"./bin/java-play-framework-petstore-server-all.sh"
#"./bin/elm-petstore-all.sh"
"./bin/meta-codegen.sh"
# OTHERS
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.1-SNAPSHOT
4.1.2-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
@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
Expand All @@ -47,18 +47,18 @@ public String toString() {
}

@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
@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<>();
Expand Down Expand Up @@ -53,18 +53,18 @@ public String toString() {
}

@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ private PetApiController(Configuration configuration, PetApiControllerImpInterfa

@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);
if (configuration.getBoolean("useInputBeanValidation")) {
OpenAPIUtils.validate(pet);
OpenAPIUtils.validate(body);
}
} else {
throw new IllegalArgumentException("'Pet' parameter is required");
throw new IllegalArgumentException("'body' parameter is required");
}
imp.addPet(pet);
imp.addPet(body);
return ok();
}

Expand Down Expand Up @@ -126,17 +126,17 @@ public Result getPetById(Long petId) throws Exception {

@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);
if (configuration.getBoolean("useInputBeanValidation")) {
OpenAPIUtils.validate(pet);
OpenAPIUtils.validate(body);
}
} else {
throw new IllegalArgumentException("'Pet' parameter is required");
throw new IllegalArgumentException("'body' parameter is required");
}
imp.updatePet(pet);
imp.updatePet(body);
return ok();
}

Expand All @@ -147,14 +147,14 @@ public Result updatePetWithForm(Long petId) throws Exception {
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();
Expand All @@ -167,7 +167,7 @@ public Result uploadFile(Long petId) throws Exception {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class PetApiControllerImp implements PetApiControllerImpInterface {
@Override
public void addPet(Pet pet) throws Exception {
public void addPet(Pet body) throws Exception {
//Do your magic!!!
}

Expand Down Expand Up @@ -41,7 +41,7 @@ public Pet getPetById(Long petId) throws Exception {
}

@Override
public void updatePet(Pet pet) throws Exception {
public void updatePet(Pet body) throws Exception {
//Do your magic!!!
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@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;

Expand All @@ -23,7 +23,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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {

@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);
if (configuration.getBoolean("useInputBeanValidation")) {
OpenAPIUtils.validate(order);
OpenAPIUtils.validate(body);
}
} 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);
if (configuration.getBoolean("useOutputBeanValidation")) {
OpenAPIUtils.validate(obj);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception {
}

@Override
public Order placeOrder(Order order) throws Exception {
public Order placeOrder(Order body) throws Exception {
//Do your magic!!!
return new Order();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public interface StoreApiControllerImpInterface {

Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception;

Order placeOrder(Order order) throws Exception;
Order placeOrder(Order body) throws Exception;

}
Loading