diff --git a/build.sbt b/build.sbt index 195b96e2b9c..7eac80918d7 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ organization := "com.wordnik" name := "swagger-codegen" -version := "2.0.8" +version := "2.0.9-SNAPSHOT" scalaVersion := "2.9.1" @@ -16,11 +16,11 @@ scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3", "2.10.0") libraryDependencies ++= Seq( - "org.json4s" %% "json4s-jackson" % "3.2.4", + "org.json4s" %% "json4s-jackson" % "3.2.5", "io.backchat.inflector" %% "scala-inflector" % "1.3.5", "commons-io" % "commons-io" % "2.3", - "ch.qos.logback" % "logback-classic" % "1.0.10" % "provided", - "org.rogach" %% "scallop" % "0.8.1", + "ch.qos.logback" % "logback-classic" % "1.0.13" % "provided", + "org.rogach" %% "scallop" % "0.9.4", "junit" % "junit" % "4.11" % "test", "org.scalatest" %% "scalatest" % "1.9.1" % "test" ) @@ -55,6 +55,14 @@ publishTo <<= (version) { version: String => Some("Sonatype Nexus Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2") } +publishTo <<= (version) { version: String => + val artifactory = "https://ci.aws.wordnik.com/artifactory/m2-" + if (version.trim.endsWith("SNAPSHOT")) + Some("snapshots" at artifactory + "snapshots") + else + Some("releases" at artifactory + "releases") +} + //publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository"))) diff --git a/src/main/resources/asyncscala/api.mustache b/src/main/resources/asyncscala/api.mustache index 44beb25ce11..9c685ed51fc 100644 --- a/src/main/resources/asyncscala/api.mustache +++ b/src/main/resources/asyncscala/api.mustache @@ -17,13 +17,12 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC {{paramName}}: Option[{{dataType}}] = {{#defaultValue}}Some({{{defaultValue}}}){{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{#hasMore}}, {{/hasMore}} {{/optional}} {{^optional}} - {{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}} - {{/optional}}{{/allParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = { + {{paramName}}: {{dataType}}{{#defaultValue}} = {{defaultValue}}{{/defaultValue}}{{#hasMore}}, {{/hasMore}} + {{/optional}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = { // create path and map variables - val path = - ("{{path}}" - replaceAll ("\\{format\\}", ser.name) - {{#pathParams}}replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString) + val path = + (addFmt("{{path}}"){{#pathParams}} + replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString) {{/pathParams}}) // query params @@ -42,9 +41,9 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC {{#headerParams}}headerParams += "{{baseName}}" -> {{paramName}}.toString {{/headerParams}} - val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}ser.serialize({{bodyParam}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}}) + val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}writer.write({{bodyParam}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}}) resFuture flatMap { resp => - process({{^returnType}}(){{/returnType}}{{#returnType}}ser.deserialize[{{returnType}}](resp.body) {{/returnType}}) + process(reader.read(resp)) } } diff --git a/src/main/resources/asyncscala/client.mustache b/src/main/resources/asyncscala/client.mustache index da211311553..dbbbf82e781 100644 --- a/src/main/resources/asyncscala/client.mustache +++ b/src/main/resources/asyncscala/client.mustache @@ -9,7 +9,6 @@ import java.io.Closeable class {{clientName}}(config: SwaggerConfig) extends Closeable { val locator = config.locator val name = config.name - val dataFormat = config.dataFormat private[this] val client = transportClient diff --git a/src/main/resources/asyncscala/model.mustache b/src/main/resources/asyncscala/model.mustache index 23bfd483922..3892f28302e 100644 --- a/src/main/resources/asyncscala/model.mustache +++ b/src/main/resources/asyncscala/model.mustache @@ -2,9 +2,6 @@ package {{package}} import org.joda.time.DateTime -{{#imports}}import {{import}} -{{/imports}} - {{#models}} {{#model}} diff --git a/src/main/resources/asyncscala/sbt.mustache b/src/main/resources/asyncscala/sbt.mustache index 63885794f99..f412735af0f 100644 --- a/src/main/resources/asyncscala/sbt.mustache +++ b/src/main/resources/asyncscala/sbt.mustache @@ -2,7 +2,7 @@ organization := "{{package}}" name := "{{projectName}}-client" -libraryDependencies += "com.wordnik.swagger" %% "swagger-async-httpclient" % "0.2.1" +libraryDependencies += "com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.0-WN4" libraryDependencies += "joda-time" % "joda-time" % "2.2"