From bd19111ff0ccdf58a51b4ba9d8d9871818fe3f31 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 19 Dec 2017 22:16:16 +0800 Subject: [PATCH] [Java][PKMST] Move resource folder (#7213) * comment out pkmst test for the time being * move pkmst resource folder --- bin/java-pkmst-petstore-server.sh | 2 +- .../languages/JavaPKMSTServerCodegen.java | 2 +- .../RFC3339DateFormat.mustache | 0 .../SpringBootApplication.mustache | 0 .../{pkmst => java-pkmst}/api.mustache | 0 .../apiController.mustache | 0 .../{pkmst => java-pkmst}/api_test.mustache | 0 .../beanValidation.mustache | 0 .../beanValidationPathParams.mustache | 0 .../beanValidationQueryParams.mustache | 0 .../{pkmst => java-pkmst}/bodyParams.mustache | 0 .../config/appconfig.mustache | 0 .../config/pkmstproperties.mustache | 0 .../swaggerDocumentationConfig.mustache | 0 .../cucumber/cucumber.mustache | 0 .../cucumber/cucumberSteps.mustache | 0 .../cucumber/cucumberTest.mustache | 0 .../cucumber/executeReport.mustache | 0 .../cucumber/package.mustache | 0 .../{pkmst => java-pkmst}/docker.mustache | 0 .../docs/swaggercodegnimage.png | Bin .../{pkmst => java-pkmst}/enumClass.mustache | 0 .../enumOuterClass.mustache | 0 .../exampleReturnTypes.mustache | 0 .../{pkmst => java-pkmst}/formParams.mustache | 0 .../gatling/application.mustache | 0 .../gatling/gatling.mustache | 0 .../gatling/package.mustache | 0 .../gatling/testapi.mustache | 0 .../generatedAnnotation.mustache | 0 .../headerParams.mustache | 0 .../implicitHeader.mustache | 0 .../integration/integrationtest.mustache | 0 .../licenseInfo.mustache | 0 .../logging/httpLoggingFilter.mustache | 0 .../{pkmst => java-pkmst}/logstash.mustache | 0 .../{pkmst => java-pkmst}/manifest.mustache | 0 .../{pkmst => java-pkmst}/model.mustache | 0 .../notFoundException.mustache | 0 .../optionalDataType.mustache | 0 .../{pkmst => java-pkmst}/pathParams.mustache | 0 .../{pkmst => java-pkmst}/pojo.mustache | 0 .../{pkmst => java-pkmst}/pom.mustache | 0 .../queryParams.mustache | 0 .../{pkmst => java-pkmst}/readme.mustache | 0 .../resources/application-dev-config.mustache | 0 .../resources/application-dev.mustache | 0 .../resources/application-local.mustache | 0 .../resources/application.mustache | 0 .../resources/bootstrap.mustache | 0 .../returnTypes.mustache | 0 .../authorizationServerConfiguration.mustache | 0 .../oAuth2SecurityConfiguration.mustache | 0 .../resourceServerConfiguration.mustache | 0 .../testresources/application-test.mustache | 0 .../testresources/application.mustache | 0 .../testresources/bootstrap.mustache | 0 .../typeInfoAnnotation.mustache | 0 .../xmlAnnotation.mustache | 0 pom.xml.circleci | 2 +- samples/server/petstore/java-pkmst/Readme.md | 164 ++++- samples/server/petstore/java-pkmst/pom.xml | 592 ++++++++++++------ .../com/prokarma/pkmst/controller/PetApi.java | 326 ++++------ .../pkmst/controller/PetApiController.java | 41 +- .../prokarma/pkmst/controller/StoreApi.java | 164 ++--- .../pkmst/controller/StoreApiController.java | 9 +- .../prokarma/pkmst/controller/UserApi.java | 239 +++---- .../pkmst/controller/UserApiController.java | 27 +- .../com/prokarma/pkmst/model/Category.java | 31 +- .../pkmst/model/ModelApiResponse.java | 36 +- .../java/com/prokarma/pkmst/model/Order.java | 51 +- .../java/com/prokarma/pkmst/model/Pet.java | 53 +- .../java/com/prokarma/pkmst/model/Tag.java | 31 +- .../java/com/prokarma/pkmst/model/User.java | 61 +- 74 files changed, 971 insertions(+), 860 deletions(-) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/RFC3339DateFormat.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/SpringBootApplication.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/api.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/apiController.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/api_test.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/beanValidation.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/beanValidationPathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/beanValidationQueryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/bodyParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/config/appconfig.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/config/pkmstproperties.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/config/swaggerDocumentationConfig.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/cucumber/cucumber.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/cucumber/cucumberSteps.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/cucumber/cucumberTest.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/cucumber/executeReport.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/cucumber/package.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/docker.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/docs/swaggercodegnimage.png (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/enumClass.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/enumOuterClass.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/exampleReturnTypes.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/formParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/gatling/application.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/gatling/gatling.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/gatling/package.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/gatling/testapi.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/generatedAnnotation.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/headerParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/implicitHeader.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/integration/integrationtest.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/licenseInfo.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/logging/httpLoggingFilter.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/logstash.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/manifest.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/model.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/notFoundException.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/optionalDataType.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/pathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/pojo.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/pom.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/queryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/readme.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/resources/application-dev-config.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/resources/application-dev.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/resources/application-local.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/resources/application.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/resources/bootstrap.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/returnTypes.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/security/authorizationServerConfiguration.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/security/oAuth2SecurityConfiguration.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/security/resourceServerConfiguration.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/testresources/application-test.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/testresources/application.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/testresources/bootstrap.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/typeInfoAnnotation.mustache (100%) rename modules/swagger-codegen/src/main/resources/{pkmst => java-pkmst}/xmlAnnotation.mustache (100%) diff --git a/bin/java-pkmst-petstore-server.sh b/bin/java-pkmst-petstore-server.sh index 5f4541572d..6c25ece35c 100755 --- a/bin/java-pkmst-petstore-server.sh +++ b/bin/java-pkmst-petstore-server.sh @@ -26,7 +26,7 @@ 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" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/java-pkmst -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 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 5c2ffb16f8..bb197056da 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 @@ -65,7 +65,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen { groupId = "com.prokarma"; artifactId = "pkmst-microservice"; artifactVersion = "1.0.0"; - embeddedTemplateDir = templateDir = "pkmst"; + embeddedTemplateDir = templateDir = "java-pkmst"; apiPackage = "com.prokarma.pkmst.controller"; modelPackage = "com.prokarma.pkmst.model"; invokerPackage = "com.prokarma.pkmst.controller"; diff --git a/modules/swagger-codegen/src/main/resources/pkmst/RFC3339DateFormat.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/RFC3339DateFormat.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/RFC3339DateFormat.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/RFC3339DateFormat.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/SpringBootApplication.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/SpringBootApplication.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/SpringBootApplication.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/SpringBootApplication.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/api.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/api.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/api.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/api.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/apiController.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/apiController.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/apiController.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/apiController.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/api_test.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/api_test.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/api_test.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/api_test.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/beanValidation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/beanValidation.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/beanValidation.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/beanValidationPathParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/beanValidationPathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/beanValidationPathParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/beanValidationPathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/beanValidationQueryParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/beanValidationQueryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/beanValidationQueryParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/beanValidationQueryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/bodyParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/bodyParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/bodyParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/config/appconfig.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/config/appconfig.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/config/appconfig.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/config/appconfig.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/config/pkmstproperties.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/config/pkmstproperties.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/config/pkmstproperties.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/config/pkmstproperties.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/config/swaggerDocumentationConfig.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/config/swaggerDocumentationConfig.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/config/swaggerDocumentationConfig.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/config/swaggerDocumentationConfig.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/cucumber/cucumber.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/cucumber.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/cucumber/cucumber.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/cucumber.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/cucumber/cucumberSteps.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/cucumberSteps.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/cucumber/cucumberSteps.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/cucumberSteps.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/cucumber/cucumberTest.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/cucumberTest.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/cucumber/cucumberTest.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/cucumberTest.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/cucumber/executeReport.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/executeReport.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/cucumber/executeReport.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/executeReport.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/cucumber/package.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/package.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/cucumber/package.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/cucumber/package.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/docker.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/docker.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/docker.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/docker.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/docs/swaggercodegnimage.png b/modules/swagger-codegen/src/main/resources/java-pkmst/docs/swaggercodegnimage.png similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/docs/swaggercodegnimage.png rename to modules/swagger-codegen/src/main/resources/java-pkmst/docs/swaggercodegnimage.png diff --git a/modules/swagger-codegen/src/main/resources/pkmst/enumClass.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/enumClass.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/enumClass.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/enumClass.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/enumOuterClass.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/enumOuterClass.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/enumOuterClass.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/exampleReturnTypes.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/exampleReturnTypes.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/exampleReturnTypes.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/exampleReturnTypes.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/formParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/formParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/formParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/formParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/gatling/application.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/gatling/application.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/gatling/application.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/gatling/application.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/gatling/gatling.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/gatling/gatling.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/gatling/gatling.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/gatling/gatling.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/gatling/package.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/gatling/package.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/gatling/package.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/gatling/package.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/gatling/testapi.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/gatling/testapi.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/gatling/testapi.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/gatling/testapi.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/generatedAnnotation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/generatedAnnotation.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/generatedAnnotation.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/headerParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/headerParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/headerParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/headerParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/implicitHeader.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/implicitHeader.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/implicitHeader.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/implicitHeader.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/integration/integrationtest.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/integration/integrationtest.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/integration/integrationtest.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/integration/integrationtest.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/licenseInfo.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/licenseInfo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/licenseInfo.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/licenseInfo.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/logging/httpLoggingFilter.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/logging/httpLoggingFilter.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/logging/httpLoggingFilter.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/logging/httpLoggingFilter.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/logstash.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/logstash.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/logstash.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/logstash.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/manifest.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/manifest.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/manifest.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/manifest.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/model.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/model.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/model.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/model.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/notFoundException.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/notFoundException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/notFoundException.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/notFoundException.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/optionalDataType.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/optionalDataType.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/optionalDataType.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/optionalDataType.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/pathParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/pathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/pathParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/pathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/pojo.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/pojo.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/pojo.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/pojo.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/pom.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/pom.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/pom.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/pom.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/queryParams.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/queryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/queryParams.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/queryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/readme.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/readme.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/readme.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/readme.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/resources/application-dev-config.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/resources/application-dev-config.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/resources/application-dev-config.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/resources/application-dev-config.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/resources/application-dev.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/resources/application-dev.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/resources/application-dev.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/resources/application-dev.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/resources/application-local.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/resources/application-local.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/resources/application-local.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/resources/application-local.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/resources/application.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/resources/application.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/resources/application.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/resources/application.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/resources/bootstrap.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/resources/bootstrap.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/resources/bootstrap.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/resources/bootstrap.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/returnTypes.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/returnTypes.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/returnTypes.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/security/authorizationServerConfiguration.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/security/authorizationServerConfiguration.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/security/authorizationServerConfiguration.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/security/authorizationServerConfiguration.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/security/oAuth2SecurityConfiguration.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/security/oAuth2SecurityConfiguration.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/security/oAuth2SecurityConfiguration.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/security/oAuth2SecurityConfiguration.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/security/resourceServerConfiguration.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/security/resourceServerConfiguration.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/security/resourceServerConfiguration.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/security/resourceServerConfiguration.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/testresources/application-test.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/testresources/application-test.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/testresources/application-test.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/testresources/application-test.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/testresources/application.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/testresources/application.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/testresources/application.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/testresources/application.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/testresources/bootstrap.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/testresources/bootstrap.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/testresources/bootstrap.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/testresources/bootstrap.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/typeInfoAnnotation.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/typeInfoAnnotation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/typeInfoAnnotation.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/typeInfoAnnotation.mustache diff --git a/modules/swagger-codegen/src/main/resources/pkmst/xmlAnnotation.mustache b/modules/swagger-codegen/src/main/resources/java-pkmst/xmlAnnotation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/pkmst/xmlAnnotation.mustache rename to modules/swagger-codegen/src/main/resources/java-pkmst/xmlAnnotation.mustache diff --git a/pom.xml.circleci b/pom.xml.circleci index 4585acb38c..e4f122e62d 100644 --- a/pom.xml.circleci +++ b/pom.xml.circleci @@ -844,7 +844,7 @@ samples/client/petstore/go samples/server/petstore/java-inflector - + samples/server/petstore/java-pkmst samples/server/petstore/java-play-framework samples/server/petstore/undertow samples/server/petstore/jaxrs/jersey1 diff --git a/samples/server/petstore/java-pkmst/Readme.md b/samples/server/petstore/java-pkmst/Readme.md index be2d523d66..38701b4e84 100644 --- a/samples/server/petstore/java-pkmst/Readme.md +++ b/samples/server/petstore/java-pkmst/Readme.md @@ -1,23 +1,155 @@ -# Swagger Jersey generated server +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. -## 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. +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) -This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +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 -To run the server, please execute the following: + 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. -``` -mvn clean package jetty:run -``` +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: -You can then view the swagger listing here: +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. -``` -http://localhost:8008/v2/swagger.json -``` +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 -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 + + 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. + +Logstash: Logstash is a tool to collect, process, and forward events and log messages.Sample Logstash configuration file provided that developer can configure to collect wide variety of data.Logstash can dynamically unify data from disparate sources and normalize the data into destinations of their choice. + +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 + +Please visit below links for more information on PKMST: + +Getting started +https://pkmst-getting-started.mybluemix.net + +Pkmst examples +https://github.com/ProKarma-Inc/pkmst-getting-started-examples + +Pkmst Extensions +https://github.com/ProKarma-Inc/pkmst-extention \ 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 4fd4ce7106..5ca43f8a6f 100644 --- a/samples/server/petstore/java-pkmst/pom.xml +++ b/samples/server/petstore/java-pkmst/pom.xml @@ -1,178 +1,416 @@ - - 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 - + + + 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.6 + + + 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 + + + + + + + + + + + + + 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 c9c28e200a..b1105fa803 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,210 +1,152 @@ +/** + * 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 java.util.Map; +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.List; -import com.prokarma.pkmst.controller.NotFoundException; +/** + * Provides the info about api methods + * @author pkmst + * + */ -import java.io.InputStream; +@Api(value = "Pet", description = "the Pet API") +public interface PetApi { -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") - }) + @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") + }) }, tags={ "pet", }) - @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") - }) + @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") + }) }, tags={ "pet", }) - @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") - }) + @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") + }) }, tags={ "pet", }) - @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") - }) + @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") + }) }, tags={ "pet", }) - @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") + @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") }, tags={ "pet", }) - @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") - }) + @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") + }) }, tags={ "pet", }) - @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") - }) + @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") + }) }, tags={ "pet", }) - @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") - }) + @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") + }) }, tags={ "pet", }) - @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); - } + @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; + } 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 a0474838c0..70f8b68349 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 @@ -34,24 +34,20 @@ 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) Pet body -, + public 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 { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId -, - @ApiParam(value = "" )@HeaderParam("api_key") String apiKey -, + 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, @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") @QueryParam("status") List status -, + 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, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -67,8 +63,7 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags -, + public 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 { // do some magic! @@ -84,8 +79,7 @@ public class PetApiController implements PetApi { return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId -, + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -101,32 +95,23 @@ 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) Pet body -, + public 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 { // do some magic! return new ResponseEntity(HttpStatus.OK); } - 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 -, + 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, @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) @PathParam("petId") Long petId -, - @ApiParam(value = "Additional data to pass to server") @FormParam("additionalMetadata") String additionalMetadata -, - - @FormDataParam("file") InputStream fileInputStream, - @FormDataParam("file") FormDataContentDisposition fileDetail -, + 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, @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 20f8221aa1..3f877e9157 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,114 +1,74 @@ +/** + * 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 java.util.Map; +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.List; -import com.prokarma.pkmst.controller.NotFoundException; +/** + * Provides the info about api methods + * @author pkmst + * + */ -import java.io.InputStream; +@Api(value = "Store", description = "the Store API") +public interface StoreApi { -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 = "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; -@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") + @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") }, tags={ "store", }) - @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); - } + @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; + } 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 4f281f9b08..c2e341735d 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 @@ -33,8 +33,7 @@ public class StoreApiController implements StoreApi { this.objectMapper = objectMapper; } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId -, + public 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 { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -50,8 +49,7 @@ 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) @PathParam("orderId") Long orderId -, + public 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 { // do some magic! @@ -67,8 +65,7 @@ public class StoreApiController implements StoreApi { return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body -, + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody 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 37f6aa0a3d..56a58162c1 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,164 +1,109 @@ +/** + * 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 java.util.Map; +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.List; -import com.prokarma.pkmst.controller.NotFoundException; +/** + * Provides the info about api methods + * @author pkmst + * + */ -import java.io.InputStream; +@Api(value = "User", description = "the User API") +public interface UserApi { -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 = "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; -@io.swagger.annotations.Api(description = "the User API") + @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; -public class UserApi { - private final UserApiService delegate; - public UserApi(@Context ServletConfig servletContext) { - UserApiService delegate = null; + @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; - 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); - } - } - } - if (delegate == null) { - delegate = UserApiServiceFactory.getUserApi(); - } + @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; - this.delegate = delegate; - } - @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); - } + @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; + } 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 cb9a70cdc5..6094aa8afe 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 @@ -33,36 +33,31 @@ public class UserApiController implements UserApi { this.objectMapper = objectMapper; } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true) User body -, + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody 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) List body -, + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody 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) List body -, + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody 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) @PathParam("username") String username -, + public 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 { // 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) @PathParam("username") String username -, + public 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 { // do some magic! @@ -78,10 +73,8 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - 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 -, + 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, @RequestHeader(value = "Accept", required = false) String accept) throws Exception { // do some magic! @@ -102,10 +95,8 @@ public class UserApiController implements UserApi { return new ResponseEntity(HttpStatus.OK); } - 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 -, + 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, @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/model/Category.java b/samples/server/petstore/java-pkmst/src/main/java/com/prokarma/pkmst/model/Category.java index 191ea831bb..5a4e16b8b0 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,16 +1,3 @@ -/* - * 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; @@ -18,12 +5,17 @@ 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") + public class Category { @JsonProperty("id") private Long id = null; @@ -36,11 +28,10 @@ public class Category { return this; } - /** + /** * Get id * @return id - **/ - @JsonProperty("id") + **/ @ApiModelProperty(value = "") public Long getId() { return id; @@ -55,11 +46,10 @@ public class Category { return this; } - /** + /** * Get name * @return name - **/ - @JsonProperty("name") + **/ @ApiModelProperty(value = "") public String getName() { return name; @@ -88,7 +78,6 @@ 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 c0893db7d9..dab9e8a761 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,16 +1,3 @@ -/* - * 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; @@ -18,12 +5,17 @@ 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") + public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -39,11 +31,10 @@ public class ModelApiResponse { return this; } - /** + /** * Get code * @return code - **/ - @JsonProperty("code") + **/ @ApiModelProperty(value = "") public Integer getCode() { return code; @@ -58,11 +49,10 @@ public class ModelApiResponse { return this; } - /** + /** * Get type * @return type - **/ - @JsonProperty("type") + **/ @ApiModelProperty(value = "") public String getType() { return type; @@ -77,11 +67,10 @@ public class ModelApiResponse { return this; } - /** + /** * Get message * @return message - **/ - @JsonProperty("message") + **/ @ApiModelProperty(value = "") public String getMessage() { return message; @@ -111,7 +100,6 @@ 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 e75ef85fb0..b35a9f4352 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,16 +1,3 @@ -/* - * 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; @@ -20,12 +7,17 @@ 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") + public class Order { @JsonProperty("id") private Long id = null; @@ -83,11 +75,10 @@ public class Order { return this; } - /** + /** * Get id * @return id - **/ - @JsonProperty("id") + **/ @ApiModelProperty(value = "") public Long getId() { return id; @@ -102,11 +93,10 @@ public class Order { return this; } - /** + /** * Get petId * @return petId - **/ - @JsonProperty("petId") + **/ @ApiModelProperty(value = "") public Long getPetId() { return petId; @@ -121,11 +111,10 @@ public class Order { return this; } - /** + /** * Get quantity * @return quantity - **/ - @JsonProperty("quantity") + **/ @ApiModelProperty(value = "") public Integer getQuantity() { return quantity; @@ -140,11 +129,10 @@ public class Order { return this; } - /** + /** * Get shipDate * @return shipDate - **/ - @JsonProperty("shipDate") + **/ @ApiModelProperty(value = "") public OffsetDateTime getShipDate() { return shipDate; @@ -159,11 +147,10 @@ public class Order { return this; } - /** + /** * Order Status * @return status - **/ - @JsonProperty("status") + **/ @ApiModelProperty(value = "Order Status") public StatusEnum getStatus() { return status; @@ -178,11 +165,10 @@ public class Order { return this; } - /** + /** * Get complete * @return complete - **/ - @JsonProperty("complete") + **/ @ApiModelProperty(value = "") public Boolean isComplete() { return complete; @@ -215,7 +201,6 @@ 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 3fa4917306..567928272c 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,16 +1,3 @@ -/* - * 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; @@ -23,12 +10,17 @@ 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") + public class Pet { @JsonProperty("id") private Long id = null; @@ -40,9 +32,11 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") + private List tags = null; /** @@ -86,11 +80,10 @@ public class Pet { return this; } - /** + /** * Get id * @return id - **/ - @JsonProperty("id") + **/ @ApiModelProperty(value = "") public Long getId() { return id; @@ -105,11 +98,10 @@ public class Pet { return this; } - /** + /** * Get category * @return category - **/ - @JsonProperty("category") + **/ @ApiModelProperty(value = "") public Category getCategory() { return category; @@ -124,11 +116,10 @@ public class Pet { return this; } - /** + /** * Get name * @return name - **/ - @JsonProperty("name") + **/ @ApiModelProperty(example = "doggie", required = true, value = "") public String getName() { return name; @@ -148,11 +139,10 @@ public class Pet { return this; } - /** + /** * Get photoUrls * @return photoUrls - **/ - @JsonProperty("photoUrls") + **/ @ApiModelProperty(required = true, value = "") public List getPhotoUrls() { return photoUrls; @@ -175,11 +165,10 @@ public class Pet { return this; } - /** + /** * Get tags * @return tags - **/ - @JsonProperty("tags") + **/ @ApiModelProperty(value = "") public List getTags() { return tags; @@ -194,11 +183,10 @@ 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; @@ -231,7 +219,6 @@ 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 6a4a3bf6e7..5b2573d162 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,16 +1,3 @@ -/* - * 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; @@ -18,12 +5,17 @@ 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") + public class Tag { @JsonProperty("id") private Long id = null; @@ -36,11 +28,10 @@ public class Tag { return this; } - /** + /** * Get id * @return id - **/ - @JsonProperty("id") + **/ @ApiModelProperty(value = "") public Long getId() { return id; @@ -55,11 +46,10 @@ public class Tag { return this; } - /** + /** * Get name * @return name - **/ - @JsonProperty("name") + **/ @ApiModelProperty(value = "") public String getName() { return name; @@ -88,7 +78,6 @@ 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 58679e01d2..eb30b733fa 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,16 +1,3 @@ -/* - * 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; @@ -18,12 +5,17 @@ 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") + public class User { @JsonProperty("id") private Long id = null; @@ -54,11 +46,10 @@ public class User { return this; } - /** + /** * Get id * @return id - **/ - @JsonProperty("id") + **/ @ApiModelProperty(value = "") public Long getId() { return id; @@ -73,11 +64,10 @@ public class User { return this; } - /** + /** * Get username * @return username - **/ - @JsonProperty("username") + **/ @ApiModelProperty(value = "") public String getUsername() { return username; @@ -92,11 +82,10 @@ public class User { return this; } - /** + /** * Get firstName * @return firstName - **/ - @JsonProperty("firstName") + **/ @ApiModelProperty(value = "") public String getFirstName() { return firstName; @@ -111,11 +100,10 @@ public class User { return this; } - /** + /** * Get lastName * @return lastName - **/ - @JsonProperty("lastName") + **/ @ApiModelProperty(value = "") public String getLastName() { return lastName; @@ -130,11 +118,10 @@ public class User { return this; } - /** + /** * Get email * @return email - **/ - @JsonProperty("email") + **/ @ApiModelProperty(value = "") public String getEmail() { return email; @@ -149,11 +136,10 @@ public class User { return this; } - /** + /** * Get password * @return password - **/ - @JsonProperty("password") + **/ @ApiModelProperty(value = "") public String getPassword() { return password; @@ -168,11 +154,10 @@ public class User { return this; } - /** + /** * Get phone * @return phone - **/ - @JsonProperty("phone") + **/ @ApiModelProperty(value = "") public String getPhone() { return phone; @@ -187,11 +172,10 @@ public class User { return this; } - /** + /** * User Status * @return userStatus - **/ - @JsonProperty("userStatus") + **/ @ApiModelProperty(value = "User Status") public Integer getUserStatus() { return userStatus; @@ -226,7 +210,6 @@ public class User { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } - @Override public String toString() { StringBuilder sb = new StringBuilder();