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 5a62059d697..dd1aa609375 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-03-15T16:43:11.743+01:00 # ! # ! # ! Installation: diff --git a/samples/client/petstore/bash/petstore-cli b/samples/client/petstore/bash/petstore-cli index 79c470926f3..69a4f9bd628 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-03-15T16:43:11.743+01:00 # ! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/samples/client/petstore/bash/petstore-cli.bash-completion b/samples/client/petstore/bash/petstore-cli.bash-completion index 0cdb9d6def9..a4c2fd3d580 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-03-15T16:43:11.743+01:00 # ! # ! # ! System wide installation: 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/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/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: 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 aabc894b537..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 @@ -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("/v2") @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/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 b440257ffb1..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 @@ -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("/v2") @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/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 6f3551da6ac..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 @@ -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("/v2") @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-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 68701e28cc2..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 @@ -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/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 f6f1b34c243..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 @@ -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/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 172b6938f1d..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 @@ -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); }