diff --git a/bin/java-petstore-pkmst-server.sh b/bin/java-pkmst-petstore-server.sh old mode 100644 new mode 100755 similarity index 63% rename from bin/java-petstore-pkmst-server.sh rename to bin/java-pkmst-petstore-server.sh index 3f95c1f7343..5f4541572d1 --- a/bin/java-petstore-pkmst-server.sh +++ b/bin/java-pkmst-petstore-server.sh @@ -1,34 +1,34 @@ -#!/bin/sh - -SCRIPT="$0" - -while [ -h "$SCRIPT" ] ; do - ls=`ls -ld "$SCRIPT"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - SCRIPT="$link" - else - SCRIPT=`dirname "$SCRIPT"`/"$link" - fi -done - -if [ ! -d "${APP_DIR}" ]; then - APP_DIR=`dirname "$SCRIPT"`/.. - APP_DIR=`cd "${APP_DIR}"; pwd` -fi - -executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" - -if [ ! -f "$executable" ] -then - mvn clean package -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" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/pkmst -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l pkmst -o samples/server/petstore/java-pkmst/ -DhideGenerationTimestamp=true" - -echo "Removing files and folders under samples/server/petstore/java-pkmst/src/main" -rm -rf samples/server/petstore/java-pkmst/src/main -find samples/server/petstore/java-pkmst -maxdepth 1 -type f ! -name "README.md" ! -name "pom.xml" ! -name "mvn_test_jdk8_only.sh" ! -name ".swagger-codegen-ignore" -exec rm {} + -java $JAVA_OPTS -jar $executable $ags +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +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" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l java-pkmst -o samples/server/petstore/java-pkmst/ -DhideGenerationTimestamp=true" + +echo "Removing files and folders under samples/server/petstore/java-pkmst/src/main" +rm -rf samples/server/petstore/java-pkmst/src/main +find samples/server/petstore/java-pkmst/ -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/windows/java-petstore-pkmst-server.bat b/bin/windows/java-pkmst-petstore-server.bat similarity index 60% rename from bin/windows/java-petstore-pkmst-server.bat rename to bin/windows/java-pkmst-petstore-server.bat index a8e6669b943..22590ee1d54 100644 --- a/bin/windows/java-petstore-pkmst-server.bat +++ b/bin/windows/java-pkmst-petstore-server.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l pkmst -o samples\server\petstore\java-pkmst +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l java-pkmst -o samples\server\petstore\java-pkmst -DhideGenerationTimestamp=true -java %JAVA_OPTS% -jar %executable% %ags% \ No newline at end of file +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPKMSTServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPKMSTServerCodegen.java index bf682626edb..5c2ffb16f8c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPKMSTServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPKMSTServerCodegen.java @@ -117,7 +117,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen { } public String getName() { - return "pkmst"; + return "java-pkmst"; } public String getHelp() { diff --git a/samples/server/petstore/java-pkmst/Readme.md b/samples/server/petstore/java-pkmst/Readme.md index 27d8199c6f7..be2d523d66a 100644 --- a/samples/server/petstore/java-pkmst/Readme.md +++ b/samples/server/petstore/java-pkmst/Readme.md @@ -1,142 +1,23 @@ -Dear Reader : Thanks for selecting PKMST swagger code generation toolkit for starting your microservice journey. -We believe the hard work we put into this framework will help you kick start your journey sooner and you will find it -easy to scale your service to enterprise grade. Another great thing is you don't need to enable all capabilities as you start, -but can enable as your microservice capabilities needs to be extended to meet strict enterprise standards. +# Swagger Jersey generated server -PKMST feature set. -a)Read the Swagger supplied and will create a maven project -b)Create basic controller based on rest verb and path configured in swagger -c)generate default unit test cose using junit -d)generate all needed dependency needed to run the microservice on local -e)generate a default manifest file that allows you to push code to cloudfoundry instance ( eg pcf , ibm bluemix etc) +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the +[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a swagger-enabled JAX-RS server. -As you mature your knowledge with pkmst, you can leverage vendor extensions feature that will allow you to supply specific configuration -in your swagger and generate respective configuration that will -f)Allow you integrate with registry server (Example Eureka) -g)Allow you to integrate with tracing server (Example Zipkin) -h)Allow you to capture log in your microservice and send to Log management server (Ex ELK or splunk) -i)Allow you to configure Oauth2 security based authorization for your microservice +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. - Additonal Features - j)generate sample cucumber file and dependency to drive your Behaviour driven development. - k)generate gatling based perfromance test , which can be excuted via build pipeline like jenkins etc. - - -Working: -Using swagger specification you can convert any definition to spring boot microservice. -It has the integration with the below services: -eureka registry, zipkin , spring boot admin, circuit breaker. +To run the server, please execute the following: -By default only the circuit breaker annotation is enabled. But one has to write the fallback method. The needed dependency for it is also been enabled. To generate the integration and -related configuration for eureka, zipkin, spring boot admin one has two options: +``` +mvn clean package jetty:run +``` -1) When generating from UI one has to provide vendor extensions inside the swagger specification as below: -swagger: "2.0" -info: - description: "This is a sample Product Catalogue Server.\ - \ For this sample, you can use the api key `special-key` to test the authorization\ - \ filters." - version: "1.0.0" - x-codegen: - eurekaUri: "http://localhost:8080" - zipkinUri: "http://localhost:9411" - springBootAdminUri: "http://localhost:8000" - pkmstInterceptor: "true" - -PLease note the vendor extensions are inside the info tag of the swagger specification. All the tags are case sensitive. Once given all the related configuration and the dependency -will be enabled. +You can then view the swagger listing here: -2) When generating from the maven plugin one has to provide configuration inside pom as below: -inside the swagger codegen maven plugin under the configuration section +``` +http://localhost:8008/v2/swagger.json +``` - - product-swagger.yaml - pkmst - ${project.build.directory}/generated-sources - - com.prokarma - product-catalogue - 1.0 - com.prokarma.pkmst - ProductCatalogue - - http://localhost:9411 - http://localhost:4588 - true - - - - The project has three profiles local, dev, dev-config which can be configured accordingly. Once you have provided the uris you can see the necessary configurations generated inside the local and the dev - yml files. dev-config is for the config server if you want to use.(also enable the dependency for the config server inside the pom) - - [Note: one has to run the zipkin, eureka, spring boot admin servers to be able to connect from the app. This project assumes that you have all the servers - up and running.] - - Also provided are the middleware handlers: - -1) traceInterceptor:is an id passed in from client and will be unique with an application context. The id will be passed into the backend and return to the consumer for transaction tracing. - -2) correlationInterceptor:generates a UUID in the first API/service and pass it to all other APIs/services in the call tree for tracking purpose. - -3) rateLimitInterceptor:is a rate limiting handler to limit number of concurrent requests on the server. Once the limit is reached, subsequent requests will be queued for later execution. The size of the queue is configurable. - -4) auditInterceptor: audit logs most important info about request and response into audit.log in JSON format with config file that controls which fields to be logged - -5) bodyInterceptor:s a body parser middleware that is responsible for parsing the content of the request based on Content-Type in the request header. - -To be able to generate the handlers and the necessary configurations one has to provide the pkmstInterceptor key inside the vendor extensions or through -the maven plugin. -Once provided all the handlers are registered in the interceptor registry and can be enabled or disabled through the configuration provided inside -the application yml as below: -interceptor: - enable: - audit: true - body: true - rateLimit: true - traceability: true - correlation: true - -For testing we have placeholders for junit test class, integration test class, cucumber sample -feature file(implement according to your needs), gatling load test. - -Ways to run the project: -1) Normal spring boot application - -2) Using Dockerfile to run in the container: -dockerfile will be generated inside the project by default. Image can be created using docker cli or through the maven plugin - - - - ... - - com.spotify - docker-maven-plugin - VERSION GOES HERE - - example - docker - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - - ... - - - -Use manifest.yml file to push the application to the cloud. - -HttpLogging filter is provided for logging in the request and response. Can be found inside the com.prokarma.pkmst.logging package. -Spring security is also provided to secure the resources. Please modify according to your needs. - -First run: -Import the project in to the eclipse. Run the app as an spring boot application.The project will run on http://localhost:8008 -Swagger ui available on: -http://localhost:8008/swagger-ui.html -If all the configurations have been enabled(depending on the port) below are some of the URls to access: -eureka: http://localhost:8080 -zipkin: http://localhost:9411 +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/samples/server/petstore/java-pkmst/pom.xml b/samples/server/petstore/java-pkmst/pom.xml index bdd77043a36..4fd4ce7106d 100644 --- a/samples/server/petstore/java-pkmst/pom.xml +++ b/samples/server/petstore/java-pkmst/pom.xml @@ -1,416 +1,178 @@ - - - 4.0.0 - com.prokarma - pkmst-microservice - 1.0.0 - jar - pkmst-microservice - Demo project for Spring Boot Microservices - - UTF-8 - UTF-8 - 1.8 - 1.5.6.RELEASE - 1.2.5 - 1.2.5 - 3.10.0 - 2.6.1-SNAPSHOT - 2.6.0 - 1.7.25 - 4.11 - 1.2.3 - 1.2.3 - 2.3.0 - 2.2.4 - 3.2.2 - Camden.SR7 - 1.1.3.RELEASE - - - org.springframework.boot - spring-boot-starter-parent - 1.5.6.RELEASE - - - - - - oss-snapshots - JFrog OSS Snapshots - https://oss.jfrog.org/simple/oss-snapshot-local/ - - true - - - - central - Maven Repository Switchboard - default - http://repo1.maven.org/maven2 - - false - - - - jitpack.io - https://jitpack.io - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.security.oauth - spring-security-oauth2 - - - org.assertj - assertj-core - - - - - - - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-jetty - - - - org.springframework.cloud - spring-cloud-starter-hystrix-dashboard - - - org.springframework - spring-jdbc - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-test - test - - - com.netflix.hystrix - hystrix-javanica - 1.4.1 - - - org.apache.commons - commons-lang3 - 3.4 - - - commons-logging - commons-logging - 1.2 - - - - info.cukes - cucumber-junit - ${cucumber-junit.version} - - - info.cukes - cucumber-java - ${cucumber-java.version} - - - info.cukes - cucumber-spring - ${cucumber-java.version} - - - net.masterthought - cucumber-reporting - ${cucumber-reporting.version} - - - com.github.tomakehurst - wiremock - 1.46 - test - - - io.springfox - springfox-swagger2 - ${springfox-swagger2} - - - io.springfox - springfox-swagger-ui - ${springfox-swagger-ui} - - - org.slf4j - slf4j-api - ${slf4j-api} - - - net.logstash.logback - logstash-logback-encoder - ${logstash-logback-encoder} - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - org.springframework.boot - spring-boot-starter-remote-shell - - - org.jolokia - jolokia-core - - - - io.gatling.highcharts - gatling-charts-highcharts - ${gatling.version} - test - - - com.typesafe - config - 1.3.1 - - - com.jayway.restassured - rest-assured - 2.9.0 - - - org.springframework - spring-test - - - org.threeten - threetenbp - 1.3.6 - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - development - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - - **/*CucumberTest*.java - - **/cucumber/*.java - - - - - - net.alchim31.maven - scala-maven-plugin - ${scala-maven-plugin.version} - - - - - org.springframework.boot - spring-boot-maven-plugin - - ${project.name} - - - - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - - - - org.apache.maven.plugins - maven-site-plugin - 3.5.1 - - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.17 - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.19.1 - - - org.apache.maven.plugins - maven-pmd-plugin - - - - - - - - - cucumber-tests - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.19.1 - - - none - - - - Test.java - - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.springframework.cloud - spring-cloud-contract-maven-plugin - [1.0.1.RELEASE,) - - convert - generateTests - - - - - - - - - - - - - + + 4.0.0 + com.prokarma + pkmst-microservice + jar + pkmst-microservice + 1.0.0 + + + + Unlicense + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + src/main/java + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty-version} + + + / + + target/${project.artifactId}-${project.version} + 8079 + stopit + 10 + + 8008 + 60000 + + + + + start-jetty + pre-integration-test + + start + + + 0 + true + + + + stop-jetty + post-integration-test + + stop + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + io.swagger + swagger-jersey2-jaxrs + compile + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + + + javax.servlet + servlet-api + ${servlet-api-version} + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey2-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey2-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + + + + com.brsanthu + migbase64 + 2.2 + + + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.8 + ${java.version} + ${java.version} + 1.5.15 + 9.2.9.v20150224 + 2.22.2 + 2.8.9 + 4.12 + 1.1.7 + 2.5 + UTF-8 + diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java index 125678b28b1..c9c28e200ab 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApi.java @@ -1,153 +1,210 @@ -/** - * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ package com.prokarma.pkmst.controller; +import com.prokarma.pkmst.model.*; +import com.prokarma.pkmst.controller.PetApiService; +import com.prokarma.pkmst.controller.factories.PetApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + import java.io.File; import com.prokarma.pkmst.model.ModelApiResponse; import com.prokarma.pkmst.model.Pet; -import io.swagger.annotations.*; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; - +import java.util.Map; import java.util.List; -/** - * Provides the info about api methods - * @author pkmst - * - */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") +import com.prokarma.pkmst.controller.NotFoundException; -@Api(value = "Pet", description = "the Pet API") -public interface PetApi { +import java.io.InputStream; - @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/Pet") + + +@io.swagger.annotations.Api(description = "the Pet API") + +public class PetApi { + private final PetApiService delegate; + + public PetApi(@Context ServletConfig servletContext) { + PetApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("PetApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (PetApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = PetApiServiceFactory.getPetApi(); + } + + this.delegate = delegate; + } + + @POST + @Path("/pet") + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = .class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping(value = "/pet", - produces = { "application/xml", "application/json" }, - consumes = { "application/json", "application/xml" }, - method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = .class) }) + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.addPet(body,securityContext); + } + @DELETE + @Path("/pet/{petId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = .class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid pet value") }) - @RequestMapping(value = "/pet/{petId}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = .class) }) + public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId +,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deletePet(petId,apiKey,securityContext); + } + @GET + @Path("/pet/findByStatus") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - @ApiResponse(code = 400, message = "Invalid status value") }) - @RequestMapping(value = "/pet/findByStatus", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = .class) }) + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByStatus(status,securityContext); + } + @GET + @Path("/pet/findByTags") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), - @ApiResponse(code = 400, message = "Invalid tag value") }) - @RequestMapping(value = "/pet/findByTags", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { - @Authorization(value = "api_key") + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = .class) }) + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.findPetsByTags(tags,securityContext); + } + @GET + @Path("/pet/{petId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @io.swagger.annotations.Authorization(value = "api_key") }, 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") }) - @RequestMapping(value = "/pet/{petId}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = .class) }) + public Response getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getPetById(petId,securityContext); + } + @PUT + @Path("/pet") + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = .class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Pet not found"), - @ApiResponse(code = 405, message = "Validation exception") }) - @RequestMapping(value = "/pet", - produces = { "application/xml", "application/json" }, - consumes = { "application/json", "application/xml" }, - method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = .class), + + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = .class) }) + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePet(body,securityContext); + } + @POST + @Path("/pet/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = .class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping(value = "/pet/{petId}", - produces = { "application/xml", "application/json" }, - consumes = { "application/x-www-form-urlencoded" }, - method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = .class) }) + public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId +,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updatePetWithForm(petId,name,status,securityContext); + } + @POST + @Path("/pet/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) }, tags={ "pet", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) - @RequestMapping(value = "/pet/{petId}/uploadImage", - produces = { "application/json" }, - consumes = { "multipart/form-data" }, - method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId +,@ApiParam(value = "Additional data to pass to server") @FormParam("additionalMetadata") String additionalMetadata +, + @FormDataParam("file") InputStream fileInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail,securityContext); + } } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java index c8f9f82e9e6..a0474838c01 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/PetApiController.java @@ -25,7 +25,6 @@ import java.io.IOException; * @author pkmst * */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") @Controller public class PetApiController implements PetApi { @@ -35,20 +34,24 @@ public class PetApiController implements PetApi { this.objectMapper = objectMapper; } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body, + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, + public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId +, + @ApiParam(value = "" )@HeaderParam("api_key") String apiKey +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, + public ResponseEntity> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -64,7 +67,8 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, + public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -80,7 +84,8 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -96,23 +101,32 @@ public class PetApiController implements PetApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body, + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, + public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId +, + @ApiParam(value = "Updated name of the pet") @FormParam("name") String name +, + @ApiParam(value = "Updated status of the pet") @FormParam("status") String status +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, + public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId +, + @ApiParam(value = "Additional data to pass to server") @FormParam("additionalMetadata") String additionalMetadata +, + + @FormDataParam("file") InputStream fileInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java index e457b0778a3..20f8221aa13 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApi.java @@ -1,75 +1,114 @@ -/** - * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ package com.prokarma.pkmst.controller; +import com.prokarma.pkmst.model.*; +import com.prokarma.pkmst.controller.StoreApiService; +import com.prokarma.pkmst.controller.factories.StoreApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + import java.util.Map; import com.prokarma.pkmst.model.Order; -import io.swagger.annotations.*; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; - +import java.util.Map; import java.util.List; -/** - * Provides the info about api methods - * @author pkmst - * - */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") +import com.prokarma.pkmst.controller.NotFoundException; -@Api(value = "Store", description = "the Store API") -public interface StoreApi { +import java.io.InputStream; - @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class, tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping(value = "/store/order/{orderId}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/Store") - @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { - @Authorization(value = "api_key") +@io.swagger.annotations.Api(description = "the Store API") + +public class StoreApi { + private final StoreApiService delegate; + + public StoreApi(@Context ServletConfig servletContext) { + StoreApiService delegate = null; + + if (servletContext != null) { + String implClass = servletContext.getInitParameter("StoreApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (StoreApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + if (delegate == null) { + delegate = StoreApiServiceFactory.getStoreApi(); + } + + this.delegate = delegate; + } + + @DELETE + @Path("/store/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = .class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = .class) }) + public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteOrder(orderId,securityContext); + } + @GET + @Path("/store/inventory") + + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @io.swagger.annotations.Authorization(value = "api_key") }, tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) - @RequestMapping(value = "/store/inventory", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) - @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") }) - @RequestMapping(value = "/store/order/{orderId}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = Order.class), - @ApiResponse(code = 400, message = "Invalid Order") }) - @RequestMapping(value = "/store/order", - produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + public Response getInventory(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getInventory(securityContext); + } + @GET + @Path("/store/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = .class) }) + public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getOrderById(orderId,securityContext); + } + @POST + @Path("/store/order") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = .class) }) + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.placeOrder(body,securityContext); + } } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java index a34a38ce418..4f281f9b089 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/StoreApiController.java @@ -24,7 +24,6 @@ import java.io.IOException; * @author pkmst * */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") @Controller public class StoreApiController implements StoreApi { @@ -34,7 +33,8 @@ public class StoreApiController implements StoreApi { this.objectMapper = objectMapper; } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId, + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -50,7 +50,8 @@ public class StoreApiController implements StoreApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, + public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -66,7 +67,8 @@ public class StoreApiController implements StoreApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body, + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java index 4f591a67307..37f6aa0a3dd 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApi.java @@ -1,110 +1,164 @@ -/** - * NOTE: This class is auto generated by the swagger code generator program (2.3.0-SNAPSHOT). - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ package com.prokarma.pkmst.controller; +import com.prokarma.pkmst.model.*; +import com.prokarma.pkmst.controller.UserApiService; +import com.prokarma.pkmst.controller.factories.UserApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + import java.util.List; import com.prokarma.pkmst.model.User; -import io.swagger.annotations.*; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; - +import java.util.Map; import java.util.List; -/** - * Provides the info about api methods - * @author pkmst - * - */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") +import com.prokarma.pkmst.controller.NotFoundException; -@Api(value = "User", description = "the User API") -public interface UserApi { +import java.io.InputStream; - @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/user", - produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.servlet.ServletConfig; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/User") - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/user/createWithArray", - produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; +@io.swagger.annotations.Api(description = "the User API") +public class UserApi { + private final UserApiService delegate; - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/user/createWithList", - produces = { "application/xml", "application/json" }, - method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + public UserApi(@Context ServletConfig servletContext) { + UserApiService delegate = null; + if (servletContext != null) { + String implClass = servletContext.getInitParameter("UserApi.implementation"); + if (implClass != null && !"".equals(implClass.trim())) { + try { + delegate = (UserApiService) Class.forName(implClass).newInstance(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } - @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid username supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/user/{username}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; + if (delegate == null) { + delegate = UserApiServiceFactory.getUserApi(); + } + this.delegate = delegate; + } - @ApiOperation(value = "Get user by user name", notes = "", response = User.class, 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") }) - @RequestMapping(value = "/user/{username}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation", response = String.class), - @ApiResponse(code = 400, message = "Invalid username/password supplied") }) - @RequestMapping(value = "/user/login", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username,@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/user/logout", - produces = { "application/xml", "application/json" }, - method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - - - @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid user supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/user/{username}", - produces = { "application/xml", "application/json" }, - method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception; - + @POST + @Path("/user") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = .class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = .class) }) + public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUser(body,securityContext); + } + @POST + @Path("/user/createWithArray") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = .class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = .class) }) + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUsersWithArrayInput(body,securityContext); + } + @POST + @Path("/user/createWithList") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = .class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = .class) }) + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.createUsersWithListInput(body,securityContext); + } + @DELETE + @Path("/user/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = .class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = .class) }) + public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.deleteUser(username,securityContext); + } + @GET + @Path("/user/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = .class) }) + public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathParam("username") String username +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.getUserByName(username,securityContext); + } + @GET + @Path("/user/login") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = .class) }) + public Response loginUser(@ApiParam(value = "The user name for login",required=true) @QueryParam("username") String username +,@ApiParam(value = "The password for login in clear text",required=true) @QueryParam("password") String password +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.loginUser(username,password,securityContext); + } + @GET + @Path("/user/logout") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = .class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = .class) }) + public Response logoutUser(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.logoutUser(securityContext); + } + @PUT + @Path("/user/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = .class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = .class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = .class) }) + public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username +,@ApiParam(value = "Updated user object" ,required=true) User body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.updateUser(username,body,securityContext); + } } diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java index 65c45ee62ab..cb9a70cdc55 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/controller/UserApiController.java @@ -24,7 +24,6 @@ import java.io.IOException; * @author pkmst * */ -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") @Controller public class UserApiController implements UserApi { @@ -34,31 +33,36 @@ public class UserApiController implements UserApi { this.objectMapper = objectMapper; } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body, + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true) User body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body, + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body, + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathParam("username") String username +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -74,8 +78,10 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, + public ResponseEntity loginUser(@ApiParam(value = "The user name for login",required=true) @QueryParam("username") String username +, + @ApiParam(value = "The password for login in clear text",required=true) @QueryParam("password") String password +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -96,8 +102,10 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body, + public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username +, + @ApiParam(value = "Updated user object" ,required=true) User body +, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/logging/HttpLoggingFilter.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/logging/HttpLoggingFilter.java index ffb1b3e6cb5..d294d3cc258 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/logging/HttpLoggingFilter.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/logging/HttpLoggingFilter.java @@ -28,7 +28,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; - +import java.util.Arrays; import org.apache.commons.io.output.TeeOutputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,7 +80,11 @@ public class HttpLoggingFilter implements Filter { .append(bufferedResponse.getStatus()) .append("] [Response Time(ms):").append(elapsedTime) .append("]"); - log.info(logMessage.toString()); + String [] nonLoggingPaths = {"/v2/api-docs","/swagger-resources","/configuration/security","/swagger-ui.html","/webjars"}; + String urlPath = httpServletRequest.getRequestURL().toString(); + if (! ( Arrays.stream(nonLoggingPaths).parallel().anyMatch(urlPath::contains) )){ + log.info(logMessage.toString()); + } } catch (Throwable a) { log.error(a.getMessage()); a.printStackTrace(); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Category.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Category.java index 2d27297d3de..191ea831bbc 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Category.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Category.java @@ -1,3 +1,16 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + package com.prokarma.pkmst.model; import java.util.Objects; @@ -5,18 +18,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -/** - * Response class to be returned by Api - * @author pkmst - * - */ + /** * A category for a pet */ @ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") - public class Category { @JsonProperty("id") private Long id = null; @@ -29,10 +36,11 @@ public class Category { return this; } - /** + /** * Get id * @return id - **/ + **/ + @JsonProperty("id") @ApiModelProperty(value = "") public Long getId() { return id; @@ -47,10 +55,11 @@ public class Category { return this; } - /** + /** * Get name * @return name - **/ + **/ + @JsonProperty("name") @ApiModelProperty(value = "") public String getName() { return name; @@ -79,6 +88,7 @@ public class Category { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/ModelApiResponse.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/ModelApiResponse.java index 7a2ca9b4c95..c0893db7d98 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/ModelApiResponse.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/ModelApiResponse.java @@ -1,3 +1,16 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + package com.prokarma.pkmst.model; import java.util.Objects; @@ -5,18 +18,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -/** - * Response class to be returned by Api - * @author pkmst - * - */ + /** * Describes the result of uploading an image resource */ @ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") - public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -32,10 +39,11 @@ public class ModelApiResponse { return this; } - /** + /** * Get code * @return code - **/ + **/ + @JsonProperty("code") @ApiModelProperty(value = "") public Integer getCode() { return code; @@ -50,10 +58,11 @@ public class ModelApiResponse { return this; } - /** + /** * Get type * @return type - **/ + **/ + @JsonProperty("type") @ApiModelProperty(value = "") public String getType() { return type; @@ -68,10 +77,11 @@ public class ModelApiResponse { return this; } - /** + /** * Get message * @return message - **/ + **/ + @JsonProperty("message") @ApiModelProperty(value = "") public String getMessage() { return message; @@ -101,6 +111,7 @@ public class ModelApiResponse { return Objects.hash(code, type, message); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java index 70432b68f31..e75ef85fb0d 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Order.java @@ -1,3 +1,16 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + package com.prokarma.pkmst.model; import java.util.Objects; @@ -7,18 +20,12 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; -/** - * Response class to be returned by Api - * @author pkmst - * - */ + /** * An order for a pets from the pet store */ @ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") - public class Order { @JsonProperty("id") private Long id = null; @@ -76,10 +83,11 @@ public class Order { return this; } - /** + /** * Get id * @return id - **/ + **/ + @JsonProperty("id") @ApiModelProperty(value = "") public Long getId() { return id; @@ -94,10 +102,11 @@ public class Order { return this; } - /** + /** * Get petId * @return petId - **/ + **/ + @JsonProperty("petId") @ApiModelProperty(value = "") public Long getPetId() { return petId; @@ -112,10 +121,11 @@ public class Order { return this; } - /** + /** * Get quantity * @return quantity - **/ + **/ + @JsonProperty("quantity") @ApiModelProperty(value = "") public Integer getQuantity() { return quantity; @@ -130,10 +140,11 @@ public class Order { return this; } - /** + /** * Get shipDate * @return shipDate - **/ + **/ + @JsonProperty("shipDate") @ApiModelProperty(value = "") public OffsetDateTime getShipDate() { return shipDate; @@ -148,10 +159,11 @@ public class Order { return this; } - /** + /** * Order Status * @return status - **/ + **/ + @JsonProperty("status") @ApiModelProperty(value = "Order Status") public StatusEnum getStatus() { return status; @@ -166,10 +178,11 @@ public class Order { return this; } - /** + /** * Get complete * @return complete - **/ + **/ + @JsonProperty("complete") @ApiModelProperty(value = "") public Boolean isComplete() { return complete; @@ -202,6 +215,7 @@ public class Order { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java index 9d56722e870..3fa4917306b 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Pet.java @@ -1,3 +1,16 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + package com.prokarma.pkmst.model; import java.util.Objects; @@ -10,18 +23,12 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; -/** - * Response class to be returned by Api - * @author pkmst - * - */ + /** * A pet for sale in the pet store */ @ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") - public class Pet { @JsonProperty("id") private Long id = null; @@ -33,11 +40,9 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList<>(); @JsonProperty("tags") - private List tags = null; /** @@ -81,10 +86,11 @@ public class Pet { return this; } - /** + /** * Get id * @return id - **/ + **/ + @JsonProperty("id") @ApiModelProperty(value = "") public Long getId() { return id; @@ -99,10 +105,11 @@ public class Pet { return this; } - /** + /** * Get category * @return category - **/ + **/ + @JsonProperty("category") @ApiModelProperty(value = "") public Category getCategory() { return category; @@ -117,10 +124,11 @@ public class Pet { return this; } - /** + /** * Get name * @return name - **/ + **/ + @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") public String getName() { return name; @@ -140,10 +148,11 @@ public class Pet { return this; } - /** + /** * Get photoUrls * @return photoUrls - **/ + **/ + @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") public List getPhotoUrls() { return photoUrls; @@ -166,10 +175,11 @@ public class Pet { return this; } - /** + /** * Get tags * @return tags - **/ + **/ + @JsonProperty("tags") @ApiModelProperty(value = "") public List getTags() { return tags; @@ -184,10 +194,11 @@ public class Pet { return this; } - /** + /** * pet status in the store * @return status - **/ + **/ + @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") public StatusEnum getStatus() { return status; @@ -220,6 +231,7 @@ public class Pet { return Objects.hash(id, category, name, photoUrls, tags, status); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Tag.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Tag.java index ae1b34a856f..6a4a3bf6e7e 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Tag.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Tag.java @@ -1,3 +1,16 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + package com.prokarma.pkmst.model; import java.util.Objects; @@ -5,18 +18,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -/** - * Response class to be returned by Api - * @author pkmst - * - */ + /** * A tag for a pet */ @ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") - public class Tag { @JsonProperty("id") private Long id = null; @@ -29,10 +36,11 @@ public class Tag { return this; } - /** + /** * Get id * @return id - **/ + **/ + @JsonProperty("id") @ApiModelProperty(value = "") public Long getId() { return id; @@ -47,10 +55,11 @@ public class Tag { return this; } - /** + /** * Get name * @return name - **/ + **/ + @JsonProperty("name") @ApiModelProperty(value = "") public String getName() { return name; @@ -79,6 +88,7 @@ public class Tag { return Objects.hash(id, name); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/User.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/User.java index 5633f163eb0..58679e01d2a 100644 --- a/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/User.java +++ b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/User.java @@ -1,3 +1,16 @@ +/* + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + package com.prokarma.pkmst.model; import java.util.Objects; @@ -5,18 +18,12 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -/** - * Response class to be returned by Api - * @author pkmst - * - */ + /** * A User who is purchasing from the pet store */ @ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaPKMSTServerCodegen", date = "2017-12-18T14:05:35.281+05:30") - public class User { @JsonProperty("id") private Long id = null; @@ -47,10 +54,11 @@ public class User { return this; } - /** + /** * Get id * @return id - **/ + **/ + @JsonProperty("id") @ApiModelProperty(value = "") public Long getId() { return id; @@ -65,10 +73,11 @@ public class User { return this; } - /** + /** * Get username * @return username - **/ + **/ + @JsonProperty("username") @ApiModelProperty(value = "") public String getUsername() { return username; @@ -83,10 +92,11 @@ public class User { return this; } - /** + /** * Get firstName * @return firstName - **/ + **/ + @JsonProperty("firstName") @ApiModelProperty(value = "") public String getFirstName() { return firstName; @@ -101,10 +111,11 @@ public class User { return this; } - /** + /** * Get lastName * @return lastName - **/ + **/ + @JsonProperty("lastName") @ApiModelProperty(value = "") public String getLastName() { return lastName; @@ -119,10 +130,11 @@ public class User { return this; } - /** + /** * Get email * @return email - **/ + **/ + @JsonProperty("email") @ApiModelProperty(value = "") public String getEmail() { return email; @@ -137,10 +149,11 @@ public class User { return this; } - /** + /** * Get password * @return password - **/ + **/ + @JsonProperty("password") @ApiModelProperty(value = "") public String getPassword() { return password; @@ -155,10 +168,11 @@ public class User { return this; } - /** + /** * Get phone * @return phone - **/ + **/ + @JsonProperty("phone") @ApiModelProperty(value = "") public String getPhone() { return phone; @@ -173,10 +187,11 @@ public class User { return this; } - /** + /** * User Status * @return userStatus - **/ + **/ + @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") public Integer getUserStatus() { return userStatus; @@ -211,6 +226,7 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @Override public String toString() { StringBuilder sb = new StringBuilder();