From 027ff93ae46415c6d3c478d27a2e64d762a0a4c0 Mon Sep 17 00:00:00 2001 From: cbornet Date: Tue, 14 Jun 2016 17:37:33 +0200 Subject: [PATCH] rename and remove dead code --- bin/spring-mvc-petstore-j8-async-server.sh | 2 +- bin/spring-mvc-petstore-server.sh | 2 +- bin/springboot-petstore-server.sh | 2 +- ...tServerCodegen.java => SpringCodegen.java} | 7 +- .../languages/SpringMVCServerCodegen.java | 269 ------------------ .../api.mustache | 0 .../apiController.mustache | 0 .../apiException.mustache | 0 .../apiOriginFilter.mustache | 0 .../apiResponseMessage.mustache | 0 .../application.properties | 0 .../bodyParams.mustache | 0 .../formParams.mustache | 0 .../generatedAnnotation.mustache | 0 .../headerParams.mustache | 0 .../libraries/spring-boot/README.mustache | 0 .../spring-boot/homeController.mustache | 0 .../libraries/spring-boot/pom.mustache | 0 .../spring-boot/swagger2SpringBoot.mustache | 0 .../libraries/spring-mvc/README.mustache | 0 .../libraries/spring-mvc/pom.mustache | 0 .../swaggerUiConfiguration.mustache | 0 .../spring-mvc/webApplication.mustache | 0 .../spring-mvc/webMvcConfiguration.mustache | 0 .../model.mustache | 0 .../notFoundException.mustache | 0 .../pathParams.mustache | 0 .../project/build.properties | 0 .../project/plugins.sbt | 0 .../queryParams.mustache | 0 .../returnTypes.mustache | 0 .../swaggerDocumentationConfig.mustache | 0 .../resources/JavaSpringMVC/README.mustache | 12 - .../JavaSpringMVC/api-j8-async.mustache | 64 ----- .../main/resources/JavaSpringMVC/api.mustache | 61 ---- .../JavaSpringMVC/apiController.mustache | 61 ---- .../JavaSpringMVC/apiException.mustache | 10 - .../JavaSpringMVC/apiOriginFilter.mustache | 27 -- .../JavaSpringMVC/apiResponseMessage.mustache | 69 ----- .../JavaSpringMVC/bodyParams.mustache | 1 - .../JavaSpringMVC/formParams.mustache | 2 - .../generatedAnnotation.mustache | 1 - .../JavaSpringMVC/headerParams.mustache | 1 - .../resources/JavaSpringMVC/model.mustache | 77 ----- .../JavaSpringMVC/notFoundException.mustache | 10 - .../JavaSpringMVC/pathParams.mustache | 1 - .../JavaSpringMVC/pom-j8-async.mustache | 171 ----------- .../main/resources/JavaSpringMVC/pom.mustache | 130 --------- .../JavaSpringMVC/project/build.properties | 1 - .../JavaSpringMVC/project/plugins.sbt | 9 - .../JavaSpringMVC/queryParams.mustache | 1 - .../JavaSpringMVC/returnTypes.mustache | 1 - .../JavaSpringMVC/swagger.properties | 1 - .../JavaSpringMVC/swaggerConfig.mustache | 43 --- .../swaggerUiConfiguration.mustache | 47 --- .../JavaSpringMVC/webApplication.mustache | 22 -- .../webMvcConfiguration.mustache | 12 - .../services/io.swagger.codegen.CodegenConfig | 3 +- .../SpringMVCServerOptionsProvider.java | 32 --- ...ovider.java => SpringOptionsProvider.java} | 20 +- .../codegen/spring/SpringOptionsTest.java | 68 +++++ .../SpringBootServerOptionsTest.java | 68 ----- .../springmvc/SpringMVCServerOptionsTest.java | 58 ---- .../online/OnlineGeneratorOptionsTest.java | 2 +- 64 files changed, 87 insertions(+), 1281 deletions(-) rename modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/{SpringBootServerCodegen.java => SpringCodegen.java} (96%) delete mode 100644 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/api.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/apiController.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/apiException.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/apiOriginFilter.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/apiResponseMessage.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/application.properties (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/bodyParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/formParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/generatedAnnotation.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/headerParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-boot/README.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-boot/homeController.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-boot/pom.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-boot/swagger2SpringBoot.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-mvc/README.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-mvc/pom.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-mvc/swaggerUiConfiguration.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-mvc/webApplication.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/libraries/spring-mvc/webMvcConfiguration.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/model.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/notFoundException.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/pathParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/project/build.properties (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/project/plugins.sbt (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/queryParams.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/returnTypes.mustache (100%) rename modules/swagger-codegen/src/main/resources/{JavaSpringBoot => JavaSpring}/swaggerDocumentationConfig.mustache (100%) delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/README.mustache delete mode 100755 modules/swagger-codegen/src/main/resources/JavaSpringMVC/api-j8-async.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiException.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiOriginFilter.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiResponseMessage.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/bodyParams.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/formParams.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/model.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/notFoundException.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/pathParams.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/build.properties delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/plugins.sbt delete mode 100755 modules/swagger-codegen/src/main/resources/JavaSpringMVC/queryParams.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/returnTypes.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/swagger.properties delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerUiConfiguration.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/webApplication.mustache delete mode 100644 modules/swagger-codegen/src/main/resources/JavaSpringMVC/webMvcConfiguration.mustache delete mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java rename modules/swagger-codegen/src/test/java/io/swagger/codegen/options/{SpringBootServerOptionsProvider.java => SpringOptionsProvider.java} (53%) create mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/spring/SpringOptionsTest.java delete mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java delete mode 100644 modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh index 75ec92940e6..3d0681f7ee8 100755 --- a/bin/spring-mvc-petstore-j8-async-server.sh +++ b/bin/spring-mvc-petstore-j8-async-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,java8=true,async=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,java8=true,async=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-server.sh b/bin/spring-mvc-petstore-server.sh index 43e3cc0f58b..736688491c5 100755 --- a/bin/spring-mvc-petstore-server.sh +++ b/bin/spring-mvc-petstore-server.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc -DhideGenerationTimestamp=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring --library spring-mvc -o samples/server/petstore/spring-mvc -DhideGenerationTimestamp=true" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh index 195bb033f0b..565e35d53d9 100755 --- a/bin/springboot-petstore-server.sh +++ b/bin/springboot-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/JavaSpringBoot -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring -o samples/server/petstore/springboot -DhideGenerationTimestamp=true" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l spring -o samples/server/petstore/springboot -DhideGenerationTimestamp=true" echo "Removing files and folders under samples/server/petstore/springboot/src/main" rm -rf samples/server/petstore/springboot/src/main diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java similarity index 96% rename from modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java rename to modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java index 6c95c77c1f3..713c01b6266 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringBootServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringCodegen.java @@ -9,7 +9,8 @@ import org.apache.commons.lang3.BooleanUtils; import java.io.File; import java.util.*; -public class SpringBootServerCodegen extends AbstractJavaCodegen { +public class SpringCodegen extends AbstractJavaCodegen { + public static final String DEFAULT_LIBRARY = "spring-boot"; public static final String CONFIG_PACKAGE = "configPackage"; public static final String BASE_PACKAGE = "basePackage"; public static final String INTERFACE_ONLY = "interfaceOnly"; @@ -24,11 +25,11 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen { protected boolean java8 = false; protected boolean async = false; - public SpringBootServerCodegen() { + public SpringCodegen() { super(); outputFolder = "generated-code/javaSpring"; apiTestTemplateFiles.clear(); // TODO: add test template - embeddedTemplateDir = templateDir = "JavaSpringBoot"; + embeddedTemplateDir = templateDir = "JavaSpring"; apiPackage = "io.swagger.api"; modelPackage = "io.swagger.model"; invokerPackage = "io.swagger.api"; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java deleted file mode 100644 index 47c67a4ec6d..00000000000 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java +++ /dev/null @@ -1,269 +0,0 @@ -package io.swagger.codegen.languages; - -import io.swagger.codegen.*; -import io.swagger.models.Operation; -import io.swagger.models.Path; -import io.swagger.models.Swagger; -import java.io.File; -import java.util.*; - -public class SpringMVCServerCodegen extends JavaClientCodegen implements CodegenConfig{ - public static final String CONFIG_PACKAGE = "configPackage"; - protected String title = "Petstore Server"; - protected String configPackage = ""; - protected String templateFileName = "api.mustache"; - - public SpringMVCServerCodegen() { - super(); - outputFolder = "generated-code/javaSpringMVC"; - modelTemplateFiles.put("model.mustache", ".java"); - apiTemplateFiles.put(templateFileName, ".java"); - apiTestTemplateFiles.clear(); // TODO: add test template - embeddedTemplateDir = templateDir = "JavaSpringMVC"; - apiPackage = "io.swagger.api"; - modelPackage = "io.swagger.model"; - configPackage = "io.swagger.configuration"; - invokerPackage = "io.swagger.api"; - artifactId = "swagger-spring-mvc-server"; - dateLibrary = "legacy"; - - additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); - additionalProperties.put(CodegenConstants.GROUP_ID, groupId); - additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId); - additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion); - additionalProperties.put("title", title); - additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); - additionalProperties.put(CONFIG_PACKAGE, configPackage); - - cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); - - supportedLibraries.clear(); - supportedLibraries.put(DEFAULT_LIBRARY, "Default Spring MVC server stub."); - supportedLibraries.put("j8-async", "Use async servlet feature and Java 8's default interface. Generating interface with service " + - "declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service."); - } - - @Override - public CodegenType getTag() { - return CodegenType.SERVER; - } - - @Override - public String getName() { - return "spring-mvc"; - } - - @Override - public String getHelp() { - return "Generates a Java Spring-MVC Server application using the SpringFox integration."; - } - - @Override - public void processOpts() { - super.processOpts(); - - // clear model and api doc template as this codegen - // does not support auto-generated markdown doc at the moment - modelDocTemplateFiles.remove("model_doc.mustache"); - apiDocTemplateFiles.remove("api_doc.mustache"); - - if (additionalProperties.containsKey(CONFIG_PACKAGE)) { - this.setConfigPackage((String) additionalProperties.get(CONFIG_PACKAGE)); - } - - supportingFiles.clear(); - supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); - supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("apiException.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java")); - supportingFiles.add(new SupportingFile("apiOriginFilter.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java")); - supportingFiles.add(new SupportingFile("apiResponseMessage.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java")); - supportingFiles.add(new SupportingFile("notFoundException.mustache", - (sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java")); - - supportingFiles.add(new SupportingFile("swaggerConfig.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerConfig.java")); - supportingFiles.add(new SupportingFile("webApplication.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java")); - supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebMvcConfiguration.java")); - supportingFiles.add(new SupportingFile("swaggerUiConfiguration.mustache", - (sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerUiConfiguration.java")); - supportingFiles.add(new SupportingFile("swagger.properties", - ("src.main.resources").replace(".", java.io.File.separator), "swagger.properties")); - - } - - @Override - public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { - String basePath = resourcePath; - if (basePath.startsWith("/")) { - basePath = basePath.substring(1); - } - int pos = basePath.indexOf("/"); - if (pos > 0) { - basePath = basePath.substring(0, pos); - } - - if (basePath == "") { - basePath = "default"; - } else { - if (co.path.startsWith("/" + basePath)) { - co.path = co.path.substring(("/" + basePath).length()); - } - co.subresourceOperation = !co.path.isEmpty(); - } - List opList = operations.get(basePath); - if (opList == null) { - opList = new ArrayList(); - operations.put(basePath, opList); - } - opList.add(co); - co.baseName = basePath; - } - - @Override - public void preprocessSwagger(Swagger swagger) { - System.out.println("preprocessSwagger"); - if ("/".equals(swagger.getBasePath())) { - swagger.setBasePath(""); - } - - String host = swagger.getHost(); - String port = "8080"; - if (host != null) { - String[] parts = host.split(":"); - if (parts.length > 1) { - port = parts[1]; - } - } - - this.additionalProperties.put("serverPort", port); - if (swagger != null && swagger.getPaths() != null) { - for (String pathname : swagger.getPaths().keySet()) { - Path path = swagger.getPath(pathname); - if (path.getOperations() != null) { - for (Operation operation : path.getOperations()) { - if (operation.getTags() != null) { - List> tags = new ArrayList>(); - for (String tag : operation.getTags()) { - Map value = new HashMap(); - value.put("tag", tag); - value.put("hasMore", "true"); - tags.add(value); - } - if (tags.size() > 0) { - tags.get(tags.size() - 1).remove("hasMore"); - } - if (operation.getTags().size() > 0) { - String tag = operation.getTags().get(0); - operation.setTags(Arrays.asList(tag)); - } - operation.setVendorExtension("x-tags", tags); - } - } - } - } - } - } - - @Override - public Map postProcessOperations(Map objs) { - Map operations = (Map) objs.get("operations"); - if (operations != null) { - List ops = (List) operations.get("operation"); - for (CodegenOperation operation : ops) { - List responses = operation.responses; - if (responses != null) { - for (CodegenResponse resp : responses) { - if ("0".equals(resp.code)) { - resp.code = "200"; - } - } - } - - if (operation.returnType == null) { - operation.returnType = "Void"; - } else if (operation.returnType.startsWith("List")) { - String rt = operation.returnType; - int end = rt.lastIndexOf(">"); - if (end > 0) { - operation.returnType = rt.substring("List<".length(), end).trim(); - operation.returnContainer = "List"; - } - } else if (operation.returnType.startsWith("Map")) { - String rt = operation.returnType; - int end = rt.lastIndexOf(">"); - if (end > 0) { - operation.returnType = rt.substring("Map<".length(), end).split(",")[1].trim(); - operation.returnContainer = "Map"; - } - } else if (operation.returnType.startsWith("Set")) { - String rt = operation.returnType; - int end = rt.lastIndexOf(">"); - if (end > 0) { - operation.returnType = rt.substring("Set<".length(), end).trim(); - operation.returnContainer = "Set"; - } - } - } - } - if("j8-async".equals(getLibrary())) { - apiTemplateFiles.remove(this.templateFileName); - this.templateFileName = "api-j8-async.mustache"; - apiTemplateFiles.put(this.templateFileName, ".java"); - - int originalPomFileIdx = -1; - for (int i = 0; i < supportingFiles.size(); i++) { - if ("pom.xml".equals(supportingFiles.get(i).destinationFilename)) { - originalPomFileIdx = i; - break; - } - } - if (originalPomFileIdx > -1) { - supportingFiles.remove(originalPomFileIdx); - } - supportingFiles.add(new SupportingFile("pom-j8-async.mustache", "", "pom.xml")); - } - - return objs; - } - - @Override - public String toApiName(String name) { - if (name.length() == 0) { - return "DefaultApi"; - } - name = sanitizeName(name); - return camelize(name) + "Api"; - } - - public void setConfigPackage(String configPackage) { - this.configPackage = configPackage; - } - - @Override - public Map postProcessModels(Map objs) { - // remove the import of "Object" to avoid compilation error - List> imports = (List>) objs.get("imports"); - Iterator> iterator = imports.iterator(); - while (iterator.hasNext()) { - String _import = iterator.next().get("import"); - if (_import.endsWith(".Object")) iterator.remove(); - } - List models = (List) objs.get("models"); - for (Object _mo : models) { - Map mo = (Map) _mo; - CodegenModel cm = (CodegenModel) mo.get("model"); - for (CodegenProperty var : cm.vars) { - // handle default value for enum, e.g. available => StatusEnum.available - if (var.isEnum && var.defaultValue != null && !"null".equals(var.defaultValue)) { - var.defaultValue = var.datatypeWithEnum + "." + var.defaultValue; - } - } - } - return objs; - } -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/api.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiController.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiException.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiException.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/apiException.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiOriginFilter.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiOriginFilter.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/apiOriginFilter.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiResponseMessage.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/apiResponseMessage.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/apiResponseMessage.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/application.properties b/modules/swagger-codegen/src/main/resources/JavaSpring/application.properties similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/application.properties rename to modules/swagger-codegen/src/main/resources/JavaSpring/application.properties diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/bodyParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/bodyParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/bodyParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/formParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/formParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/formParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/generatedAnnotation.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/generatedAnnotation.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/generatedAnnotation.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/headerParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/headerParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/headerParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/README.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/homeController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/homeController.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/homeController.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/homeController.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/pom.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/swagger2SpringBoot.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/swagger2SpringBoot.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-boot/swagger2SpringBoot.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-boot/swagger2SpringBoot.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/README.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/README.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/README.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/pom.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/swaggerUiConfiguration.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/swaggerUiConfiguration.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/swaggerUiConfiguration.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webApplication.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/webApplication.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webApplication.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/webApplication.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webMvcConfiguration.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/webMvcConfiguration.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/libraries/spring-mvc/webMvcConfiguration.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/libraries/spring-mvc/webMvcConfiguration.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/model.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/model.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/notFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/notFoundException.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/notFoundException.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/notFoundException.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/pathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/pathParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/pathParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/pathParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/build.properties b/modules/swagger-codegen/src/main/resources/JavaSpring/project/build.properties similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/build.properties rename to modules/swagger-codegen/src/main/resources/JavaSpring/project/build.properties diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/plugins.sbt b/modules/swagger-codegen/src/main/resources/JavaSpring/project/plugins.sbt similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/project/plugins.sbt rename to modules/swagger-codegen/src/main/resources/JavaSpring/project/plugins.sbt diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/queryParams.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/queryParams.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/queryParams.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/returnTypes.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/returnTypes.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/returnTypes.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/swaggerDocumentationConfig.mustache similarity index 100% rename from modules/swagger-codegen/src/main/resources/JavaSpringBoot/swaggerDocumentationConfig.mustache rename to modules/swagger-codegen/src/main/resources/JavaSpring/swaggerDocumentationConfig.mustache diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/README.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/README.mustache deleted file mode 100644 index 1354151afbb..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/README.mustache +++ /dev/null @@ -1,12 +0,0 @@ -# Swagger generated server - -Spring MVC Server - - -## 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), you can easily generate a server stub. This is an example of building a swagger-enabled server in Java using the Spring MVC framework. - -The underlying library integrating swagger to Spring-MVC is [springfox](https://github.com/springfox/springfox) - -You can view the server in swagger-ui by pointing to -http://localhost:8002{{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}/swagger-ui.html \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api-j8-async.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api-j8-async.mustache deleted file mode 100755 index 90cb04104f0..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api-j8-async.mustache +++ /dev/null @@ -1,64 +0,0 @@ -package {{apiPackage}}; - -import {{modelPackage}}.*; - -{{#imports}}import {{import}}; -{{/imports}} - -import java.util.concurrent.Callable; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -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.util.List; - -import static org.springframework.http.MediaType.*; - -@Controller -@RequestMapping(value = "/{{baseName}}", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/{{baseName}}", description = "the {{baseName}} API") -{{>generatedAnnotation}} -{{#operations}} -public interface {{classname}} { - {{#operation}} - - @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { - {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { - {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, - {{/hasMore}}{{/scopes}} - }{{/isOAuth}}){{#hasMore}}, - {{/hasMore}}{{/authMethods}} - }{{/hasAuthMethods}}) - @ApiResponses(value = { {{#responses}} - @ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} }) - @RequestMapping(value = "{{path}}", - {{#hasProduces}}produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} - {{#hasConsumes}}consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} - method = RequestMethod.{{httpMethod}}) - default CallablereturnTypes}}>> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, - {{/hasMore}}{{/allParams}}) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - } - - {{/operation}} -} -{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache deleted file mode 100644 index 7fe7c5acf60..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache +++ /dev/null @@ -1,61 +0,0 @@ -package {{apiPackage}}; - -import {{modelPackage}}.*; - -{{#imports}}import {{import}}; -{{/imports}} - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -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.util.List; - -import static org.springframework.http.MediaType.*; - -@Controller -@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") -{{>generatedAnnotation}} -{{#operations}} -public class {{classname}} { - {{#operation}} - - @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { - {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { - {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, - {{/hasMore}}{{/scopes}} - }{{/isOAuth}}){{#hasMore}}, - {{/hasMore}}{{/authMethods}} - }{{/hasAuthMethods}}) - @io.swagger.annotations.ApiResponses(value = { {{#responses}} - @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) - @RequestMapping(value = "{{{path}}}", - {{#hasProduces}}produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} - {{#hasConsumes}}consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} - method = RequestMethod.{{httpMethod}}) - public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, - {{/hasMore}}{{/allParams}}) - throws NotFoundException { - // do some magic! - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - } - - {{/operation}} -} -{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache deleted file mode 100644 index 7fe7c5acf60..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiController.mustache +++ /dev/null @@ -1,61 +0,0 @@ -package {{apiPackage}}; - -import {{modelPackage}}.*; - -{{#imports}}import {{import}}; -{{/imports}} - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -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.util.List; - -import static org.springframework.http.MediaType.*; - -@Controller -@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") -{{>generatedAnnotation}} -{{#operations}} -public class {{classname}} { - {{#operation}} - - @ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { - {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { - {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, - {{/hasMore}}{{/scopes}} - }{{/isOAuth}}){{#hasMore}}, - {{/hasMore}}{{/authMethods}} - }{{/hasAuthMethods}}) - @io.swagger.annotations.ApiResponses(value = { {{#responses}} - @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) - @RequestMapping(value = "{{{path}}}", - {{#hasProduces}}produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} - {{#hasConsumes}}consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} - method = RequestMethod.{{httpMethod}}) - public ResponseEntity<{{>returnTypes}}> {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, - {{/hasMore}}{{/allParams}}) - throws NotFoundException { - // do some magic! - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - } - - {{/operation}} -} -{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiException.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiException.mustache deleted file mode 100644 index 11b4036b832..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiException.mustache +++ /dev/null @@ -1,10 +0,0 @@ -package {{apiPackage}}; - -{{>generatedAnnotation}} -public class ApiException extends Exception{ - private int code; - public ApiException (int code, String msg) { - super(msg); - this.code = code; - } -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiOriginFilter.mustache deleted file mode 100644 index 5db3301b3d9..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiOriginFilter.mustache +++ /dev/null @@ -1,27 +0,0 @@ -package {{apiPackage}}; - -import java.io.IOException; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; - -{{>generatedAnnotation}} -public class ApiOriginFilter implements javax.servlet.Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - } -} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiResponseMessage.mustache deleted file mode 100644 index 2b9a2b1f8c5..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/apiResponseMessage.mustache +++ /dev/null @@ -1,69 +0,0 @@ -package {{apiPackage}}; - -import javax.xml.bind.annotation.XmlTransient; - -@javax.xml.bind.annotation.XmlRootElement -{{>generatedAnnotation}} -public class ApiResponseMessage { - public static final int ERROR = 1; - public static final int WARNING = 2; - public static final int INFO = 3; - public static final int OK = 4; - public static final int TOO_BUSY = 5; - - int code; - String type; - String message; - - public ApiResponseMessage(){} - - public ApiResponseMessage(int code, String message){ - this.code = code; - switch(code){ - case ERROR: - setType("error"); - break; - case WARNING: - setType("warning"); - break; - case INFO: - setType("info"); - break; - case OK: - setType("ok"); - break; - case TOO_BUSY: - setType("too busy"); - break; - default: - setType("unknown"); - break; - } - this.message = message; - } - - @XmlTransient - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/bodyParams.mustache deleted file mode 100644 index f1137ba7073..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/bodyParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestBody {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/formParams.mustache deleted file mode 100644 index 65e84817a23..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/formParams.mustache +++ /dev/null @@ -1,2 +0,0 @@ -{{#isFormParam}}{{#notFile}} -@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestPart(value="{{paramName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}@ApiParam(value = "file detail") @RequestPart("file") MultipartFile {{baseName}}{{/isFile}}{{/isFormParam}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache deleted file mode 100644 index 49110fc1ad9..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache +++ /dev/null @@ -1 +0,0 @@ -@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache deleted file mode 100644 index 297d5131d92..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/headerParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{{dataType}}} {{paramName}}{{/isHeaderParam}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/model.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/model.mustache deleted file mode 100644 index b39a599ae71..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/model.mustache +++ /dev/null @@ -1,77 +0,0 @@ -package {{package}}; - -{{#imports}}import {{import}}; -{{/imports}} - -import io.swagger.annotations.*; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.Objects; -{{#models}} - -{{#model}}{{#description}} -/** - * {{description}} - **/{{/description}} -@ApiModel(description = "{{{description}}}") -{{>generatedAnnotation}} -public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { - {{#vars}}{{#isEnum}} - public enum {{datatypeWithEnum}} { - {{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}} - }; - {{/isEnum}}{{#items}}{{#isEnum}} - public enum {{datatypeWithEnum}} { - {{#allowableValues}}{{#values}} {{.}}, {{/values}}{{/allowableValues}} - }; - {{/isEnum}}{{/items}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} - - {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - **/ - @ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") - @JsonProperty("{{baseName}}") - public {{{datatypeWithEnum}}} {{getter}}() { - return {{name}}; - } - public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { - this.{{name}} = {{name}}; - } - - {{/vars}} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}} - return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} && - {{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}} - return true;{{/hasVars}} - } - - @Override - public int hashCode() { - return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class {{classname}} {\n"); - {{#parent}}sb.append(" " + super.toString()).append("\n");{{/parent}} - {{#vars}}sb.append(" {{name}}: ").append({{name}}).append("\n"); - {{/vars}}sb.append("}\n"); - return sb.toString(); - } -} -{{/model}} -{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/notFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/notFoundException.mustache deleted file mode 100644 index 1bd5e207d7b..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/notFoundException.mustache +++ /dev/null @@ -1,10 +0,0 @@ -package {{apiPackage}}; - -{{>generatedAnnotation}} -public class NotFoundException extends ApiException { - private int code; - public NotFoundException (int code, String msg) { - super(code, msg); - this.code = code; - } -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pathParams.mustache deleted file mode 100644 index 4a6f7dfc922..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pathParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isPathParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}} {{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathVariable("{{paramName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache deleted file mode 100644 index 95c86d4bc0b..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom-j8-async.mustache +++ /dev/null @@ -1,171 +0,0 @@ - - 4.0.0 - {{groupId}} - {{artifactId}} - jar - {{artifactId}} - {{artifactVersion}} - - src/main/java - - - org.apache.maven.plugins - maven-war-plugin - 2.1.1 - - - maven-failsafe-plugin - 2.6 - - - - integration-test - verify - - - - - - org.eclipse.jetty - jetty-maven-plugin - ${jetty-version} - - - {{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}} - - target/${project.artifactId}-${project.version} - 8079 - stopit - - 8002 - 60000 - - - - - start-jetty - pre-integration-test - - start - - - 0 - true - - - - stop-jetty - post-integration-test - - stop - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - - - - - - - io.swagger - swagger-jersey-jaxrs - ${swagger-core-version} - - - org.slf4j - slf4j-log4j12 - ${slf4j-version} - - - com.sun.jersey - jersey-core - ${jersey-version} - - - com.sun.jersey - jersey-json - ${jersey-version} - - - com.sun.jersey - jersey-servlet - ${jersey-version} - - - com.sun.jersey.contribs - jersey-multipart - ${jersey-version} - - - com.sun.jersey - jersey-server - ${jersey-version} - - - - - org.springframework - spring-core - ${spring-version} - - - org.springframework - spring-webmvc - ${spring-version} - - - org.springframework - spring-web - ${spring-version} - - - - - io.springfox - springfox-swagger2 - ${springfox-version} - - - io.springfox - springfox-swagger-ui - ${springfox-version} - - - - junit - junit - ${junit-version} - test - - - javax.servlet - servlet-api - ${servlet-api-version} - - - - - jcenter-snapshots - jcenter - http://oss.jfrog.org/artifactory/oss-snapshot-local/ - - - - 1.5.8 - 9.2.9.v20150224 - 1.13 - 1.6.3 - 4.8.1 - 2.5 - 2.4.0 - 4.2.5.RELEASE - - \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache deleted file mode 100644 index 9b352e551c5..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/pom.mustache +++ /dev/null @@ -1,130 +0,0 @@ - - 4.0.0 - {{groupId}} - {{artifactId}} - jar - {{artifactId}} - {{artifactVersion}} - - src/main/java - - - org.apache.maven.plugins - maven-war-plugin - 2.6 - - - maven-failsafe-plugin - 2.6 - - - - integration-test - verify - - - - - - org.eclipse.jetty - jetty-maven-plugin - ${jetty-version} - - - {{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}} - - target/${project.artifactId}-${project.version} - 8079 - stopit - - 8002 - 60000 - - - - - start-jetty - pre-integration-test - - start - - - 0 - true - - - - stop-jetty - post-integration-test - - stop - - - - - - - - - io.swagger - swagger-jersey-jaxrs - ${swagger-core-version} - - - org.slf4j - slf4j-log4j12 - ${slf4j-version} - - - - - org.springframework - spring-core - ${spring-version} - - - org.springframework - spring-webmvc - ${spring-version} - - - org.springframework - spring-web - ${spring-version} - - - - - io.springfox - springfox-swagger2 - ${springfox-version} - - - io.springfox - springfox-swagger-ui - ${springfox-version} - - - - junit - junit - ${junit-version} - test - - - javax.servlet - servlet-api - ${servlet-api-version} - - - - 1.5.8 - 9.2.15.v20160210 - 1.13 - 1.7.21 - 4.12 - 2.5 - 2.4.0 - 4.2.5.RELEASE - - diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/build.properties b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/build.properties deleted file mode 100644 index a8c2f849be3..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.12.0 diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/plugins.sbt b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/plugins.sbt deleted file mode 100644 index 713b7f3e993..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/project/plugins.sbt +++ /dev/null @@ -1,9 +0,0 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.4") - -libraryDependencies <+= sbtVersion(v => v match { - case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8" - case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10" - case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11" - case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1" - case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1" -}) \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/queryParams.mustache deleted file mode 100755 index 3bb2afcb6cd..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/queryParams.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{{allowableValues}}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) @RequestParam(value = "{{paramName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isQueryParam}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/returnTypes.mustache deleted file mode 100644 index c8f7a56938a..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/returnTypes.mustache +++ /dev/null @@ -1 +0,0 @@ -{{#returnContainer}}{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swagger.properties b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swagger.properties deleted file mode 100644 index fdbe5371934..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swagger.properties +++ /dev/null @@ -1 +0,0 @@ -springfox.documentation.swagger.v2.path=/api-docs \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache deleted file mode 100644 index 024fe6735ef..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerConfig.mustache +++ /dev/null @@ -1,43 +0,0 @@ -package {{configPackage}}; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.annotation.Import; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Contact; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - - -@Configuration -@ComponentScan(basePackages = "{{apiPackage}}") -@EnableWebMvc -@EnableSwagger2 //Loads the spring beans required by the framework -@PropertySource("classpath:swagger.properties") -@Import(SwaggerUiConfiguration.class) -{{>generatedAnnotation}} -public class SwaggerConfig { - @Bean - ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("{{appName}}") - .description("{{{appDescription}}}") - .license("{{licenseInfo}}") - .licenseUrl("{{licenseUrl}}") - .termsOfServiceUrl("{{infoUrl}}") - .version("{{appVersion}}") - .contact(new Contact("","", "{{infoEmail}}")) - .build(); - } - - @Bean - public Docket customImplementation(){ - return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()); - } - -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerUiConfiguration.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerUiConfiguration.mustache deleted file mode 100644 index 0b515fe2cc8..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/swaggerUiConfiguration.mustache +++ /dev/null @@ -1,47 +0,0 @@ -package {{configPackage}}; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - - -@Configuration -@EnableWebMvc -{{>generatedAnnotation}} -public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { - private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; - - private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { - "classpath:/META-INF/resources/", "classpath:/resources/", - "classpath:/static/", "classpath:/public/" }; - - private static final String[] RESOURCE_LOCATIONS; - static { - RESOURCE_LOCATIONS = new String[CLASSPATH_RESOURCE_LOCATIONS.length - + SERVLET_RESOURCE_LOCATIONS.length]; - System.arraycopy(SERVLET_RESOURCE_LOCATIONS, 0, RESOURCE_LOCATIONS, 0, - SERVLET_RESOURCE_LOCATIONS.length); - System.arraycopy(CLASSPATH_RESOURCE_LOCATIONS, 0, RESOURCE_LOCATIONS, - SERVLET_RESOURCE_LOCATIONS.length, CLASSPATH_RESOURCE_LOCATIONS.length); - } - - private static final String[] STATIC_INDEX_HTML_RESOURCES; - static { - STATIC_INDEX_HTML_RESOURCES = new String[RESOURCE_LOCATIONS.length]; - for (int i = 0; i < STATIC_INDEX_HTML_RESOURCES.length; i++) { - STATIC_INDEX_HTML_RESOURCES[i] = RESOURCE_LOCATIONS[i] + "index.html"; - } - } - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - if (!registry.hasMappingForPattern("/webjars/**")) { - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); - } - if (!registry.hasMappingForPattern("/**")) { - registry.addResourceHandler("/**").addResourceLocations(RESOURCE_LOCATIONS); - } - } - -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/webApplication.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/webApplication.mustache deleted file mode 100644 index 426f831582e..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/webApplication.mustache +++ /dev/null @@ -1,22 +0,0 @@ -package {{configPackage}}; - -import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; - -{{>generatedAnnotation}} -public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { - - @Override - protected Class[] getRootConfigClasses() { - return new Class[] { SwaggerConfig.class }; - } - - @Override - protected Class[] getServletConfigClasses() { - return new Class[] { WebMvcConfiguration.class }; - } - - @Override - protected String[] getServletMappings() { - return new String[] { "/" }; - } -} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/webMvcConfiguration.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/webMvcConfiguration.mustache deleted file mode 100644 index d60c126316e..00000000000 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/webMvcConfiguration.mustache +++ /dev/null @@ -1,12 +0,0 @@ -package {{configPackage}}; - -import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; - -{{>generatedAnnotation}} -public class WebMvcConfiguration extends WebMvcConfigurationSupport { - @Override - public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { - configurer.enable(); - } -} diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index c75af63df84..e5d4f5f1355 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -30,8 +30,7 @@ io.swagger.codegen.languages.SilexServerCodegen io.swagger.codegen.languages.SinatraServerCodegen io.swagger.codegen.languages.Rails5ServerCodegen io.swagger.codegen.languages.SlimFrameworkServerCodegen -io.swagger.codegen.languages.SpringBootServerCodegen -io.swagger.codegen.languages.SpringMVCServerCodegen +io.swagger.codegen.languages.SpringCodegen io.swagger.codegen.languages.StaticDocCodegen io.swagger.codegen.languages.StaticHtmlGenerator io.swagger.codegen.languages.SwaggerGenerator diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java deleted file mode 100644 index 0755b4380f6..00000000000 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringMVCServerOptionsProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.swagger.codegen.options; - -import io.swagger.codegen.CodegenConstants; -import io.swagger.codegen.languages.SpringMVCServerCodegen; - -import java.util.HashMap; -import java.util.Map; - -public class SpringMVCServerOptionsProvider extends JavaOptionsProvider { - public static final String CONFIG_PACKAGE_VALUE = "configPackage"; - public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class - - @Override - public String getLanguage() { - return "spring-mvc"; - } - - @Override - public Map createOptions() { - Map options = new HashMap(super.createOptions()); - options.put(SpringMVCServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE); - options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE); - options.put(SpringMVCServerCodegen.USE_RX_JAVA, "false"); - - return options; - } - - @Override - public boolean isServer() { - return true; - } -} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringOptionsProvider.java similarity index 53% rename from modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java rename to modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringOptionsProvider.java index a4b703d4d07..3d56410f937 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringBootServerOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/SpringOptionsProvider.java @@ -1,15 +1,15 @@ package io.swagger.codegen.options; import io.swagger.codegen.CodegenConstants; -import io.swagger.codegen.languages.SpringBootServerCodegen; +import io.swagger.codegen.languages.SpringCodegen; import java.util.HashMap; import java.util.Map; -public class SpringBootServerOptionsProvider extends JavaOptionsProvider { +public class SpringOptionsProvider extends JavaOptionsProvider { public static final String CONFIG_PACKAGE_VALUE = "configPackage"; public static final String BASE_PACKAGE_VALUE = "basePackage"; - public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class + public static final String LIBRARY_VALUE = "spring-mvc"; //FIXME hidding value from super class public static final String INTERFACE_ONLY = "true"; public static final String SINGLE_CONTENT_TYPES = "true"; public static final String JAVA_8 = "true"; @@ -17,19 +17,19 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider { @Override public String getLanguage() { - return "springboot"; + return "spring"; } @Override public Map createOptions() { Map options = new HashMap(super.createOptions()); - options.put(SpringBootServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE); - options.put(SpringBootServerCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE); + options.put(SpringCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE); + options.put(SpringCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE); options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE); - options.put(SpringBootServerCodegen.INTERFACE_ONLY, INTERFACE_ONLY); - options.put(SpringBootServerCodegen.SINGLE_CONTENT_TYPES, SINGLE_CONTENT_TYPES); - options.put(SpringBootServerCodegen.JAVA_8, JAVA_8); - options.put(SpringBootServerCodegen.ASYNC, ASYNC); + options.put(SpringCodegen.INTERFACE_ONLY, INTERFACE_ONLY); + options.put(SpringCodegen.SINGLE_CONTENT_TYPES, SINGLE_CONTENT_TYPES); + options.put(SpringCodegen.JAVA_8, JAVA_8); + options.put(SpringCodegen.ASYNC, ASYNC); return options; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/spring/SpringOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/spring/SpringOptionsTest.java new file mode 100644 index 00000000000..3693ab6c550 --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/spring/SpringOptionsTest.java @@ -0,0 +1,68 @@ +package io.swagger.codegen.spring; + +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.java.JavaClientOptionsTest; +import io.swagger.codegen.languages.SpringCodegen; +import io.swagger.codegen.options.SpringOptionsProvider; + +import mockit.Expectations; +import mockit.Tested; + +public class SpringOptionsTest extends JavaClientOptionsTest { + + @Tested + private SpringCodegen clientCodegen; + + public SpringOptionsTest() { + super(new SpringOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setModelPackage(SpringOptionsProvider.MODEL_PACKAGE_VALUE); + times = 1; + clientCodegen.setApiPackage(SpringOptionsProvider.API_PACKAGE_VALUE); + times = 1; + clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SpringOptionsProvider.SORT_PARAMS_VALUE)); + times = 1; + clientCodegen.setInvokerPackage(SpringOptionsProvider.INVOKER_PACKAGE_VALUE); + times = 1; + clientCodegen.setGroupId(SpringOptionsProvider.GROUP_ID_VALUE); + times = 1; + clientCodegen.setArtifactId(SpringOptionsProvider.ARTIFACT_ID_VALUE); + times = 1; + clientCodegen.setArtifactVersion(SpringOptionsProvider.ARTIFACT_VERSION_VALUE); + times = 1; + clientCodegen.setSourceFolder(SpringOptionsProvider.SOURCE_FOLDER_VALUE); + times = 1; + clientCodegen.setLocalVariablePrefix(SpringOptionsProvider.LOCAL_PREFIX_VALUE); + times = 1; + clientCodegen.setSerializableModel(Boolean.valueOf(SpringOptionsProvider.SERIALIZABLE_MODEL_VALUE)); + times = 1; + clientCodegen.setLibrary(SpringOptionsProvider.LIBRARY_VALUE); + times = 1; + clientCodegen.setFullJavaUtil(Boolean.valueOf(SpringOptionsProvider.FULL_JAVA_UTIL_VALUE)); + times = 1; + clientCodegen.setConfigPackage(SpringOptionsProvider.CONFIG_PACKAGE_VALUE); + times = 1; + clientCodegen.setBasePackage(SpringOptionsProvider.BASE_PACKAGE_VALUE); + times = 1; + clientCodegen.setInterfaceOnly(Boolean.valueOf(SpringOptionsProvider.INTERFACE_ONLY)); + times = 1; + clientCodegen.setSingleContentTypes(Boolean.valueOf(SpringOptionsProvider.SINGLE_CONTENT_TYPES)); + times = 1; + clientCodegen.setJava8(Boolean.valueOf(SpringOptionsProvider.JAVA_8)); + times = 1; + clientCodegen.setAsync(Boolean.valueOf(SpringOptionsProvider.ASYNC)); + times = 1; + + }}; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java deleted file mode 100644 index 90610924bfa..00000000000 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springboot/SpringBootServerOptionsTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package io.swagger.codegen.springboot; - -import io.swagger.codegen.AbstractOptionsTest; -import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.languages.SpringBootServerCodegen; -import io.swagger.codegen.options.SpringBootServerOptionsProvider; - -import mockit.Expectations; -import mockit.Tested; - -public class SpringBootServerOptionsTest extends AbstractOptionsTest { - - @Tested - private SpringBootServerCodegen clientCodegen; - - public SpringBootServerOptionsTest() { - super(new SpringBootServerOptionsProvider()); - } - - @Override - protected CodegenConfig getCodegenConfig() { - return clientCodegen; - } - - @SuppressWarnings("unused") - @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(SpringBootServerOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(SpringBootServerOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SpringBootServerOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setInvokerPackage(SpringBootServerOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - clientCodegen.setGroupId(SpringBootServerOptionsProvider.GROUP_ID_VALUE); - times = 1; - clientCodegen.setArtifactId(SpringBootServerOptionsProvider.ARTIFACT_ID_VALUE); - times = 1; - clientCodegen.setArtifactVersion(SpringBootServerOptionsProvider.ARTIFACT_VERSION_VALUE); - times = 1; - clientCodegen.setSourceFolder(SpringBootServerOptionsProvider.SOURCE_FOLDER_VALUE); - times = 1; - clientCodegen.setLocalVariablePrefix(SpringBootServerOptionsProvider.LOCAL_PREFIX_VALUE); - times = 1; - clientCodegen.setSerializableModel(Boolean.valueOf(SpringBootServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); - times = 1; - clientCodegen.setLibrary(SpringBootServerOptionsProvider.LIBRARY_VALUE); - times = 1; - clientCodegen.setFullJavaUtil(Boolean.valueOf(SpringBootServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); - times = 1; - clientCodegen.setConfigPackage(SpringBootServerOptionsProvider.CONFIG_PACKAGE_VALUE); - times = 1; - clientCodegen.setBasePackage(SpringBootServerOptionsProvider.BASE_PACKAGE_VALUE); - times = 1; - clientCodegen.setInterfaceOnly(Boolean.valueOf(SpringBootServerOptionsProvider.INTERFACE_ONLY)); - times = 1; - clientCodegen.setSingleContentTypes(Boolean.valueOf(SpringBootServerOptionsProvider.SINGLE_CONTENT_TYPES)); - times = 1; - clientCodegen.setJava8(Boolean.valueOf(SpringBootServerOptionsProvider.JAVA_8)); - times = 1; - clientCodegen.setAsync(Boolean.valueOf(SpringBootServerOptionsProvider.ASYNC)); - times = 1; - - }}; - } -} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java deleted file mode 100644 index c53a4e4941c..00000000000 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/springmvc/SpringMVCServerOptionsTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package io.swagger.codegen.springmvc; - -import io.swagger.codegen.AbstractOptionsTest; -import io.swagger.codegen.CodegenConfig; -import io.swagger.codegen.java.JavaClientOptionsTest; -import io.swagger.codegen.languages.SpringMVCServerCodegen; -import io.swagger.codegen.options.SpringMVCServerOptionsProvider; - -import mockit.Expectations; -import mockit.Tested; - -public class SpringMVCServerOptionsTest extends AbstractOptionsTest { - - @Tested - private SpringMVCServerCodegen clientCodegen; - - public SpringMVCServerOptionsTest() { - super(new SpringMVCServerOptionsProvider()); - } - - @Override - protected CodegenConfig getCodegenConfig() { - return clientCodegen; - } - - @SuppressWarnings("unused") - @Override - protected void setExpectations() { - new Expectations(clientCodegen) {{ - clientCodegen.setModelPackage(SpringMVCServerOptionsProvider.MODEL_PACKAGE_VALUE); - times = 1; - clientCodegen.setApiPackage(SpringMVCServerOptionsProvider.API_PACKAGE_VALUE); - times = 1; - clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SpringMVCServerOptionsProvider.SORT_PARAMS_VALUE)); - times = 1; - clientCodegen.setInvokerPackage(SpringMVCServerOptionsProvider.INVOKER_PACKAGE_VALUE); - times = 1; - clientCodegen.setGroupId(SpringMVCServerOptionsProvider.GROUP_ID_VALUE); - times = 1; - clientCodegen.setArtifactId(SpringMVCServerOptionsProvider.ARTIFACT_ID_VALUE); - times = 1; - clientCodegen.setArtifactVersion(SpringMVCServerOptionsProvider.ARTIFACT_VERSION_VALUE); - times = 1; - clientCodegen.setSourceFolder(SpringMVCServerOptionsProvider.SOURCE_FOLDER_VALUE); - times = 1; - clientCodegen.setLocalVariablePrefix(SpringMVCServerOptionsProvider.LOCAL_PREFIX_VALUE); - times = 1; - clientCodegen.setSerializableModel(Boolean.valueOf(SpringMVCServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); - times = 1; - clientCodegen.setLibrary(SpringMVCServerOptionsProvider.LIBRARY_VALUE); - times = 1; - clientCodegen.setFullJavaUtil(Boolean.valueOf(SpringMVCServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); - times = 1; - clientCodegen.setConfigPackage(SpringMVCServerOptionsProvider.CONFIG_PACKAGE_VALUE); - times = 1; - }}; - } -} diff --git a/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java b/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java index 9a50c9481f6..900f659848f 100644 --- a/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java +++ b/modules/swagger-generator/src/test/java/io/swagger/generator/online/OnlineGeneratorOptionsTest.java @@ -52,7 +52,7 @@ public class OnlineGeneratorOptionsTest { {new RubyClientOptionsProvider()}, {new ScalaClientOptionsProvider()}, {new ScalatraServerOptionsProvider()}, {new SilexServerOptionsProvider()}, {new SinatraServerOptionsProvider()}, {new SlimFrameworkServerOptionsProvider()}, - {new SpringMVCServerOptionsProvider()}, {new StaticDocOptionsProvider()}, + {new SpringOptionsProvider()}, {new StaticDocOptionsProvider()}, {new StaticHtmlOptionsProvider()}, {new SwaggerOptionsProvider()}, {new SwaggerYamlOptionsProvider()}, {new SwiftOptionsProvider()}, {new TizenClientOptionsProvider()}, {new TypeScriptAngularClientOptionsProvider()},