-
Notifications
You must be signed in to change notification settings - Fork 6k
[Scala] add async support to Scala API client #5115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
16d9191
Add async support to scala client.
clasnake 3a90551
Format api endpoints.
clasnake c224c8d
Modify build.sbt.
clasnake 564a1f1
Change date format and pass StoreApis tests.
clasnake 386ae73
Add StringReader and StringWriter to support string serialization/des…
clasnake 9b90f78
update petstore samples for scala clients
wing328 ae4fe1a
Update maven and gradle dependency. Update tests to pass compilation.
clasnake 449d34e
Merge branch '2.3.0' into pr4855_cherrypick
wing328 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,4 @@ class {{clientName}}(config: SwaggerConfig) extends Closeable { | |
| client.close() | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 34 additions & 33 deletions
67
modules/swagger-codegen/src/main/resources/scala/build.sbt.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,34 @@ | ||
| 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 | ||
| ) | ||
| 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", | ||
| "com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.5" | ||
| ) | ||
|
|
||
| resolvers ++= Seq( | ||
| Resolver.mavenLocal | ||
| ) | ||
|
|
||
| scalacOptions := Seq( | ||
| "-unchecked", | ||
| "-deprecation", | ||
| "-feature" | ||
| ) | ||
|
|
||
| publishArtifact in (Compile, packageDoc) := false | ||
|
|
22 changes: 22 additions & 0 deletions
22
modules/swagger-codegen/src/main/resources/scala/client.mustache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package {{invokerPackage}} | ||
|
|
||
| {{#imports}}import {{import}} | ||
| {{/imports}} | ||
| import {{apiPackage}}._ | ||
|
|
||
| import com.wordnik.swagger.client._ | ||
|
|
||
| import java.io.Closeable | ||
|
|
||
| class {{clientName}}(config: SwaggerConfig) extends Closeable { | ||
| val locator = config.locator | ||
| val name = config.name | ||
|
|
||
| private[this] val client = transportClient | ||
|
|
||
| protected def transportClient: TransportClient = new RestClient(config) | ||
|
|
||
| def close() { | ||
| client.close() | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was probably missed during a merge conflict. It should be
scala.collection.mutable.ListBufferThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codeniko thanks for reviewing.
@clasnake can you please take a look when you've time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. I'll change the underlying library to akka-http and try to consolidate all three Scala clients into one(In a separate PR later). In fact that's the one I use in my daily work.