From 8325a12fafe9e0119cbbfc3f209901fe6f38d211 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Tue, 4 Mar 2014 20:05:16 -0800 Subject: [PATCH] fixed hasMore --- .../scala/com/wordnik/swagger/codegen/Codegen.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala b/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala index 684a0751108..da763feb36c 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala @@ -385,11 +385,13 @@ class Codegen(config: CodegenConfig) { "httpMethodLowerCase" -> operation.method.toLowerCase, operation.method.toLowerCase -> "true") if (0 < operation.consumes.length) { - val m = new HashMap[String, String] val o = new ListBuffer[Map[String, String]] for(i <- 0 until operation.consumes.length) { - if(i < operation.consumes.length - 1) + val m = new HashMap[String, String] + if(i < (operation.consumes.length - 1)) { + println(i + ", " + operation.consumes.length) m += "hasMore" -> "true" + } m += "mediaType" -> operation.consumes(i) o += m.toMap } @@ -398,10 +400,10 @@ class Codegen(config: CodegenConfig) { properties += "consumes" -> List(Map("mediaType" -> "application/json")) } if (0 < operation.produces.length) { - val m = new HashMap[String, String] val o = new ListBuffer[Map[String, String]] for(i <- 0 until operation.produces.length) { - if(i < operation.produces.length - 1) + val m = new HashMap[String, String] + if((i + 1) < operation.produces.length) m += "hasMore" -> "true" m += "mediaType" -> operation.produces(i) o += m.toMap