Skip to content

Commit 8325a12

Browse files
committed
fixed hasMore
1 parent 03abccd commit 8325a12

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,13 @@ class Codegen(config: CodegenConfig) {
385385
"httpMethodLowerCase" -> operation.method.toLowerCase,
386386
operation.method.toLowerCase -> "true")
387387
if (0 < operation.consumes.length) {
388-
val m = new HashMap[String, String]
389388
val o = new ListBuffer[Map[String, String]]
390389
for(i <- 0 until operation.consumes.length) {
391-
if(i < operation.consumes.length - 1)
390+
val m = new HashMap[String, String]
391+
if(i < (operation.consumes.length - 1)) {
392+
println(i + ", " + operation.consumes.length)
392393
m += "hasMore" -> "true"
394+
}
393395
m += "mediaType" -> operation.consumes(i)
394396
o += m.toMap
395397
}
@@ -398,10 +400,10 @@ class Codegen(config: CodegenConfig) {
398400
properties += "consumes" -> List(Map("mediaType" -> "application/json"))
399401
}
400402
if (0 < operation.produces.length) {
401-
val m = new HashMap[String, String]
402403
val o = new ListBuffer[Map[String, String]]
403404
for(i <- 0 until operation.produces.length) {
404-
if(i < operation.produces.length - 1)
405+
val m = new HashMap[String, String]
406+
if((i + 1) < operation.produces.length)
405407
m += "hasMore" -> "true"
406408
m += "mediaType" -> operation.produces(i)
407409
o += m.toMap

0 commit comments

Comments
 (0)