diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java new file mode 100644 index 00000000000..8831c8f1a26 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaResteasyServerCodegen.java @@ -0,0 +1,332 @@ +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 org.apache.commons.lang.StringUtils; + +import java.io.File; +import java.util.*; + +public class JavaResteasyServerCodegen extends JavaClientCodegen implements CodegenConfig { + + protected String dateLibrary = "default"; + protected String title = "Swagger Server"; + protected String implFolder = "src/main/java"; + + public static final String DATE_LIBRARY = "dateLibrary"; + + public JavaResteasyServerCodegen() { + + super(); + + sourceFolder = "src/gen/java"; + invokerPackage = "io.swagger.api"; + artifactId = "swagger-jaxrs-resteasy-server"; + + outputFolder = "generated-code/javaJaxRS"; + modelTemplateFiles.put("model.mustache", ".java"); + apiTemplateFiles.put("api.mustache", ".java"); + apiTemplateFiles.put("apiService.mustache", ".java"); + apiTemplateFiles.put("apiServiceImpl.mustache", ".java"); + apiTemplateFiles.put("apiServiceFactory.mustache", ".java"); + apiPackage = "io.swagger.api"; + modelPackage = "io.swagger.model"; + + additionalProperties.put("title", title); + + embeddedTemplateDir = templateDir = "JavaJaxRS" + File.separator + "resteasy3_0_11"; + + for (int i = 0; i < cliOptions.size(); i++) { + if (CodegenConstants.LIBRARY.equals(cliOptions.get(i).getOpt())) { + cliOptions.remove(i); + break; + } + } + + CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use"); + Map dateOptions = new HashMap(); + dateOptions.put("java8", "Java 8 native"); + dateOptions.put("joda", "Joda"); + dateLibrary.setEnum(dateOptions); + + cliOptions.add(dateLibrary); + + CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); + library.setDefault(DEFAULT_LIBRARY); + + Map supportedLibraries = new LinkedHashMap(); + + supportedLibraries.put(DEFAULT_LIBRARY, "Resteasy core 3.0.11"); + library.setEnum(supportedLibraries); + + cliOptions.add(library); + cliOptions.add(new CliOption(CodegenConstants.IMPL_FOLDER, CodegenConstants.IMPL_FOLDER_DESC)); + } + + @Override + public CodegenType getTag() { + return CodegenType.SERVER; + } + + @Override + public String getName() { + return "jaxrs-resteasy"; + } + + @Override + public String getHelp() { + return "Generates a Java JAXRS-Resteasy Server application."; + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { + implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); + } + + supportingFiles.clear(); +// supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + supportingFiles.add(new SupportingFile("gradle.mustache", "", "build.gradle")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("ApiException.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiException.java")); + supportingFiles.add(new SupportingFile("ApiOriginFilter.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiOriginFilter.java")); + supportingFiles.add(new SupportingFile("ApiResponseMessage.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiResponseMessage.java")); + supportingFiles.add(new SupportingFile("NotFoundException.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "NotFoundException.java")); + supportingFiles.add(new SupportingFile("web.mustache", + ("src/main/webapp/WEB-INF"), "web.xml")); + supportingFiles.add(new SupportingFile("jboss-web.mustache", + ("src/main/webapp/WEB-INF"), "jboss-web.xml")); + supportingFiles.add(new SupportingFile("RestApplication.mustache", + (sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java")); + supportingFiles.add(new SupportingFile("StringUtil.mustache", + (sourceFolder + '/' + invokerPackage).replace(".", "/"), "StringUtil.java")); + + if (additionalProperties.containsKey("dateLibrary")) { + setDateLibrary(additionalProperties.get("dateLibrary").toString()); + additionalProperties.put(dateLibrary, "true"); + } + + if ("joda".equals(dateLibrary)) { + typeMapping.put("date", "LocalDate"); + typeMapping.put("DateTime", "DateTime"); + + importMapping.put("LocalDate", "org.joda.time.LocalDate"); + importMapping.put("DateTime", "org.joda.time.DateTime"); + + supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java")); + supportingFiles.add(new SupportingFile("JodaLocalDateProvider.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaLocalDateProvider.java")); + } else if ("java8".equals(dateLibrary)) { + additionalProperties.put("java8", "true"); + additionalProperties.put("javaVersion", "1.8"); + typeMapping.put("date", "LocalDate"); + typeMapping.put("DateTime", "LocalDateTime"); + importMapping.put("LocalDate", "java.time.LocalDate"); + importMapping.put("LocalDateTime", "java.time.LocalDateTime"); + + supportingFiles.add(new SupportingFile("LocalDateTimeProvider.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateTimeProvider.java")); + supportingFiles.add(new SupportingFile("LocalDateProvider.mustache", + (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateProvider.java")); + } + } + + @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) { + 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"; + } + } + } + } + return objs; + } + + @Override + public String toApiName(String name) { + if (name.length() == 0) { + return "DefaultApi"; + } + name = sanitizeName(name); + return camelize(name) + "Api"; + } + + + @Override + public String apiFilename(String templateName, String tag) { + + String result = super.apiFilename(templateName, tag); + + if (templateName.endsWith("Impl.mustache")) { + int ix = result.lastIndexOf('/'); + result = result.substring(0, ix) + "/impl" + result.substring(ix, result.length() - 5) + "ServiceImpl.java"; + + result = result.replace(apiFileFolder(), implFileFolder(implFolder)); + } else if (templateName.endsWith("Factory.mustache")) { + int ix = result.lastIndexOf('/'); + result = result.substring(0, ix) + "/factories" + result.substring(ix, result.length() - 5) + "ServiceFactory.java"; + + result = result.replace(apiFileFolder(), implFileFolder(implFolder)); + } else if (templateName.endsWith("Service.mustache")) { + int ix = result.lastIndexOf('.'); + result = result.substring(0, ix) + "Service.java"; + } + + return result; + } + + + private String implFileFolder(String output) { + return outputFolder + "/" + output + "/" + apiPackage().replace('.', '/'); + } + + @Override + public boolean shouldOverwrite(String filename) { + return super.shouldOverwrite(filename) && !filename.endsWith("ServiceImpl.java") && !filename.endsWith("ServiceFactory.java"); + } + + public void setDateLibrary(String library) { + this.dateLibrary = library; + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + if(serializeBigDecimalAsString) { + if (property.baseType.equals("BigDecimal")) { + // we serialize BigDecimal as `string` to avoid precision loss + property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)"); + + // this requires some more imports to be added for this model... + model.imports.add("ToStringSerializer"); + model.imports.add("JsonSerialize"); + } + } + + if(model.isEnum == null || model.isEnum) { + + final String lib = getLibrary(); + if(StringUtils.isEmpty(lib)) { + model.imports.add("JsonProperty"); + + if(model.hasEnums != null || model.hasEnums == true) { + model.imports.add("JsonValue"); + } + } + } + return; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiException.mustache new file mode 100644 index 00000000000..11b4036b832 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiException.mustache @@ -0,0 +1,10 @@ +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/JavaJaxRS/resteasy3_0_11/ApiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiOriginFilter.mustache new file mode 100644 index 00000000000..a1e5a678fe1 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiOriginFilter.mustache @@ -0,0 +1,22 @@ +package {{apiPackage}}; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + +{{>generatedAnnotation}} +public class ApiOriginFilter implements javax.servlet.Filter { + 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); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiResponseMessage.mustache new file mode 100644 index 00000000000..2b9a2b1f8c5 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/ApiResponseMessage.mustache @@ -0,0 +1,69 @@ +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/JavaJaxRS/resteasy3_0_11/JodaDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/JodaDateTimeProvider.mustache new file mode 100644 index 00000000000..f9421790983 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/JodaDateTimeProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import org.joda.time.DateTime; +import java.util.List; + +@Provider +public class JodaDateTimeProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public JodaDateTimeProvider(@Context UriInfo uriInfo) { + super(DateTime.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public DateTime getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return DateTime.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/JodaLocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/JodaLocalDateProvider.mustache new file mode 100644 index 00000000000..7bd4027e63d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/JodaLocalDateProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import org.joda.time.LocalDate; +import java.util.List; + +@Provider +public class JodaLocalDateProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public JodaLocalDateProvider(@Context UriInfo uriInfo) { + super(LocalDate.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public LocalDate getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return LocalDate.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/LocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/LocalDateProvider.mustache new file mode 100644 index 00000000000..8c4cd4cbd15 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/LocalDateProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import java.time.LocalDate; +import java.util.List; + +@Provider +public class LocalDateProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public LocalDateProvider(@Context UriInfo uriInfo) { + super(LocalDate.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public LocalDate getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return LocalDate.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/LocalDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/LocalDateTimeProvider.mustache new file mode 100644 index 00000000000..93bb6f19d50 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/LocalDateTimeProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import java.time.LocalDateTime; +import java.util.List; + +@Provider +public class LocalDateTimeProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public LocalDateTimeProvider(@Context UriInfo uriInfo) { + super(LocalDateTime.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public LocalDateTime getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return LocalDateTime.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/NotFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/NotFoundException.mustache new file mode 100644 index 00000000000..1bd5e207d7b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/NotFoundException.mustache @@ -0,0 +1,10 @@ +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/JavaJaxRS/resteasy3_0_11/README.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/README.mustache new file mode 100644 index 00000000000..3551b9e9914 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/README.mustache @@ -0,0 +1,23 @@ +# Swagger generated 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/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a swagger-enabled JAX-RS server. + +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the swagger listing here: + +``` +http://localhost:{{serverPort}}{{contextPath}}/swagger.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/RestApplication.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/RestApplication.mustache new file mode 100644 index 00000000000..df9a31434b6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/RestApplication.mustache @@ -0,0 +1,9 @@ +package {{invokerPackage}}; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("/") +public class RestApplication extends Application { + +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/StringUtil.mustache new file mode 100644 index 00000000000..073966b0c21 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/StringUtil.mustache @@ -0,0 +1,42 @@ +package {{invokerPackage}}; + +{{>generatedAnnotation}} +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/allowableValues.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/allowableValues.mustache new file mode 100644 index 00000000000..a48256d027a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/allowableValues.mustache @@ -0,0 +1 @@ +{{#allowableValues}}allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}{{^values}}range=[{{#min}}{{.}}{{/min}}{{^min}}-infinity{{/min}}, {{#max}}{{.}}{{/max}}{{^max}}infinity{{/max}}]{{/values}}"{{/allowableValues}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/api.mustache new file mode 100644 index 00000000000..34bd16e3804 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/api.mustache @@ -0,0 +1,40 @@ +package {{package}}; + +import {{modelPackage}}.*; +import {{package}}.{{classname}}Service; +import {{package}}.factories.{{classname}}ServiceFactory; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/{{baseName}}") +{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} +{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private final {{classname}}Service delegate = {{classname}}ServiceFactory.get{{classname}}(); + +{{#operation}} + @{{httpMethod}} + {{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}} + {{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} + {{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} + + public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}}@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.{{nickname}}({{#allParams}}{{#isFile}}fileDetail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}},{{/allParams}}securityContext); + } +{{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiService.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiService.mustache new file mode 100644 index 00000000000..be611237b7e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiService.mustache @@ -0,0 +1,25 @@ +package {{package}}; + +import {{package}}.*; +import {{modelPackage}}.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + +{{>generatedAnnotation}} +{{#operations}} +public abstract class {{classname}}Service { + {{#operation}} + public abstract Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}},{{/allParams}}SecurityContext securityContext) + throws NotFoundException; + {{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiServiceFactory.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiServiceFactory.mustache new file mode 100644 index 00000000000..1bb63bc0775 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiServiceFactory.mustache @@ -0,0 +1,15 @@ +package {{package}}.factories; + +import {{package}}.{{classname}}Service; +import {{package}}.impl.{{classname}}ServiceImpl; + +{{>generatedAnnotation}} +public class {{classname}}ServiceFactory { + + private final static {{classname}}Service service = new {{classname}}ServiceImpl(); + + public static {{classname}}Service get{{classname}}() + { + return service; + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiServiceImpl.mustache new file mode 100644 index 00000000000..e2ee7c09fbb --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/apiServiceImpl.mustache @@ -0,0 +1,29 @@ +package {{package}}.impl; + +import {{package}}.*; +import {{modelPackage}}.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}}ServiceImpl extends {{classname}}Service { + {{#operation}} + @Override + public Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}},{{/allParams}}SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + {{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/bodyParams.mustache new file mode 100644 index 00000000000..bb1d6ff4ef0 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}} {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/enumClass.mustache new file mode 100644 index 00000000000..6010e26704f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/enumClass.mustache @@ -0,0 +1,17 @@ + + public enum {{{datatypeWithEnum}}} { + {{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private String value; + + {{{datatypeWithEnum}}}(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return value; + } + } diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/enumOuterClass.mustache new file mode 100644 index 00000000000..7aea7b92f22 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/enumOuterClass.mustache @@ -0,0 +1,3 @@ +public enum {{classname}} { + {{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{/allowableValues}} +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/formParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/formParams.mustache new file mode 100644 index 00000000000..c7a3108f5c7 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/formParams.mustache @@ -0,0 +1,2 @@ +{{#isFormParam}}{{#notFile}}@FormParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @FormDataParam("file") InputStream inputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/generatedAnnotation.mustache new file mode 100644 index 00000000000..49110fc1ad9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/gradle.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/gradle.mustache new file mode 100644 index 00000000000..be2097d48c2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/gradle.mustache @@ -0,0 +1,25 @@ +apply plugin: 'war' + +repositories { + mavenCentral() +} + +dependencies { + compile 'com.fasterxml.jackson.core:jackson-annotations:2.7.0' + providedCompile 'org.jboss.resteasy:resteasy-jaxrs:3.0.11.Final' + providedCompile 'org.jboss.resteasy:jaxrs-api:3.0.11.Final' + providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final' + providedCompile 'javax.annotation:javax.annotation-api:1.2' + providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final' + + testCompile 'junit:junit:4.12', + 'org.hamcrest:hamcrest-core:1.3' +} + +sourceSets { + main { + java { + srcDir 'src/gen/java' + } + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/headerParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/headerParams.mustache new file mode 100644 index 00000000000..25d690c90ed --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/jboss-web.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/jboss-web.mustache new file mode 100644 index 00000000000..8e05a2ef4e1 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/jboss-web.mustache @@ -0,0 +1,3 @@ + + {{contextPath}}/* + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/model.mustache new file mode 100644 index 00000000000..b9512d2b83c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/model.mustache @@ -0,0 +1,16 @@ +package {{package}}; + +import java.util.Objects; +{{#imports}}import {{import}}; +{{/imports}} + +{{#serializableModel}}import java.io.Serializable;{{/serializableModel}} +{{#models}} +{{#model}}{{#description}} +/** + * {{description}} + **/{{/description}} +{{#isEnum}}{{>enumOuterClass}}{{/isEnum}} +{{^isEnum}}{{>pojo}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pathParams.mustache new file mode 100644 index 00000000000..39116c805cb --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}} @PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pojo.mustache new file mode 100644 index 00000000000..63578d8bc73 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pojo.mustache @@ -0,0 +1,66 @@ +{{>generatedAnnotation}} +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { + {{#vars}}{{#isEnum}} + +{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}} + +{{>enumClass}}{{/items}}{{/items.isEnum}} + private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} + + {{#vars}} + /**{{#description}} + * {{{description}}}{{/description}}{{#minimum}} + * minimum: {{minimum}}{{/minimum}}{{#maximum}} + * maximum: {{maximum}}{{/maximum}} + **/ + {{#vendorExtensions.extraAnnotation}}{{vendorExtensions.extraAnnotation}}{{/vendorExtensions.extraAnnotation}} + @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(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pom.mustache new file mode 100644 index 00000000000..0d1b06de43a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/pom.mustache @@ -0,0 +1,178 @@ + + 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} + + + / + + target/${project.artifactId}-${project.version} + 8079 + stopit + + {{serverPort}} + 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-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} + + + javax.servlet + servlet-api + ${servlet-api-version} + + + + junit + junit + ${junit-version} + test + + + com.sun.jersey + jersey-client + ${jersey-version} + test + + + org.testng + testng + 6.8.8 + test + + + junit + junit + + + snakeyaml + org.yaml + + + bsh + org.beanshell + + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.5.4 + 9.2.9.v20150224 + 1.18.1 + 1.6.3 + 4.8.1 + 2.5 + + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/queryParams.mustache new file mode 100644 index 00000000000..458b8de7c3b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/returnTypes.mustache new file mode 100644 index 00000000000..c8f7a56938a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/returnTypes.mustache @@ -0,0 +1 @@ +{{#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/JavaJaxRS/resteasy3_0_11/serviceBodyParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceBodyParams.mustache new file mode 100644 index 00000000000..c7d1abfe527 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceBodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceFormParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceFormParams.mustache new file mode 100644 index 00000000000..e44ab167e8f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceFormParams.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}FormDataContentDisposition fileDetail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceHeaderParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceHeaderParams.mustache new file mode 100644 index 00000000000..bd03573d196 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceHeaderParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/servicePathParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/servicePathParams.mustache new file mode 100644 index 00000000000..6829cf8c7a6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/servicePathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceQueryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceQueryParams.mustache new file mode 100644 index 00000000000..ff79730471d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/serviceQueryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/web.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/web.mustache new file mode 100644 index 00000000000..6453a110a34 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/resteasy3_0_11/web.mustache @@ -0,0 +1,14 @@ + + + + + ApiOriginFilter + {{apiPackage}}.ApiOriginFilter + + + ApiOriginFilter + /* + + 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 18015a9328b..a5e08ff04ee 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 @@ -8,6 +8,7 @@ io.swagger.codegen.languages.GoClientCodegen io.swagger.codegen.languages.JavaClientCodegen io.swagger.codegen.languages.JavaJerseyServerCodegen io.swagger.codegen.languages.JavaCXFServerCodegen +io.swagger.codegen.languages.JavaResteasyServerCodegen io.swagger.codegen.languages.JavaInflectorServerCodegen io.swagger.codegen.languages.JavascriptClientCodegen io.swagger.codegen.languages.JMeterCodegen