From ee630337b9b18678b8ebf0296db1c331af41e9cf Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Thu, 16 Jun 2016 20:43:58 -0400 Subject: [PATCH 1/2] [scala] Add SBT buid support for scala client --- .../codegen/languages/ScalaClientCodegen.java | 2 ++ .../main/resources/scala/build.sbt.mustache | 33 +++++++++++++++++++ samples/client/petstore/scala/build.sbt | 33 +++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 modules/swagger-codegen/src/main/resources/scala/build.sbt.mustache create mode 100644 samples/client/petstore/scala/build.sbt diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java index 12467f12efe..b740ba552a1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/ScalaClientCodegen.java @@ -87,6 +87,8 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile( "gradle-wrapper.jar", gradleWrapperPackage.replace( ".", File.separator ), "gradle-wrapper.jar") ); + supportingFiles.add(new SupportingFile("build.sbt.mustache", "", "build.sbt")); + importMapping.remove("List"); importMapping.remove("Set"); importMapping.remove("Map"); diff --git a/modules/swagger-codegen/src/main/resources/scala/build.sbt.mustache b/modules/swagger-codegen/src/main/resources/scala/build.sbt.mustache new file mode 100644 index 00000000000..6a198acb832 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/scala/build.sbt.mustache @@ -0,0 +1,33 @@ +lazy val root = (project in file(".")). + settings( + version := "{{artifactVersion}}", + name := "{{artifactId}}", + organization := "{{groupId}}", + scalaVersion := "2.11.8", + + libraryDependencies ++= Seq( + "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.4.2", + "com.sun.jersey" % "jersey-core" % "1.19", + "com.sun.jersey" % "jersey-client" % "1.19", + "com.sun.jersey.contribs" % "jersey-multipart" % "1.19", + "org.jfarcand" % "jersey-ahc-client" % "1.0.5", + "io.swagger" % "swagger-core" % "1.5.8", + "joda-time" % "joda-time" % "2.2", + "org.joda" % "joda-convert" % "1.2", + "org.scalatest" %% "scalatest" % "2.2.4" % "test", + "junit" % "junit" % "4.8.1" % "test" + ), + + resolvers ++= Seq( + Resolver.jcenterRepo, + Resolver.mavenLocal + ), + + scalacOptions := Seq( + "-unchecked", + "-deprecation", + "-feature" + ), + + publishArtifact in (Compile, packageDoc) := false + ) \ No newline at end of file diff --git a/samples/client/petstore/scala/build.sbt b/samples/client/petstore/scala/build.sbt new file mode 100644 index 00000000000..063b2b0d490 --- /dev/null +++ b/samples/client/petstore/scala/build.sbt @@ -0,0 +1,33 @@ +lazy val root = (project in file(".")). + settings( + version := "1.0.0", + name := "swagger-scala-client", + organization := "io.swagger", + scalaVersion := "2.11.8", + + libraryDependencies ++= Seq( + "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.4.2", + "com.sun.jersey" % "jersey-core" % "1.19", + "com.sun.jersey" % "jersey-client" % "1.19", + "com.sun.jersey.contribs" % "jersey-multipart" % "1.19", + "org.jfarcand" % "jersey-ahc-client" % "1.0.5", + "io.swagger" % "swagger-core" % "1.5.8", + "joda-time" % "joda-time" % "2.2", + "org.joda" % "joda-convert" % "1.2", + "org.scalatest" %% "scalatest" % "2.2.4" % "test", + "junit" % "junit" % "4.8.1" % "test" + ), + + resolvers ++= Seq( + Resolver.jcenterRepo, + Resolver.mavenLocal + ), + + scalacOptions := Seq( + "-unchecked", + "-deprecation", + "-feature" + ), + + publishArtifact in (Compile, packageDoc) := false + ) \ No newline at end of file From 04748484baa72336da89e07911636b1ad27db3d8 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sat, 18 Jun 2016 15:08:55 +0800 Subject: [PATCH 2/2] remove println from scala test --- .../scala/src/main/scala/io/swagger/client/api/PetApi.scala | 2 +- samples/client/petstore/scala/src/test/scala/PetApiTest.scala | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala index 3208eb938d5..f7e82cd1b61 100644 --- a/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -1,8 +1,8 @@ package io.swagger.client.api import io.swagger.client.model.Pet -import java.io.File import io.swagger.client.model.ApiResponse +import java.io.File import io.swagger.client.ApiInvoker import io.swagger.client.ApiException diff --git a/samples/client/petstore/scala/src/test/scala/PetApiTest.scala b/samples/client/petstore/scala/src/test/scala/PetApiTest.scala index dc0fca27b28..426df5871ac 100644 --- a/samples/client/petstore/scala/src/test/scala/PetApiTest.scala +++ b/samples/client/petstore/scala/src/test/scala/PetApiTest.scala @@ -80,7 +80,6 @@ class PetApiTest extends FlatSpec with Matchers { } it should "find pets by tag" in { - println("finding by tags") api.findPetsByTags(List("tag1", "tag2")) match { case Some(pets) => { pets.foreach(pet => {