Skip to content

Commit cc756b5

Browse files
gmarzwing328
authored andcommitted
[Scala] Properly handle csv collectionFormat (#6540)
* Add support for lists of path parameters (eg instances), and default params for optional case classes * Update Petstore sample * Revert defaulting of case class fields to None * Update Petstore sample
1 parent 5b32e88 commit cc756b5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

modules/swagger-codegen/src/main/resources/scala/apiInvoker.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
5353
def escape(value: String): String = {
5454
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
5555
}
56+
def escape(values: List[String]): String = {
57+
values.map(escape).mkString(",")
58+
}
5659

5760
def escape(value: Long): String = value.toString
5861
def escape(value: Double): String = value.toString

samples/client/petstore-security-test/scala/src/main/scala/io/swagger/client/ApiInvoker.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
6363
def escape(value: String): String = {
6464
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
6565
}
66+
def escape(values: List[String]): String = {
67+
values.map(escape).mkString(",")
68+
}
6669

6770
def escape(value: Long): String = value.toString
6871

samples/client/petstore/scala/src/main/scala/io/swagger/client/ApiInvoker.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class ApiInvoker(val mapper: ObjectMapper = ScalaJsonUtil.getJsonMapper,
6464
def escape(value: String): String = {
6565
URLEncoder.encode(value, "utf-8").replaceAll("\\+", "%20")
6666
}
67+
def escape(values: List[String]): String = {
68+
values.map(escape).mkString(",")
69+
}
6770

6871
def escape(value: Long): String = value.toString
6972
def escape(value: Double): String = value.toString

0 commit comments

Comments
 (0)