forked from loafle/openapi-generator-original
rollback scala template
This commit is contained in:
parent
7d6fdf96c0
commit
b636d2a2c9
@ -16,77 +16,77 @@ import java.util.Date
|
|||||||
import scala.collection.mutable.HashMap
|
import scala.collection.mutable.HashMap
|
||||||
|
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
class {{classname}}(val defBasePath: String = "{{basePath}}",
|
class {{classname}}(val defBasePath: String = "{{basePath}}",
|
||||||
defApiInvoker: ApiInvoker = ApiInvoker) {
|
defApiInvoker: ApiInvoker = ApiInvoker) {
|
||||||
var basePath = defBasePath
|
var basePath = defBasePath
|
||||||
var apiInvoker = defApiInvoker
|
var apiInvoker = defApiInvoker
|
||||||
|
|
||||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
/**
|
/**
|
||||||
* {{summary}}
|
* {{summary}}
|
||||||
* {{notes}}
|
* {{notes}}
|
||||||
{{#allParams}} * @param {{paramName}} {{description}}
|
{{#allParams}} * @param {{paramName}} {{description}}
|
||||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
*/
|
*/
|
||||||
def {{nickname}} ({{#allParams}}{{paramName}}: {{dataType}}{{#defaultValue}} /* = {{{defaultValue}}} */{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
|
def {{nickname}} ({{#allParams}}{{paramName}}: {{dataType}}{{#defaultValue}} /* = {{{defaultValue}}} */{{/defaultValue}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}}))
|
val path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}}))
|
||||||
|
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
|
|
||||||
val contentTypes = List({{#consumes}}"{{mediaType}}", {{/consumes}}"application/json")
|
val contentTypes = List({{#consumes}}"{{mediaType}}", {{/consumes}}"application/json")
|
||||||
val contentType = contentTypes(0)
|
val contentType = contentTypes(0)
|
||||||
|
|
||||||
// query params
|
// query params
|
||||||
val queryParams = new HashMap[String, String]
|
val queryParams = new HashMap[String, String]
|
||||||
val headerParams = new HashMap[String, String]
|
val headerParams = new HashMap[String, String]
|
||||||
val formParams = new HashMap[String, String]
|
val formParams = new HashMap[String, String]
|
||||||
|
|
||||||
{{#requiredParamCount}}
|
{{#requiredParamCount}}
|
||||||
// verify required params are set
|
// verify required params are set
|
||||||
(List({{/requiredParamCount}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}).filter(_ != null)).size match {
|
(List({{/requiredParamCount}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}).filter(_ != null)).size match {
|
||||||
case {{requiredParamCount}} => // all required values set
|
case {{requiredParamCount}} => // all required values set
|
||||||
case _ => throw new Exception("missing required params")
|
case _ => throw new Exception("missing required params")
|
||||||
}
|
}
|
||||||
{{/requiredParamCount}}
|
{{/requiredParamCount}}
|
||||||
|
|
||||||
{{#queryParams}}if(String.valueOf({{paramName}}) != "null") queryParams += "{{baseName}}" -> {{paramName}}.toString
|
{{#queryParams}}if(String.valueOf({{paramName}}) != "null") queryParams += "{{baseName}}" -> {{paramName}}.toString
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
|
|
||||||
{{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}
|
{{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
|
|
||||||
var postBody: AnyRef = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}
|
var postBody: AnyRef = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}
|
||||||
|
|
||||||
if(contentType.startsWith("multipart/form-data")) {
|
if(contentType.startsWith("multipart/form-data")) {
|
||||||
val mp = new FormDataMultiPart()
|
val mp = new FormDataMultiPart()
|
||||||
{{#formParams}}{{#notFile}}
|
{{#formParams}}{{#notFile}}
|
||||||
mp.field("{{baseName}}", {{paramName}}.toString(), MediaType.MULTIPART_FORM_DATA_TYPE)
|
mp.field("{{baseName}}", {{paramName}}.toString(), MediaType.MULTIPART_FORM_DATA_TYPE)
|
||||||
{{/notFile}}{{#isFile}}
|
{{/notFile}}{{#isFile}}
|
||||||
mp.field("{{baseName}}", file.getName)
|
mp.field("{{baseName}}", file.getName)
|
||||||
mp.bodyPart(new FileDataBodyPart("{{baseName}}", {{paramName}}, MediaType.MULTIPART_FORM_DATA_TYPE))
|
mp.bodyPart(new FileDataBodyPart("{{baseName}}", {{paramName}}, MediaType.MULTIPART_FORM_DATA_TYPE))
|
||||||
{{/isFile}}{{/formParams}}
|
{{/isFile}}{{/formParams}}
|
||||||
postBody = mp
|
postBody = mp
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
{{#formParams}}{{#notFile}}formParams += "{{baseName}}" -> {{paramName}}.toString(){{/notFile}}
|
{{#formParams}}{{#notFile}}formParams += "{{baseName}}" -> {{paramName}}.toString(){{/notFile}}
|
||||||
{{/formParams}}
|
{{/formParams}}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
apiInvoker.invokeApi(basePath, path, "{{httpMethod}}", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
apiInvoker.invokeApi(basePath, path, "{{httpMethod}}", queryParams.toMap, formParams.toMap, postBody, headerParams.toMap, contentType) match {
|
||||||
case s: String =>
|
case s: String =>
|
||||||
{{#returnType}} Some(ApiInvoker.deserialize(s, "{{returnContainer}}", classOf[{{returnBaseType}}]).asInstanceOf[{{returnType}}])
|
{{#returnType}} Some(ApiInvoker.deserialize(s, "{{returnContainer}}", classOf[{{returnBaseType}}]).asInstanceOf[{{returnType}}])
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
case _ => None
|
case _ => None
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
case ex: ApiException if ex.code == 404 => None
|
case ex: ApiException if ex.code == 404 => None
|
||||||
case ex: ApiException => throw ex
|
case ex: ApiException => throw ex
|
||||||
}
|
|
||||||
}
|
|
||||||
{{/operation}}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
{{/operation}}
|
||||||
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -25,179 +25,179 @@ import com.fasterxml.jackson.annotation._
|
|||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize
|
||||||
|
|
||||||
object ScalaJsonUtil {
|
object ScalaJsonUtil {
|
||||||
def getJsonMapper = {
|
def getJsonMapper = {
|
||||||
val mapper = new ObjectMapper()
|
val mapper = new ObjectMapper()
|
||||||
mapper.registerModule(new DefaultScalaModule())
|
mapper.registerModule(new DefaultScalaModule())
|
||||||
mapper.registerModule(new JodaModule());
|
mapper.registerModule(new JodaModule());
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT)
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT)
|
||||||
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
|
||||||
mapper
|
mapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
|
class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
|
||||||
httpHeaders: HashMap[String, String] = HashMap(),
|
httpHeaders: HashMap[String, String] = HashMap(),
|
||||||
hostMap: HashMap[String, Client] = HashMap(),
|
hostMap: HashMap[String, Client] = HashMap(),
|
||||||
asyncHttpClient: Boolean = false,
|
asyncHttpClient: Boolean = false,
|
||||||
authScheme: String = "",
|
authScheme: String = "",
|
||||||
authPreemptive: Boolean = false) {
|
authPreemptive: Boolean = false) {
|
||||||
|
|
||||||
var defaultHeaders: HashMap[String, String] = httpHeaders
|
var defaultHeaders: HashMap[String, String] = httpHeaders
|
||||||
|
|
||||||
def escape(value: String): String = {
|
def escape(value: String): String = {
|
||||||
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
|
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
|
||||||
}
|
}
|
||||||
|
|
||||||
def escape(value: Long): String = value.toString
|
def escape(value: Long): String = value.toString
|
||||||
def escape(value: Double): String = value.toString
|
def escape(value: Double): String = value.toString
|
||||||
def escape(value: Float): String = value.toString
|
def escape(value: Float): String = value.toString
|
||||||
|
|
||||||
def deserialize(json: String, containerType: String, cls: Class[_]) = {
|
def deserialize(json: String, containerType: String, cls: Class[_]) = {
|
||||||
if (cls == classOf[String]) {
|
if (cls == classOf[String]) {
|
||||||
json match {
|
json match {
|
||||||
case s: String => {
|
case s: String => {
|
||||||
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
|
if (s.startsWith("\"") && s.endsWith("\"") && s.length > 1) s.substring(1, s.length - 2)
|
||||||
else s
|
else s
|
||||||
}
|
}
|
||||||
case _ => null
|
case _ => null
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
containerType.toLowerCase match {
|
containerType.toLowerCase match {
|
||||||
case "array" => {
|
case "array" => {
|
||||||
val typeInfo = mapper.getTypeFactory().constructCollectionType(classOf[java.util.List[_]], cls)
|
val typeInfo = mapper.getTypeFactory().constructCollectionType(classOf[java.util.List[_]], cls)
|
||||||
val response = mapper.readValue(json, typeInfo).asInstanceOf[java.util.List[_]]
|
val response = mapper.readValue(json, typeInfo).asInstanceOf[java.util.List[_]]
|
||||||
response.asScala.toList
|
response.asScala.toList
|
||||||
}
|
}
|
||||||
case "list" => {
|
case "list" => {
|
||||||
val typeInfo = mapper.getTypeFactory().constructCollectionType(classOf[java.util.List[_]], cls)
|
val typeInfo = mapper.getTypeFactory().constructCollectionType(classOf[java.util.List[_]], cls)
|
||||||
val response = mapper.readValue(json, typeInfo).asInstanceOf[java.util.List[_]]
|
val response = mapper.readValue(json, typeInfo).asInstanceOf[java.util.List[_]]
|
||||||
response.asScala.toList
|
response.asScala.toList
|
||||||
}
|
}
|
||||||
case _ => {
|
case _ => {
|
||||||
json match {
|
json match {
|
||||||
case e: String if ("\"\"" == e) => null
|
case e: String if ("\"\"" == e) => null
|
||||||
case _ => mapper.readValue(json, cls)
|
case _ => mapper.readValue(json, cls)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def serialize(obj: AnyRef): String = {
|
def serialize(obj: AnyRef): String = {
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
obj match {
|
obj match {
|
||||||
case e: List[_] => mapper.writeValueAsString(obj.asInstanceOf[List[_]].asJava)
|
case e: List[_] => mapper.writeValueAsString(obj.asInstanceOf[List[_]].asJava)
|
||||||
case _ => mapper.writeValueAsString(obj)
|
case _ => mapper.writeValueAsString(obj)
|
||||||
}
|
}
|
||||||
} else null
|
} else null
|
||||||
}
|
}
|
||||||
|
|
||||||
def invokeApi(host: String, path: String, method: String, queryParams: Map[String, String], formParams: Map[String, String], body: AnyRef, headerParams: Map[String, String], contentType: String): String = {
|
def invokeApi(host: String, path: String, method: String, queryParams: Map[String, String], formParams: Map[String, String], body: AnyRef, headerParams: Map[String, String], contentType: String): String = {
|
||||||
val client = getClient(host)
|
val client = getClient(host)
|
||||||
|
|
||||||
val querystring = queryParams.filter(k => k._2 != null).map(k => (escape(k._1) + "=" + escape(k._2))).mkString("?", "&", "")
|
val querystring = queryParams.filter(k => k._2 != null).map(k => (escape(k._1) + "=" + escape(k._2))).mkString("?", "&", "")
|
||||||
val builder = client.resource(host + path + querystring).accept(contentType)
|
val builder = client.resource(host + path + querystring).accept(contentType)
|
||||||
headerParams.map(p => builder.header(p._1, p._2))
|
headerParams.map(p => builder.header(p._1, p._2))
|
||||||
defaultHeaders.map(p => {
|
defaultHeaders.map(p => {
|
||||||
headerParams.contains(p._1) match {
|
headerParams.contains(p._1) match {
|
||||||
case true => // override default with supplied header
|
case true => // override default with supplied header
|
||||||
case false => if (p._2 != null) builder.header(p._1, p._2)
|
case false => if (p._2 != null) builder.header(p._1, p._2)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var formData: MultivaluedMapImpl = null
|
var formData: MultivaluedMapImpl = null
|
||||||
if(contentType == "application/x-www-form-urlencoded") {
|
if(contentType == "application/x-www-form-urlencoded") {
|
||||||
formData = new MultivaluedMapImpl()
|
formData = new MultivaluedMapImpl()
|
||||||
formParams.map(p => formData.add(p._1, p._2))
|
formParams.map(p => formData.add(p._1, p._2))
|
||||||
}
|
}
|
||||||
|
|
||||||
val response: ClientResponse = method match {
|
val response: ClientResponse = method match {
|
||||||
case "GET" => {
|
case "GET" => {
|
||||||
builder.get(classOf[ClientResponse]).asInstanceOf[ClientResponse]
|
builder.get(classOf[ClientResponse]).asInstanceOf[ClientResponse]
|
||||||
}
|
}
|
||||||
case "POST" => {
|
case "POST" => {
|
||||||
if(formData != null) builder.post(classOf[ClientResponse], formData)
|
if(formData != null) builder.post(classOf[ClientResponse], formData)
|
||||||
else if(body != null && body.isInstanceOf[File]) {
|
else if(body != null && body.isInstanceOf[File]) {
|
||||||
val file = body.asInstanceOf[File]
|
val file = body.asInstanceOf[File]
|
||||||
val form = new FormDataMultiPart()
|
val form = new FormDataMultiPart()
|
||||||
form.field("filename", file.getName())
|
form.field("filename", file.getName())
|
||||||
form.bodyPart(new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE))
|
form.bodyPart(new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE))
|
||||||
builder.post(classOf[ClientResponse], form)
|
builder.post(classOf[ClientResponse], form)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(body == null) builder.post(classOf[ClientResponse], serialize(body))
|
if(body == null) builder.post(classOf[ClientResponse], serialize(body))
|
||||||
else builder.`type`(contentType).post(classOf[ClientResponse], serialize(body))
|
else builder.`type`(contentType).post(classOf[ClientResponse], serialize(body))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "PUT" => {
|
case "PUT" => {
|
||||||
if(formData != null) builder.post(classOf[ClientResponse], formData)
|
if(formData != null) builder.post(classOf[ClientResponse], formData)
|
||||||
else if(body == null) builder.put(classOf[ClientResponse], null)
|
else if(body == null) builder.put(classOf[ClientResponse], null)
|
||||||
else builder.`type`(contentType).put(classOf[ClientResponse], serialize(body))
|
else builder.`type`(contentType).put(classOf[ClientResponse], serialize(body))
|
||||||
}
|
}
|
||||||
case "DELETE" => {
|
case "DELETE" => {
|
||||||
builder.delete(classOf[ClientResponse])
|
builder.delete(classOf[ClientResponse])
|
||||||
}
|
}
|
||||||
case _ => null
|
case _ => null
|
||||||
}
|
}
|
||||||
response.getClientResponseStatus().getStatusCode() match {
|
response.getClientResponseStatus().getStatusCode() match {
|
||||||
case 204 => ""
|
case 204 => ""
|
||||||
case code: Int if (Range(200, 299).contains(code)) => {
|
case code: Int if (Range(200, 299).contains(code)) => {
|
||||||
response.hasEntity() match {
|
response.hasEntity() match {
|
||||||
case true => response.getEntity(classOf[String])
|
case true => response.getEntity(classOf[String])
|
||||||
case false => ""
|
case false => ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case _ => {
|
case _ => {
|
||||||
val entity = response.hasEntity() match {
|
val entity = response.hasEntity() match {
|
||||||
case true => response.getEntity(classOf[String])
|
case true => response.getEntity(classOf[String])
|
||||||
case false => "no data"
|
case false => "no data"
|
||||||
}
|
}
|
||||||
throw new ApiException(
|
throw new ApiException(
|
||||||
response.getClientResponseStatus().getStatusCode(),
|
response.getClientResponseStatus().getStatusCode(),
|
||||||
entity)
|
entity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getClient(host: String): Client = {
|
def getClient(host: String): Client = {
|
||||||
hostMap.contains(host) match {
|
hostMap.contains(host) match {
|
||||||
case true => hostMap(host)
|
case true => hostMap(host)
|
||||||
case false => {
|
case false => {
|
||||||
val client = newClient(host)
|
val client = newClient(host)
|
||||||
// client.addFilter(new LoggingFilter())
|
// client.addFilter(new LoggingFilter())
|
||||||
hostMap += host -> client
|
hostMap += host -> client
|
||||||
client
|
client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def newClient(host: String): Client = asyncHttpClient match {
|
def newClient(host: String): Client = asyncHttpClient match {
|
||||||
case true => {
|
case true => {
|
||||||
import org.sonatype.spice.jersey.client.ahc.config.DefaultAhcConfig
|
import org.sonatype.spice.jersey.client.ahc.config.DefaultAhcConfig
|
||||||
import org.sonatype.spice.jersey.client.ahc.AhcHttpClient
|
import org.sonatype.spice.jersey.client.ahc.AhcHttpClient
|
||||||
import com.ning.http.client.Realm
|
import com.ning.http.client.Realm
|
||||||
|
|
||||||
val config: DefaultAhcConfig = new DefaultAhcConfig()
|
val config: DefaultAhcConfig = new DefaultAhcConfig()
|
||||||
if (!authScheme.isEmpty) {
|
if (!authScheme.isEmpty) {
|
||||||
val authSchemeEnum = Realm.AuthScheme.valueOf(authScheme)
|
val authSchemeEnum = Realm.AuthScheme.valueOf(authScheme)
|
||||||
config.getAsyncHttpClientConfigBuilder
|
config.getAsyncHttpClientConfigBuilder
|
||||||
.setRealm(new Realm.RealmBuilder().setScheme(authSchemeEnum)
|
.setRealm(new Realm.RealmBuilder().setScheme(authSchemeEnum)
|
||||||
.setUsePreemptiveAuth(authPreemptive).build)
|
.setUsePreemptiveAuth(authPreemptive).build)
|
||||||
}
|
}
|
||||||
AhcHttpClient.create(config)
|
AhcHttpClient.create(config)
|
||||||
}
|
}
|
||||||
case _ => Client.create()
|
case _ => Client.create()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ApiInvoker extends ApiInvoker(mapper = ScalaJsonUtil.getJsonMapper,
|
object ApiInvoker extends ApiInvoker(mapper = ScalaJsonUtil.getJsonMapper,
|
||||||
httpHeaders = HashMap(),
|
httpHeaders = HashMap(),
|
||||||
hostMap = HashMap(),
|
hostMap = HashMap(),
|
||||||
asyncHttpClient = {{asyncHttpClient}},
|
asyncHttpClient = {{asyncHttpClient}},
|
||||||
authScheme = "{{authScheme}}",
|
authScheme = "{{authScheme}}",
|
||||||
authPreemptive = {{authPreemptive}})
|
authPreemptive = {{authPreemptive}})
|
||||||
|
|
||||||
class ApiException(val code: Int, msg: String) extends RuntimeException(msg)
|
class ApiException(val code: Int, msg: String) extends RuntimeException(msg)
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ package {{package}}
|
|||||||
|
|
||||||
{{#models}}
|
{{#models}}
|
||||||
|
|
||||||
{{#model}}
|
{{#model}}
|
||||||
|
|
||||||
case class {{classname}} (
|
case class {{classname}} (
|
||||||
{{#vars}}{{#description}}/* {{{description}}} */
|
{{#vars}}{{#description}}/* {{{description}}} */
|
||||||
{{/description}}{{name}}: {{{datatype}}}{{#hasMore}},{{/hasMore}}{{^hasMore}}){{/hasMore}}
|
{{/description}}{{name}}: {{{datatype}}}{{#hasMore}},{{/hasMore}}{{^hasMore}}){{/hasMore}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
@ -1,224 +1,221 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>{{groupId}}</groupId>
|
<groupId>{{groupId}}</groupId>
|
||||||
<artifactId>{{artifactId}}</artifactId>
|
<artifactId>{{artifactId}}</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>{{artifactId}}</name>
|
<name>{{artifactId}}</name>
|
||||||
<version>{{artifactVersion}}</version>
|
<version>{{artifactVersion}}</version>
|
||||||
<prerequisites>
|
<prerequisites>
|
||||||
<maven>2.2.0</maven>
|
<maven>2.2.0</maven>
|
||||||
</prerequisites>
|
</prerequisites>
|
||||||
|
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>maven-mongodb-plugin-repo</id>
|
<id>maven-mongodb-plugin-repo</id>
|
||||||
<name>maven mongodb plugin repository</name>
|
<name>maven mongodb plugin repository</name>
|
||||||
<url>http://maven-mongodb-plugin.googlecode.com/svn/maven/repo</url>
|
<url>http://maven-mongodb-plugin.googlecode.com/svn/maven/repo</url>
|
||||||
<layout>default</layout>
|
<layout>default</layout>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.12</version>
|
<version>2.12</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemProperties>
|
<systemProperties>
|
||||||
<property>
|
<property>
|
||||||
<name>loggerPath</name>
|
<name>loggerPath</name>
|
||||||
<value>conf/log4j.properties</value>
|
<value>conf/log4j.properties</value>
|
||||||
</property>
|
</property>
|
||||||
</systemProperties>
|
</systemProperties>
|
||||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
<parallel>methods</parallel>
|
<parallel>methods</parallel>
|
||||||
<forkMode>pertest</forkMode>
|
<forkMode>pertest</forkMode>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>copy-dependencies</goal>
|
<goal>copy-dependencies</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- attach test jar -->
|
<!-- attach test jar -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.2</version>
|
<version>2.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar</goal>
|
<goal>jar</goal>
|
||||||
<goal>test-jar</goal>
|
<goal>test-jar</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
<configuration>
|
<configuration>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>add_sources</id>
|
<id>add_sources</id>
|
||||||
<phase>generate-sources</phase>
|
<phase>generate-sources</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>add-source</goal>
|
<goal>add-source</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<sources>
|
<sources>
|
||||||
<source>
|
<source>src/main/java</source>
|
||||||
src/main/java</source>
|
</sources>
|
||||||
</sources>
|
</configuration>
|
||||||
</configuration>
|
</execution>
|
||||||
</execution>
|
<execution>
|
||||||
<execution>
|
<id>add_test_sources</id>
|
||||||
<id>add_test_sources</id>
|
<phase>generate-test-sources</phase>
|
||||||
<phase>generate-test-sources</phase>
|
<goals>
|
||||||
<goals>
|
<goal>add-test-source</goal>
|
||||||
<goal>add-test-source</goal>
|
</goals>
|
||||||
</goals>
|
<configuration>
|
||||||
<configuration>
|
<sources>
|
||||||
<sources>
|
<source>src/test/java</source>
|
||||||
<source>
|
</sources>
|
||||||
src/test/java</source>
|
</configuration>
|
||||||
</sources>
|
</execution>
|
||||||
</configuration>
|
</executions>
|
||||||
</execution>
|
</plugin>
|
||||||
</executions>
|
<plugin>
|
||||||
</plugin>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<plugin>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<version>2.3.2</version>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<configuration>
|
||||||
<version>2.3.2</version>
|
<source>1.6</source>
|
||||||
<configuration>
|
<target>1.6</target>
|
||||||
<source>
|
</configuration>
|
||||||
1.6</source>
|
</plugin>
|
||||||
<target>1.6</target>
|
<plugin>
|
||||||
</configuration>
|
<groupId>net.alchim31.maven</groupId>
|
||||||
</plugin>
|
<artifactId>scala-maven-plugin</artifactId>
|
||||||
<plugin>
|
<version>${scala-maven-plugin-version}</version>
|
||||||
<groupId>net.alchim31.maven</groupId>
|
<executions>
|
||||||
<artifactId>scala-maven-plugin</artifactId>
|
<execution>
|
||||||
<version>${scala-maven-plugin-version}</version>
|
<id>scala-compile-first</id>
|
||||||
<executions>
|
<phase>process-resources</phase>
|
||||||
<execution>
|
<goals>
|
||||||
<id>scala-compile-first</id>
|
<goal>add-source</goal>
|
||||||
<phase>process-resources</phase>
|
<goal>compile</goal>
|
||||||
<goals>
|
</goals>
|
||||||
<goal>add-source</goal>
|
</execution>
|
||||||
<goal>compile</goal>
|
<execution>
|
||||||
</goals>
|
<id>scala-test-compile</id>
|
||||||
</execution>
|
<phase>process-test-resources</phase>
|
||||||
<execution>
|
<goals>
|
||||||
<id>scala-test-compile</id>
|
<goal>testCompile</goal>
|
||||||
<phase>process-test-resources</phase>
|
</goals>
|
||||||
<goals>
|
</execution>
|
||||||
<goal>testCompile</goal>
|
</executions>
|
||||||
</goals>
|
<configuration>
|
||||||
</execution>
|
<jvmArgs>
|
||||||
</executions>
|
<jvmArg>-Xms128m</jvmArg>
|
||||||
<configuration>
|
<jvmArg>-Xmx1500m</jvmArg>
|
||||||
<jvmArgs>
|
</jvmArgs>
|
||||||
<jvmArg>-Xms128m</jvmArg>
|
</configuration>
|
||||||
<jvmArg>-Xmx1500m</jvmArg>
|
</plugin>
|
||||||
</jvmArgs>
|
</plugins>
|
||||||
</configuration>
|
</build>
|
||||||
</plugin>
|
<reporting>
|
||||||
</plugins>
|
<plugins>
|
||||||
</build>
|
<plugin>
|
||||||
<reporting>
|
<groupId>org.scala-tools</groupId>
|
||||||
<plugins>
|
<artifactId>maven-scala-plugin</artifactId>
|
||||||
<plugin>
|
<configuration>
|
||||||
<groupId>org.scala-tools</groupId>
|
<scalaVersion>${scala-version}</scalaVersion>
|
||||||
<artifactId>maven-scala-plugin</artifactId>
|
</configuration>
|
||||||
<configuration>
|
</plugin>
|
||||||
<scalaVersion>${scala-version}</scalaVersion>
|
</plugins>
|
||||||
</configuration>
|
</reporting>
|
||||||
</plugin>
|
<dependencies>
|
||||||
</plugins>
|
<dependency>
|
||||||
</reporting>
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
<dependencies>
|
<artifactId>jackson-module-scala_2.10</artifactId>
|
||||||
<dependency>
|
<version>${jackson-version}</version>
|
||||||
<groupId>com.fasterxml.jackson.module</groupId>
|
</dependency>
|
||||||
<artifactId>jackson-module-scala_2.10</artifactId>
|
<dependency>
|
||||||
<version>${jackson-version}</version>
|
<groupId>com.sun.jersey</groupId>
|
||||||
</dependency>
|
<artifactId>jersey-client</artifactId>
|
||||||
<dependency>
|
<version>${jersey-version}</version>
|
||||||
<groupId>com.sun.jersey</groupId>
|
</dependency>
|
||||||
<artifactId>jersey-client</artifactId>
|
<dependency>
|
||||||
<version>${jersey-version}</version>
|
<groupId>com.sun.jersey.contribs</groupId>
|
||||||
</dependency>
|
<artifactId>jersey-multipart</artifactId>
|
||||||
<dependency>
|
<version>${jersey-version}</version>
|
||||||
<groupId>com.sun.jersey.contribs</groupId>
|
</dependency>
|
||||||
<artifactId>jersey-multipart</artifactId>
|
<dependency>
|
||||||
<version>${jersey-version}</version>
|
<groupId>org.jfarcand</groupId>
|
||||||
</dependency>
|
<artifactId>jersey-ahc-client</artifactId>
|
||||||
<dependency>
|
<version>${jersey-async-version}</version>
|
||||||
<groupId>org.jfarcand</groupId>
|
<scope>compile</scope>
|
||||||
<artifactId>jersey-ahc-client</artifactId>
|
</dependency>
|
||||||
<version>${jersey-async-version}</version>
|
<dependency>
|
||||||
<scope>compile</scope>
|
<groupId>org.scala-lang</groupId>
|
||||||
</dependency>
|
<artifactId>scala-library</artifactId>
|
||||||
<dependency>
|
<version>${scala-version}</version>
|
||||||
<groupId>org.scala-lang</groupId>
|
</dependency>
|
||||||
<artifactId>scala-library</artifactId>
|
<dependency>
|
||||||
<version>${scala-version}</version>
|
<groupId>io.swagger</groupId>
|
||||||
</dependency>
|
<artifactId>swagger-core</artifactId>
|
||||||
<dependency>
|
<version>${swagger-core-version}</version>
|
||||||
<groupId>io.swagger</groupId>
|
</dependency>
|
||||||
<artifactId>swagger-core</artifactId>
|
<dependency>
|
||||||
<version>${swagger-core-version}</version>
|
<groupId>org.scalatest</groupId>
|
||||||
</dependency>
|
<artifactId>scalatest_2.10</artifactId>
|
||||||
<dependency>
|
<version>${scala-test-version}</version>
|
||||||
<groupId>org.scalatest</groupId>
|
<scope>test</scope>
|
||||||
<artifactId>scalatest_2.10</artifactId>
|
</dependency>
|
||||||
<version>${scala-test-version}</version>
|
<dependency>
|
||||||
<scope>test</scope>
|
<groupId>junit</groupId>
|
||||||
</dependency>
|
<artifactId>junit</artifactId>
|
||||||
<dependency>
|
<version>${junit-version}</version>
|
||||||
<groupId>junit</groupId>
|
<scope>test</scope>
|
||||||
<artifactId>junit</artifactId>
|
</dependency>
|
||||||
<version>${junit-version}</version>
|
<dependency>
|
||||||
<scope>test</scope>
|
<groupId>joda-time</groupId>
|
||||||
</dependency>
|
<artifactId>joda-time</artifactId>
|
||||||
<dependency>
|
<version>${joda-time-version}</version>
|
||||||
<groupId>joda-time</groupId>
|
</dependency>
|
||||||
<artifactId>joda-time</artifactId>
|
<dependency>
|
||||||
<version>${joda-time-version}</version>
|
<groupId>org.joda</groupId>
|
||||||
</dependency>
|
<artifactId>joda-convert</artifactId>
|
||||||
<dependency>
|
<version>${joda-version}</version>
|
||||||
<groupId>org.joda</groupId>
|
</dependency>
|
||||||
<artifactId>joda-convert</artifactId>
|
</dependencies>
|
||||||
<version>${joda-version}</version>
|
<properties>
|
||||||
</dependency>
|
<scala-version>2.10.4</scala-version>
|
||||||
</dependencies>
|
<joda-version>1.2</joda-version>
|
||||||
<properties>
|
<joda-time-version>2.2</joda-time-version>
|
||||||
<scala-version>2.10.4</scala-version>
|
<jersey-version>1.7</jersey-version>
|
||||||
<joda-version>1.2</joda-version>
|
<swagger-core-version>1.5.0</swagger-core-version>
|
||||||
<joda-time-version>2.2</joda-time-version>
|
<jersey-async-version>1.0.5</jersey-async-version>
|
||||||
<jersey-version>1.7</jersey-version>
|
<maven-plugin.version>1.0.0</maven-plugin.version>
|
||||||
<swagger-core-version>1.5.0</swagger-core-version>
|
<jackson-version>2.4.2</jackson-version>
|
||||||
<jersey-async-version>1.0.5</jersey-async-version>
|
|
||||||
<maven-plugin.version>1.0.0</maven-plugin.version>
|
|
||||||
<jackson-version>2.4.2</jackson-version>
|
|
||||||
|
|
||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
||||||
<scala-test-version>2.1.3</scala-test-version>
|
<scala-test-version>2.1.3</scala-test-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user