forked from loafle/openapi-generator-original
Modifying the pom.xml template because it defaults to building with Scala 2.9.1, but that is broken because BeanProperty moved, so instead use 2.10 as the default but add the option of using Scala 2.11
This commit is contained in:
parent
9d1f0bf568
commit
6f30a6d65a
@ -188,25 +188,34 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<profiles>
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>scala_2.11</id>
|
||||||
|
<properties>
|
||||||
|
<scala-version>2.11.2</scala-version>
|
||||||
|
<scala-short-version>2.11</scala-short-version>
|
||||||
|
<swagger-core-version>1.3.10</swagger-core-version>
|
||||||
|
<scala-test-version>2.2.2</scala-test-version>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>scala_2.10</id>
|
<id>scala_2.10</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>true</activeByDefault>
|
||||||
|
</activation>
|
||||||
<properties>
|
<properties>
|
||||||
<scala-version>2.10.3</scala-version>
|
<scala-version>2.10.3</scala-version>
|
||||||
<scala-short-version>2.10</scala-short-version>
|
<scala-short-version>2.10</scala-short-version>
|
||||||
<swagger-core-version>1.3.2</swagger-core-version>
|
<swagger-core-version>1.3.10</swagger-core-version>
|
||||||
<scala-test-version>2.1.2</scala-test-version>
|
<scala-test-version>2.1.2</scala-test-version>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>scala_2.9.1</id>
|
<id>scala_2.9.1</id>
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
<properties>
|
||||||
<scala-version>2.9.1-1</scala-version>
|
<scala-version>2.9.1-1</scala-version>
|
||||||
<scala-short-version>2.9.1</scala-short-version>
|
<scala-short-version>2.9.1</scala-short-version>
|
||||||
<swagger-core-version>1.1.0</swagger-core-version>
|
<swagger-core-version>1.3.1</swagger-core-version>
|
||||||
<scala-test-version>1.6.1</scala-test-version>
|
<scala-test-version>1.9.2</scala-test-version>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
@ -215,7 +224,7 @@
|
|||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<maven-plugin.version>1.0.0</maven-plugin.version>
|
<maven-plugin.version>1.0.0</maven-plugin.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.2.0</scala-maven-plugin-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
@ -15,6 +15,34 @@ class PetApi {
|
|||||||
|
|
||||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||||
|
|
||||||
|
def deletePet (petId: String) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
"application/json"}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
(List(petId).filter(_ != null)).size match {
|
||||||
|
case 1 => // all required values set
|
||||||
|
case _ => throw new Exception("missing required params")
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
def getPetById (petId: Long) : Option[Pet]= {
|
def getPetById (petId: Long) : Option[Pet]= {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||||
@ -44,34 +72,6 @@ class PetApi {
|
|||||||
case ex: ApiException => throw ex
|
case ex: ApiException => throw ex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def deletePet (petId: String) = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val contentType = {
|
|
||||||
"application/json"}
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new HashMap[String, String]
|
|
||||||
val headerParams = new HashMap[String, String]
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
(List(petId).filter(_ != null)).size match {
|
|
||||||
case 1 => // all required values set
|
|
||||||
case _ => throw new Exception("missing required params")
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
apiInvoker.invokeApi(basePath, path, "DELETE", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
|
||||||
case s: String =>
|
|
||||||
case _ => None
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
case ex: ApiException if ex.code == 404 => None
|
|
||||||
case ex: ApiException => throw ex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
def partialUpdate (petId: String, body: Pet) : Option[List[Pet]]= {
|
def partialUpdate (petId: String, body: Pet) : Option[List[Pet]]= {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
val path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}",apiInvoker.escape(petId))
|
||||||
@ -132,30 +132,6 @@ class PetApi {
|
|||||||
case ex: ApiException => throw ex
|
case ex: ApiException => throw ex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def uploadFile (additionalMetadata: String, body: File) = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = "/pet/uploadImage".replaceAll("\\{format\\}","json")
|
|
||||||
|
|
||||||
val contentType = {
|
|
||||||
if(body != null && body.isInstanceOf[File] )
|
|
||||||
"multipart/form-data"
|
|
||||||
else "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new HashMap[String, String]
|
|
||||||
val headerParams = new HashMap[String, String]
|
|
||||||
|
|
||||||
try {
|
|
||||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
|
||||||
case s: String =>
|
|
||||||
case _ => None
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
case ex: ApiException if ex.code == 404 => None
|
|
||||||
case ex: ApiException => throw ex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
def addPet (body: Pet) = {
|
def addPet (body: Pet) = {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = "/pet".replaceAll("\\{format\\}","json")
|
val path = "/pet".replaceAll("\\{format\\}","json")
|
||||||
@ -270,5 +246,26 @@ class PetApi {
|
|||||||
case ex: ApiException => throw ex
|
case ex: ApiException => throw ex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
def uploadFile (additionalMetadata: String, file: File) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/pet/uploadImage".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
"application/json"}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, None, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,93 @@ class UserApi {
|
|||||||
|
|
||||||
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value
|
||||||
|
|
||||||
|
def createUser (body: User) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/user".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
(List(body).filter(_ != null)).size match {
|
||||||
|
case 1 => // all required values set
|
||||||
|
case _ => throw new Exception("missing required params")
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def createUsersWithArrayInput (body: List[User]) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/user/createWithArray".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
(List(body).filter(_ != null)).size match {
|
||||||
|
case 1 => // all required values set
|
||||||
|
case _ => throw new Exception("missing required params")
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def createUsersWithListInput (body: List[User]) = {
|
||||||
|
// create path and map variables
|
||||||
|
val path = "/user/createWithList".replaceAll("\\{format\\}","json")
|
||||||
|
|
||||||
|
val contentType = {
|
||||||
|
if(body != null && body.isInstanceOf[File] )
|
||||||
|
"multipart/form-data"
|
||||||
|
else "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
// query params
|
||||||
|
val queryParams = new HashMap[String, String]
|
||||||
|
val headerParams = new HashMap[String, String]
|
||||||
|
|
||||||
|
// verify required params are set
|
||||||
|
(List(body).filter(_ != null)).size match {
|
||||||
|
case 1 => // all required values set
|
||||||
|
case _ => throw new Exception("missing required params")
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
||||||
|
case s: String =>
|
||||||
|
case _ => None
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
case ex: ApiException if ex.code == 404 => None
|
||||||
|
case ex: ApiException => throw ex
|
||||||
|
}
|
||||||
|
}
|
||||||
def updateUser (username: String, body: User) = {
|
def updateUser (username: String, body: User) = {
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
val path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}",apiInvoker.escape(username))
|
||||||
@ -153,92 +240,5 @@ class UserApi {
|
|||||||
case ex: ApiException => throw ex
|
case ex: ApiException => throw ex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def createUser (body: User) = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = "/user".replaceAll("\\{format\\}","json")
|
|
||||||
|
|
||||||
val contentType = {
|
|
||||||
if(body != null && body.isInstanceOf[File] )
|
|
||||||
"multipart/form-data"
|
|
||||||
else "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new HashMap[String, String]
|
|
||||||
val headerParams = new HashMap[String, String]
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
(List(body).filter(_ != null)).size match {
|
|
||||||
case 1 => // all required values set
|
|
||||||
case _ => throw new Exception("missing required params")
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
|
||||||
case s: String =>
|
|
||||||
case _ => None
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
case ex: ApiException if ex.code == 404 => None
|
|
||||||
case ex: ApiException => throw ex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
def createUsersWithArrayInput (body: List[User]) = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = "/user/createWithArray".replaceAll("\\{format\\}","json")
|
|
||||||
|
|
||||||
val contentType = {
|
|
||||||
if(body != null && body.isInstanceOf[File] )
|
|
||||||
"multipart/form-data"
|
|
||||||
else "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new HashMap[String, String]
|
|
||||||
val headerParams = new HashMap[String, String]
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
(List(body).filter(_ != null)).size match {
|
|
||||||
case 1 => // all required values set
|
|
||||||
case _ => throw new Exception("missing required params")
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
|
||||||
case s: String =>
|
|
||||||
case _ => None
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
case ex: ApiException if ex.code == 404 => None
|
|
||||||
case ex: ApiException => throw ex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
def createUsersWithListInput (body: List[User]) = {
|
|
||||||
// create path and map variables
|
|
||||||
val path = "/user/createWithList".replaceAll("\\{format\\}","json")
|
|
||||||
|
|
||||||
val contentType = {
|
|
||||||
if(body != null && body.isInstanceOf[File] )
|
|
||||||
"multipart/form-data"
|
|
||||||
else "application/json"
|
|
||||||
}
|
|
||||||
|
|
||||||
// query params
|
|
||||||
val queryParams = new HashMap[String, String]
|
|
||||||
val headerParams = new HashMap[String, String]
|
|
||||||
|
|
||||||
// verify required params are set
|
|
||||||
(List(body).filter(_ != null)).size match {
|
|
||||||
case 1 => // all required values set
|
|
||||||
case _ => throw new Exception("missing required params")
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
apiInvoker.invokeApi(basePath, path, "POST", queryParams.toMap, body, headerParams.toMap, contentType) match {
|
|
||||||
case s: String =>
|
|
||||||
case _ => None
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
case ex: ApiException if ex.code == 404 => None
|
|
||||||
case ex: ApiException => throw ex
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class PetApiTest extends FlatSpec with Matchers {
|
|||||||
Category(1, "sold"),
|
Category(1, "sold"),
|
||||||
"dragon",
|
"dragon",
|
||||||
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
||||||
(for (i <- (1 to 5)) yield Tag(i, "tag-" + i)).toList,
|
(for (i <- (1 to 5)) yield com.wordnik.petstore.model.Tag(i, "tag-" + i)).toList,
|
||||||
"lost"
|
"lost"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class PetApiTest extends FlatSpec with Matchers {
|
|||||||
Category(1, "sold"),
|
Category(1, "sold"),
|
||||||
"programmer",
|
"programmer",
|
||||||
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
(for (i <- (1 to 10)) yield "http://foo.com/photo/" + i).toList,
|
||||||
(for (i <- (1 to 5)) yield Tag(i, "tag-" + i)).toList,
|
(for (i <- (1 to 5)) yield com.wordnik.petstore.model.Tag(i, "tag-" + i)).toList,
|
||||||
"confused"
|
"confused"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -101,4 +101,4 @@ class PetApiTest extends FlatSpec with Matchers {
|
|||||||
case None => fail("didn't find pets by tag")
|
case None => fail("didn't find pets by tag")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,25 +188,34 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<profiles>
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>scala_2.11</id>
|
||||||
|
<properties>
|
||||||
|
<scala-version>2.11.2</scala-version>
|
||||||
|
<scala-short-version>2.11</scala-short-version>
|
||||||
|
<swagger-core-version>1.3.10</swagger-core-version>
|
||||||
|
<scala-test-version>2.2.2</scala-test-version>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>scala_2.10</id>
|
<id>scala_2.10</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>true</activeByDefault>
|
||||||
|
</activation>
|
||||||
<properties>
|
<properties>
|
||||||
<scala-version>2.10.3</scala-version>
|
<scala-version>2.10.3</scala-version>
|
||||||
<scala-short-version>2.10</scala-short-version>
|
<scala-short-version>2.10</scala-short-version>
|
||||||
<swagger-core-version>1.3.2</swagger-core-version>
|
<swagger-core-version>1.3.10</swagger-core-version>
|
||||||
<scala-test-version>2.1.2</scala-test-version>
|
<scala-test-version>2.1.2</scala-test-version>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>scala_2.9.1</id>
|
<id>scala_2.9.1</id>
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
<properties>
|
||||||
<scala-version>2.9.1-1</scala-version>
|
<scala-version>2.9.1-1</scala-version>
|
||||||
<scala-short-version>2.9.1</scala-short-version>
|
<scala-short-version>2.9.1</scala-short-version>
|
||||||
<swagger-core-version>1.1.0</swagger-core-version>
|
<swagger-core-version>1.3.1</swagger-core-version>
|
||||||
<scala-test-version>1.6.1</scala-test-version>
|
<scala-test-version>1.9.2</scala-test-version>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
@ -215,6 +224,6 @@
|
|||||||
<junit-version>4.8.1</junit-version>
|
<junit-version>4.8.1</junit-version>
|
||||||
<maven-plugin.version>1.0.0</maven-plugin.version>
|
<maven-plugin.version>1.0.0</maven-plugin.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.2.0</scala-maven-plugin-version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user