Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import com.sun.jersey.multipart.file.FileDataBodyPart
import com.wordnik.swagger.client._
import com.wordnik.swagger.client.ClientResponseReaders.Json4sFormatsReader._
import com.wordnik.swagger.client.RequestWriters.Json4sFormatsWriter._
import javax.ws.rs.core.Response.Status.Family

import java.net.URI
import java.io.File
import java.util.Date
import java.util.TimeZone
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.{MediaType, Response}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
Expand Down Expand Up @@ -144,7 +145,11 @@ class {{classname}}AsyncHelper(client: TransportClient, config: SwaggerConfig) e

val resFuture = client.submit("{{httpMethod}}", path, queryParams.toMap, headerParams.toMap, {{#bodyParam}}writer.write({{paramName}}){{/bodyParam}}{{^bodyParam}}"{{emptyBodyParam}}"{{/bodyParam}})
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's semantically incorrect to treat informational and redirection as errors. there is valuable information in the headers that should be sent back to the client. for instance, when you get a redirect, the header location will tell you where to go. can you please shed some light on the motivation for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I pushed a fix for informational and redirection statuses, please take a look.

}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# scala specific
*.class
*.log

Expand All @@ -15,3 +16,7 @@ project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet

# IntelliJ specific
.idea
*.iml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.iml should not be ignored. See reasoning: toptal/gitignore.io#186 (comment)

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
3.3.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'idea'
apply plugin: 'eclipse'

group = 'io.swagger'
group = 'org.openapitools'
version = '1.0.0'

buildscript {
Expand Down Expand Up @@ -84,7 +84,7 @@ if(hasProperty('target') && target == 'android') {

install {
repositories.mavenInstaller {
pom.artifactId = 'swagger-scala-client'
pom.artifactId = 'openapi-scala-client'
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version := "1.0.0"
name := "swagger-scala-client"
organization := "io.swagger"
name := "openapi-scala-client"
organization := "org.openapitools"
scalaVersion := "2.11.12"

libraryDependencies ++= Seq(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"

git_user_id=$1
git_repo_id=$2
Expand Down
13 changes: 6 additions & 7 deletions samples/client/petstore-security-test/scala-httpclient/pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-scala-client</artifactId>
<groupId>org.openapitools</groupId>
<artifactId>openapi-scala-client</artifactId>
<packaging>jar</packaging>
<name>swagger-scala-client</name>
<name>openapi-scala-client</name>
<version>1.0.0</version>

<pluginRepositories>
Expand Down Expand Up @@ -124,8 +124,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>
1.7</source>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Expand Down Expand Up @@ -232,7 +231,7 @@
<dependency>
<groupId>com.wordnik.swagger</groupId>
<artifactId>swagger-async-httpclient_2.11</artifactId>
<version>${swagger-async-httpclient-version}</version>
<version>${async-httpclient-version}</version>
</dependency>
</dependencies>
<properties>
Expand All @@ -248,7 +247,7 @@
<junit-version>4.12</junit-version>
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
<scala-test-version>3.0.4</scala-test-version>
<swagger-async-httpclient-version>0.3.5</swagger-async-httpclient-version>
<async-httpclient-version>0.3.5</async-httpclient-version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "swagger-scala-client"
rootProject.name = "openapi-scala-client"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.0-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ import com.sun.jersey.multipart.file.FileDataBodyPart
import com.wordnik.swagger.client._
import com.wordnik.swagger.client.ClientResponseReaders.Json4sFormatsReader._
import com.wordnik.swagger.client.RequestWriters.Json4sFormatsWriter._
import javax.ws.rs.core.Response.Status.Family

import java.net.URI
import java.io.File
import java.util.Date
import java.util.TimeZone
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.{MediaType, Response}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
Expand Down Expand Up @@ -309,7 +310,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(pet))
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -331,7 +336,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -348,7 +357,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -365,7 +378,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -381,7 +398,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -397,7 +418,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("PUT", path, queryParams.toMap, headerParams.toMap, writer.write(pet))
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -416,7 +441,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -435,7 +464,11 @@ class PetApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extends

val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import com.sun.jersey.multipart.file.FileDataBodyPart
import com.wordnik.swagger.client._
import com.wordnik.swagger.client.ClientResponseReaders.Json4sFormatsReader._
import com.wordnik.swagger.client.RequestWriters.Json4sFormatsWriter._
import javax.ws.rs.core.Response.Status.Family

import java.net.URI
import java.io.File
import java.util.Date
import java.util.TimeZone
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.{MediaType, Response}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent._
Expand Down Expand Up @@ -193,7 +194,11 @@ class StoreApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extend

val resFuture = client.submit("DELETE", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -208,7 +213,11 @@ class StoreApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extend

val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -224,7 +233,11 @@ class StoreApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extend

val resFuture = client.submit("GET", path, queryParams.toMap, headerParams.toMap, "")
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand All @@ -240,7 +253,11 @@ class StoreApiAsyncHelper(client: TransportClient, config: SwaggerConfig) extend

val resFuture = client.submit("POST", path, queryParams.toMap, headerParams.toMap, writer.write(order))
resFuture flatMap { resp =>
process(reader.read(resp))
val status = Response.Status.fromStatusCode(resp.statusCode)
status.getFamily match {
case Family.SUCCESSFUL => process(reader.read(resp))
case _ => throw new ApiException(resp.statusCode, resp.statusText)
}
}
}

Expand Down
Loading