Skip to content

Commit 03abccd

Browse files
committed
fix for #154
1 parent 71eacaa commit 03abccd

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/main/scala/com/wordnik/swagger/codegen/Codegen.scala

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,30 @@ class Codegen(config: CodegenConfig) {
385385
"httpMethodLowerCase" -> operation.method.toLowerCase,
386386
operation.method.toLowerCase -> "true")
387387
if (0 < operation.consumes.length) {
388-
properties += "consume" -> operation.consumes(0)
388+
val m = new HashMap[String, String]
389+
val o = new ListBuffer[Map[String, String]]
390+
for(i <- 0 until operation.consumes.length) {
391+
if(i < operation.consumes.length - 1)
392+
m += "hasMore" -> "true"
393+
m += "mediaType" -> operation.consumes(i)
394+
o += m.toMap
395+
}
396+
properties += "consumes" -> o.toList
389397
} else {
390-
properties += "consume" -> "application/json"
398+
properties += "consumes" -> List(Map("mediaType" -> "application/json"))
391399
}
392400
if (0 < operation.produces.length) {
393-
properties += "produces" -> operation.produces
401+
val m = new HashMap[String, String]
402+
val o = new ListBuffer[Map[String, String]]
403+
for(i <- 0 until operation.produces.length) {
404+
if(i < operation.produces.length - 1)
405+
m += "hasMore" -> "true"
406+
m += "mediaType" -> operation.produces(i)
407+
o += m.toMap
408+
}
409+
properties += "produces" -> o.toList
394410
} else {
395-
properties += "produces" -> "application/json"
411+
properties += "produces" -> List(Map("mediaType" -> "application/json"))
396412
}
397413
if (requiredParams.size > 0) properties += "requiredParamCount" -> requiredParams.size.toString
398414
operation.responseClass.indexOf("[") match {

0 commit comments

Comments
 (0)