From 9b25c0f5291c7043c79e79bff71e421b0d1ad839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Sun, 26 Mar 2017 16:55:55 +0200 Subject: [PATCH 1/3] Update samples for JaxRS/CXF. (#5201) --- .../src/gen/java/io/swagger/api/PetApi.java | 5 +-- .../src/gen/java/io/swagger/api/StoreApi.java | 3 +- .../src/gen/java/io/swagger/api/UserApi.java | 9 +++--- .../src/gen/java/io/swagger/api/PetApi.java | 29 +++++++++++++++-- .../src/gen/java/io/swagger/api/StoreApi.java | 19 +++++++++-- .../src/gen/java/io/swagger/api/UserApi.java | 32 ++++++++++++++++--- .../gen/java/io/swagger/model/Category.java | 4 +-- .../io/swagger/model/ModelApiResponse.java | 6 ++-- .../src/gen/java/io/swagger/model/Order.java | 21 ++++++------ .../src/gen/java/io/swagger/model/Pet.java | 10 +++--- .../src/gen/java/io/swagger/model/Tag.java | 4 +-- .../src/gen/java/io/swagger/model/User.java | 16 +++++----- .../src/gen/java/io/swagger/api/PetApi.java | 29 +++++++++++++++-- .../src/gen/java/io/swagger/api/StoreApi.java | 19 +++++++++-- .../src/gen/java/io/swagger/api/UserApi.java | 32 ++++++++++++++++--- .../gen/java/io/swagger/model/Category.java | 4 +-- .../io/swagger/model/ModelApiResponse.java | 6 ++-- .../src/gen/java/io/swagger/model/Order.java | 21 ++++++------ .../src/gen/java/io/swagger/model/Pet.java | 10 +++--- .../src/gen/java/io/swagger/model/Tag.java | 4 +-- .../src/gen/java/io/swagger/model/User.java | 16 +++++----- 21 files changed, 216 insertions(+), 83 deletions(-) diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java index 68701e28cc2..93a82ed4f6c 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/PetApi.java @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -31,7 +32,7 @@ public interface PetApi { @ApiOperation(value = "Add a new pet to the store", tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) - public void addPet(Pet body); + public void addPet(@Valid Pet body); @DELETE @Path("/pet/{petId}") @@ -78,7 +79,7 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Pet not found"), @ApiResponse(code = 405, message = "Validation exception") }) - public void updatePet(Pet body); + public void updatePet(@Valid Pet body); @POST @Path("/pet/{petId}") diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java index f6f1b34c243..8ddeb8f3dea 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/StoreApi.java @@ -18,6 +18,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -57,6 +58,6 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order") }) - public Order placeOrder(Order body); + public Order placeOrder(@Valid Order body); } diff --git a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java index 172b6938f1d..5588dddf74f 100644 --- a/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/jaxrs-cxf-client/src/gen/java/io/swagger/api/UserApi.java @@ -18,6 +18,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -29,7 +30,7 @@ public interface UserApi { @ApiOperation(value = "Create user", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUser(User body); + public void createUser(@Valid User body); @POST @Path("/user/createWithArray") @@ -37,7 +38,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUsersWithArrayInput(List body); + public void createUsersWithArrayInput(@Valid List body); @POST @Path("/user/createWithList") @@ -45,7 +46,7 @@ public interface UserApi { @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) - public void createUsersWithListInput(List body); + public void createUsersWithListInput(@Valid List body); @DELETE @Path("/user/{username}") @@ -90,6 +91,6 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) - public void updateUser(@PathParam("username") String username, User body); + public void updateUser(@PathParam("username") String username, @Valid User body); } diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java index ede723f3935..f6551d8cc37 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java @@ -15,8 +15,11 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/v2") @Api(value = "/", description = "") @@ -27,30 +30,44 @@ public interface PetApi { @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Add a new pet to the store", tags={ "pet", }) - public void addPet(Pet body); + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) + public void addPet(@Valid Pet body); @DELETE @Path("/pet/{petId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Deletes a pet", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value") }) public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by status", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid status value") }) public List findPetsByStatus(@QueryParam("status") @NotNull List status); @GET @Path("/pet/findByTags") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by tags", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid tag value") }) public List findPetsByTags(@QueryParam("tags") @NotNull List tags); @GET @Path("/pet/{petId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Find pet by ID", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found") }) public Pet getPetById(@PathParam("petId") Long petId); @PUT @@ -58,13 +75,19 @@ public interface PetApi { @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Update an existing pet", tags={ "pet", }) - public void updatePet(Pet body); + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found"), + @ApiResponse(code = 405, message = "Validation exception") }) + public void updatePet(@Valid Pet body); @POST @Path("/pet/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status); @POST @@ -72,6 +95,8 @@ public interface PetApi { @Consumes({ "multipart/form-data" }) @Produces({ "application/json" }) @ApiOperation(value = "uploads an image", tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail); } diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java index 8462b041b30..0b00a353bc1 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java @@ -14,8 +14,11 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/v2") @Api(value = "/", description = "") @@ -25,24 +28,36 @@ public interface StoreApi { @Path("/store/order/{orderId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Delete purchase order by ID", tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) public void deleteOrder(@PathParam("orderId") String orderId); @GET @Path("/store/inventory") @Produces({ "application/json" }) @ApiOperation(value = "Returns pet inventories by status", tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) public Map getInventory(); @GET @Path("/store/order/{orderId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Find purchase order by ID", tags={ "store", }) - public Order getOrderById(@PathParam("orderId") Long orderId); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) + public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId); @POST @Path("/store/order") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Place an order for a pet", tags={ "store" }) - public Order placeOrder(Order body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order") }) + public Order placeOrder(@Valid Order body); } diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java index a6d362e3775..36a62cf2a0a 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java @@ -14,8 +14,11 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/v2") @Api(value = "/", description = "") @@ -25,48 +28,69 @@ public interface UserApi { @Path("/user") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Create user", tags={ "user", }) - public void createUser(User body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUser(@Valid User body); @POST @Path("/user/createWithArray") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) - public void createUsersWithArrayInput(List body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUsersWithArrayInput(@Valid List body); @POST @Path("/user/createWithList") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) - public void createUsersWithListInput(List body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUsersWithListInput(@Valid List body); @DELETE @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Delete user", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) public void deleteUser(@PathParam("username") String username); @GET @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Get user by user name", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) public User getUserByName(@PathParam("username") String username); @GET @Path("/user/login") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs user into the system", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied") }) public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password); @GET @Path("/user/logout") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs out current logged in user session", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) public void logoutUser(); @PUT @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Updated user", tags={ "user" }) - public void updateUser(@PathParam("username") String username, User body); + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied"), + @ApiResponse(code = 404, message = "User not found") }) + public void updateUser(@PathParam("username") String username, @Valid User body); } diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java index deaf2da1115..c6076fb8df8 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java @@ -15,9 +15,9 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A category for a pet") public class Category { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String name = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java index d8074c75102..4877f3ace31 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -15,11 +15,11 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="Describes the result of uploading an image resource") public class ModelApiResponse { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Integer code = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String type = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String message = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java index 18ede7173c2..a5bdf93b6f3 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import java.util.Date; import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; @@ -15,14 +16,14 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="An order for a pets from the pet store") public class Order { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long petId = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Integer quantity = null; - @ApiModelProperty(example = "null", value = "") - private javax.xml.datatype.XMLGregorianCalendar shipDate = null; + @ApiModelProperty(value = "") + private Date shipDate = null; @XmlType(name="StatusEnum") @XmlEnum(String.class) @@ -56,9 +57,9 @@ public enum StatusEnum { } } - @ApiModelProperty(example = "null", value = "Order Status") + @ApiModelProperty(value = "Order Status") private StatusEnum status = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Boolean complete = false; /** @@ -116,15 +117,15 @@ public enum StatusEnum { * Get shipDate * @return shipDate **/ - public javax.xml.datatype.XMLGregorianCalendar getShipDate() { + public Date getShipDate() { return shipDate; } - public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { + public void setShipDate(Date shipDate) { this.shipDate = shipDate; } - public Order shipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { + public Order shipDate(Date shipDate) { this.shipDate = shipDate; return this; } diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java index bb02aa5ea2c..15f9322a95a 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java @@ -19,15 +19,15 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A pet for sale in the pet store") public class Pet { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Category category = null; @ApiModelProperty(example = "doggie", required = true, value = "") private String name = null; - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") private List photoUrls = new ArrayList(); - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private List tags = new ArrayList(); @XmlType(name="StatusEnum") @@ -62,7 +62,7 @@ public enum StatusEnum { } } - @ApiModelProperty(example = "null", value = "pet status in the store") + @ApiModelProperty(value = "pet status in the store") private StatusEnum status = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java index caf601e42cf..a0bfd24470f 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java @@ -15,9 +15,9 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A tag for a pet") public class Tag { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String name = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java index 5cfc2944314..74b908a3aa3 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java @@ -15,21 +15,21 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A User who is purchasing from the pet store") public class User { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String username = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String firstName = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String lastName = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String email = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String password = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String phone = null; - @ApiModelProperty(example = "null", value = "User Status") + @ApiModelProperty(value = "User Status") private Integer userStatus = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java index d42bf02c74f..93a82ed4f6c 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java @@ -15,8 +15,11 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -27,30 +30,44 @@ public interface PetApi { @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Add a new pet to the store", tags={ "pet", }) - public void addPet(Pet body); + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) + public void addPet(@Valid Pet body); @DELETE @Path("/pet/{petId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Deletes a pet", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value") }) public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey); @GET @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by status", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid status value") }) public List findPetsByStatus(@QueryParam("status") @NotNull List status); @GET @Path("/pet/findByTags") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by tags", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + @ApiResponse(code = 400, message = "Invalid tag value") }) public List findPetsByTags(@QueryParam("tags") @NotNull List tags); @GET @Path("/pet/{petId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Find pet by ID", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found") }) public Pet getPetById(@PathParam("petId") Long petId); @PUT @@ -58,13 +75,19 @@ public interface PetApi { @Consumes({ "application/json", "application/xml" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Update an existing pet", tags={ "pet", }) - public void updatePet(Pet body); + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found"), + @ApiResponse(code = 405, message = "Validation exception") }) + public void updatePet(@Valid Pet body); @POST @Path("/pet/{petId}") @Consumes({ "application/x-www-form-urlencoded" }) @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status); @POST @@ -72,6 +95,8 @@ public interface PetApi { @Consumes({ "multipart/form-data" }) @Produces({ "application/json" }) @ApiOperation(value = "uploads an image", tags={ "pet" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail); } diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java index 4a3ffd1020b..8ddeb8f3dea 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java @@ -14,8 +14,11 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -25,24 +28,36 @@ public interface StoreApi { @Path("/store/order/{orderId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Delete purchase order by ID", tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) public void deleteOrder(@PathParam("orderId") String orderId); @GET @Path("/store/inventory") @Produces({ "application/json" }) @ApiOperation(value = "Returns pet inventories by status", tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) public Map getInventory(); @GET @Path("/store/order/{orderId}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Find purchase order by ID", tags={ "store", }) - public Order getOrderById(@PathParam("orderId") Long orderId); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) + public Order getOrderById(@PathParam("orderId") @Min(1) @Max(5) Long orderId); @POST @Path("/store/order") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Place an order for a pet", tags={ "store" }) - public Order placeOrder(Order body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Order.class), + @ApiResponse(code = 400, message = "Invalid Order") }) + public Order placeOrder(@Valid Order body); } diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java index a28cc95b58d..5588dddf74f 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java @@ -14,8 +14,11 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ApiResponse; import io.swagger.jaxrs.PATCH; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/") @Api(value = "/", description = "") @@ -25,48 +28,69 @@ public interface UserApi { @Path("/user") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Create user", tags={ "user", }) - public void createUser(User body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUser(@Valid User body); @POST @Path("/user/createWithArray") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) - public void createUsersWithArrayInput(List body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUsersWithArrayInput(@Valid List body); @POST @Path("/user/createWithList") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Creates list of users with given input array", tags={ "user", }) - public void createUsersWithListInput(List body); + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + public void createUsersWithListInput(@Valid List body); @DELETE @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Delete user", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) public void deleteUser(@PathParam("username") String username); @GET @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Get user by user name", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = User.class), + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) public User getUserByName(@PathParam("username") String username); @GET @Path("/user/login") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs user into the system", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = String.class), + @ApiResponse(code = 400, message = "Invalid username/password supplied") }) public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password); @GET @Path("/user/logout") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs out current logged in user session", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) public void logoutUser(); @PUT @Path("/user/{username}") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Updated user", tags={ "user" }) - public void updateUser(@PathParam("username") String username, User body); + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied"), + @ApiResponse(code = 404, message = "User not found") }) + public void updateUser(@PathParam("username") String username, @Valid User body); } diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java index deaf2da1115..c6076fb8df8 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java @@ -15,9 +15,9 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A category for a pet") public class Category { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String name = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java index d8074c75102..4877f3ace31 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -15,11 +15,11 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="Describes the result of uploading an image resource") public class ModelApiResponse { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Integer code = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String type = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String message = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java index 18ede7173c2..a5bdf93b6f3 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import java.util.Date; import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; @@ -15,14 +16,14 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="An order for a pets from the pet store") public class Order { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long petId = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Integer quantity = null; - @ApiModelProperty(example = "null", value = "") - private javax.xml.datatype.XMLGregorianCalendar shipDate = null; + @ApiModelProperty(value = "") + private Date shipDate = null; @XmlType(name="StatusEnum") @XmlEnum(String.class) @@ -56,9 +57,9 @@ public enum StatusEnum { } } - @ApiModelProperty(example = "null", value = "Order Status") + @ApiModelProperty(value = "Order Status") private StatusEnum status = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Boolean complete = false; /** @@ -116,15 +117,15 @@ public enum StatusEnum { * Get shipDate * @return shipDate **/ - public javax.xml.datatype.XMLGregorianCalendar getShipDate() { + public Date getShipDate() { return shipDate; } - public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { + public void setShipDate(Date shipDate) { this.shipDate = shipDate; } - public Order shipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { + public Order shipDate(Date shipDate) { this.shipDate = shipDate; return this; } diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java index bb02aa5ea2c..15f9322a95a 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java @@ -19,15 +19,15 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A pet for sale in the pet store") public class Pet { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Category category = null; @ApiModelProperty(example = "doggie", required = true, value = "") private String name = null; - @ApiModelProperty(example = "null", required = true, value = "") + @ApiModelProperty(required = true, value = "") private List photoUrls = new ArrayList(); - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private List tags = new ArrayList(); @XmlType(name="StatusEnum") @@ -62,7 +62,7 @@ public enum StatusEnum { } } - @ApiModelProperty(example = "null", value = "pet status in the store") + @ApiModelProperty(value = "pet status in the store") private StatusEnum status = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java index caf601e42cf..a0bfd24470f 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java @@ -15,9 +15,9 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A tag for a pet") public class Tag { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String name = null; /** diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java index 5cfc2944314..74b908a3aa3 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java @@ -15,21 +15,21 @@ import javax.xml.bind.annotation.XmlEnumValue; @ApiModel(description="A User who is purchasing from the pet store") public class User { - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private Long id = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String username = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String firstName = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String lastName = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String email = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String password = null; - @ApiModelProperty(example = "null", value = "") + @ApiModelProperty(value = "") private String phone = null; - @ApiModelProperty(example = "null", value = "User Status") + @ApiModelProperty(value = "User Status") private Integer userStatus = null; /** From c812d81e9afe209191ab26ca48c7e6b229eb7edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Sun, 26 Mar 2017 16:56:34 +0200 Subject: [PATCH 2/3] Issue #3084: remove timestamps from bash samples. (#5192) --- bin/bash-petstore.sh | 2 +- .../src/main/resources/bash/bash-completion.mustache | 4 ++-- .../swagger-codegen/src/main/resources/bash/client.mustache | 4 ++-- .../src/main/resources/bash/zsh-completion.mustache | 4 ++-- samples/client/petstore/bash/_petstore-cli | 1 - samples/client/petstore/bash/petstore-cli | 1 - samples/client/petstore/bash/petstore-cli.bash-completion | 1 - 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/bash-petstore.sh b/bin/bash-petstore.sh index 9988a1157f2..19ee5940f27 100755 --- a/bin/bash-petstore.sh +++ b/bin/bash-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -args="$@ generate -t modules/swagger-codegen/src/main/resources/bash -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l bash -o samples/client/petstore/bash -c modules/swagger-codegen/src/test/resources/2_0/bash-config.json" +args="$@ generate -t modules/swagger-codegen/src/main/resources/bash -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l bash -o samples/client/petstore/bash -c modules/swagger-codegen/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $args diff --git a/modules/swagger-codegen/src/main/resources/bash/bash-completion.mustache b/modules/swagger-codegen/src/main/resources/bash/bash-completion.mustache index 83b907259ad..b0dda47fcaf 100644 --- a/modules/swagger-codegen/src/main/resources/bash/bash-completion.mustache +++ b/modules/swagger-codegen/src/main/resources/bash/bash-completion.mustache @@ -8,8 +8,8 @@ # ! swagger-codegen (https://github.com/swagger-api/swagger-codegen) # ! FROM SWAGGER SPECIFICATION IN JSON. # ! -# ! Generated on: {{generatedDate}} -# ! +{{^hideGenerationTimestamp}}# ! Generated on: {{generatedDate}} +{{/hideGenerationTimestamp}}# ! # ! # ! System wide installation: # ! diff --git a/modules/swagger-codegen/src/main/resources/bash/client.mustache b/modules/swagger-codegen/src/main/resources/bash/client.mustache index 6ed2247b574..bd17edbb3c5 100644 --- a/modules/swagger-codegen/src/main/resources/bash/client.mustache +++ b/modules/swagger-codegen/src/main/resources/bash/client.mustache @@ -8,8 +8,8 @@ # ! swagger-codegen (https://github.com/swagger-api/swagger-codegen) # ! FROM SWAGGER SPECIFICATION IN JSON. # ! -# ! Generated on: {{generatedDate}} -# ! +{{^hideGenerationTimestamp}}# ! Generated on: {{generatedDate}} +{{/hideGenerationTimestamp}}# ! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # diff --git a/modules/swagger-codegen/src/main/resources/bash/zsh-completion.mustache b/modules/swagger-codegen/src/main/resources/bash/zsh-completion.mustache index 064b9a01fe0..3438d9cf57b 100644 --- a/modules/swagger-codegen/src/main/resources/bash/zsh-completion.mustache +++ b/modules/swagger-codegen/src/main/resources/bash/zsh-completion.mustache @@ -10,8 +10,8 @@ # ! # ! Based on: https://github.com/Valodim/zsh-curl-completion/blob/master/_curl # ! -# ! Generated on: {{generatedDate}} -# ! +{{^hideGenerationTimestamp}}# ! Generated on: {{generatedDate}} +{{/hideGenerationTimestamp}}# ! # ! # ! Installation: # ! diff --git a/samples/client/petstore/bash/_petstore-cli b/samples/client/petstore/bash/_petstore-cli index 83c205c60d4..829e500ba2a 100644 --- a/samples/client/petstore/bash/_petstore-cli +++ b/samples/client/petstore/bash/_petstore-cli @@ -10,7 +10,6 @@ # ! # ! Based on: https://github.com/Valodim/zsh-curl-completion/blob/master/_curl # ! -# ! Generated on: 2017-02-22T08:48:10.130+01:00 # ! # ! # ! Installation: diff --git a/samples/client/petstore/bash/petstore-cli b/samples/client/petstore/bash/petstore-cli index d967af25bb6..4be94c037dc 100755 --- a/samples/client/petstore/bash/petstore-cli +++ b/samples/client/petstore/bash/petstore-cli @@ -8,7 +8,6 @@ # ! swagger-codegen (https://github.com/swagger-api/swagger-codegen) # ! FROM SWAGGER SPECIFICATION IN JSON. # ! -# ! Generated on: 2017-02-22T08:48:10.130+01:00 # ! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/samples/client/petstore/bash/petstore-cli.bash-completion b/samples/client/petstore/bash/petstore-cli.bash-completion index 58e1965d5c6..6b05bd0a97f 100644 --- a/samples/client/petstore/bash/petstore-cli.bash-completion +++ b/samples/client/petstore/bash/petstore-cli.bash-completion @@ -8,7 +8,6 @@ # ! swagger-codegen (https://github.com/swagger-api/swagger-codegen) # ! FROM SWAGGER SPECIFICATION IN JSON. # ! -# ! Generated on: 2017-02-22T08:48:10.130+01:00 # ! # ! # ! System wide installation: From 9b113d5a192e8c9bd5d54cf7b173d93fc715f84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Sun, 26 Mar 2017 17:02:51 +0200 Subject: [PATCH 3/3] Update samples flask connexion (#5203) * Update samples for flaskConnexion-python2. * Update samples for flaskConnexion. --- .../flaskConnexion-python2/.dockerignore | 72 +++++++++++++++++++ .../flaskConnexion-python2/Dockerfile | 16 +++++ .../petstore/flaskConnexion-python2/README.md | 12 ++++ .../swagger_server/swagger/swagger.yaml | 2 +- .../swagger_server/swagger/swagger.yaml | 2 +- 5 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 samples/server/petstore/flaskConnexion-python2/.dockerignore create mode 100644 samples/server/petstore/flaskConnexion-python2/Dockerfile diff --git a/samples/server/petstore/flaskConnexion-python2/.dockerignore b/samples/server/petstore/flaskConnexion-python2/.dockerignore new file mode 100644 index 00000000000..cdd823e64e7 --- /dev/null +++ b/samples/server/petstore/flaskConnexion-python2/.dockerignore @@ -0,0 +1,72 @@ +.travis.yaml +.swagger-codegen-ignore +README.md +tox.ini +git_push.sh +test-requirements.txt +setup.py + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.python-version + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/server/petstore/flaskConnexion-python2/Dockerfile b/samples/server/petstore/flaskConnexion-python2/Dockerfile new file mode 100644 index 00000000000..0ac164fe3fb --- /dev/null +++ b/samples/server/petstore/flaskConnexion-python2/Dockerfile @@ -0,0 +1,16 @@ +FROM python:2-alpine + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +COPY requirements.txt /usr/src/app/ + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /usr/src/app + +EXPOSE 8080 + +ENTRYPOINT ["python"] + +CMD ["-m", "swagger_server"] \ No newline at end of file diff --git a/samples/server/petstore/flaskConnexion-python2/README.md b/samples/server/petstore/flaskConnexion-python2/README.md index 7e38f10f770..99b70d1524b 100644 --- a/samples/server/petstore/flaskConnexion-python2/README.md +++ b/samples/server/petstore/flaskConnexion-python2/README.md @@ -35,3 +35,15 @@ To launch the integration tests, use tox: sudo pip install tox tox ``` + +## Running with Docker + +To run the server on a Docker container, please execute the following from the root directory: + +```bash +# building the image +docker build -t swagger_server . + +# starting up a container +docker run -p 8080:8080 swagger_server +``` \ No newline at end of file diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml b/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml index a12fa87d872..92590b31bc1 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml @@ -108,11 +108,11 @@ paths: type: "array" items: type: "string" - default: "available" enum: - "available" - "pending" - "sold" + default: "available" collectionFormat: "csv" responses: 200: diff --git a/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml b/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml index a12fa87d872..92590b31bc1 100644 --- a/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml +++ b/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml @@ -108,11 +108,11 @@ paths: type: "array" items: type: "string" - default: "available" enum: - "available" - "pending" - "sold" + default: "available" collectionFormat: "csv" responses: 200: