mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
merged pom + invoker changes, added correct mapping for list
This commit is contained in:
parent
d9d6cc1e76
commit
74543f75f9
@ -83,7 +83,7 @@ object ApiInvoker {
|
||||
val client = getClient(host)
|
||||
|
||||
val querystring = queryParams.filter(k => k._2 != null).map(k => (escapeString(k._1) + "=" + escapeString(k._2))).mkString("?", "&", "")
|
||||
val builder = client.resource(host + path + querystring).`type`(contentType)
|
||||
val builder = client.resource(host + path + querystring).accept(contentType)
|
||||
|
||||
headerParams.map(p => builder.header(p._1, p._2))
|
||||
defaultHeaders.map(p => {
|
||||
@ -106,11 +106,13 @@ object ApiInvoker {
|
||||
builder.post(classOf[ClientResponse], form)
|
||||
}
|
||||
else {
|
||||
builder.post(classOf[ClientResponse], serialize(body))
|
||||
if(body == null) builder.post(classOf[ClientResponse], serialize(body))
|
||||
else builder.`type`(contentType).post(classOf[ClientResponse], serialize(body))
|
||||
}
|
||||
}
|
||||
case "PUT" => {
|
||||
builder.put(classOf[ClientResponse], serialize(body))
|
||||
if(body == null) builder.put(classOf[ClientResponse], null)
|
||||
else builder.`type`(contentType).put(classOf[ClientResponse], serialize(body))
|
||||
}
|
||||
case "DELETE" => {
|
||||
builder.delete(classOf[ClientResponse])
|
||||
|
@ -109,9 +109,9 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.scala-tools</groupId>
|
||||
<artifactId>maven-scala-plugin</artifactId>
|
||||
<version>2.15.2</version>
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>scala-maven-plugin</artifactId>
|
||||
<version>${scala-maven-plugin-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>scala-compile-first</id>
|
||||
@ -196,5 +196,6 @@
|
||||
<scala-test-version>1.6.1</scala-test-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<scala-test-version>1.6.1</scala-test-version>
|
||||
<scala-maven-plugin-version>3.1.5</scala-maven-plugin-version>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -89,6 +89,16 @@ class BasicScalaGenerator extends BasicGenerator {
|
||||
val e = "List[%s]" format toDeclaredType(inner)
|
||||
(e, toDefaultValue(inner, obj))
|
||||
}
|
||||
case "List" => {
|
||||
val inner = {
|
||||
obj.items match {
|
||||
case Some(items) => items.ref.getOrElse(items.`type`)
|
||||
case _ => throw new Exception("no inner type defined")
|
||||
}
|
||||
}
|
||||
val e = "List[%s]" format toDeclaredType(inner)
|
||||
(e, toDefaultValue(inner, obj))
|
||||
}
|
||||
case e: String => (toDeclaredType(e), toDefaultValue(e, obj))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user