Skip to content

Commit f17654c

Browse files
committed
adds bodyParamRequired
1 parent 0a47fc2 commit f17654c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name := "swagger-codegen"
77

88
version := "2.0.10-SNAPSHOT"
99

10-
scalaVersion := "2.9.1"
10+
scalaVersion := "2.10.0"
1111

1212
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-Xlint:deprecation")
1313

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ class Codegen(config: CodegenConfig) {
208208
val formParams = new ListBuffer[AnyRef]
209209
var paramList = new ListBuffer[HashMap[String, AnyRef]]
210210
var errorList = new ListBuffer[HashMap[String, AnyRef]]
211+
var bodyParamRequired: Option[String] = Some("true")
211212

212213
if (operation.responseMessages != null) {
213214
operation.responseMessages.foreach(param => {
@@ -255,8 +256,9 @@ class Codegen(config: CodegenConfig) {
255256
params += "baseName" -> "body"
256257
param.required match {
257258
case true => params += "required" -> "true"
258-
case _ =>
259+
case _ => bodyParamRequired = None
259260
}
261+
260262
bodyParam = Some("body")
261263
bodyParams += params.clone
262264
}
@@ -352,6 +354,7 @@ class Codegen(config: CodegenConfig) {
352354
"notes" -> operation.notes,
353355
"deprecated" -> operation.`deprecated`,
354356
"bodyParam" -> bodyParam,
357+
"bodyParamRequired" -> bodyParamRequired,
355358
"emptyBodyParam" -> (if (writeMethods contains operation.method.toUpperCase) "{}" else ""),
356359
"allParams" -> sp,
357360
"bodyParams" -> bodyParams.toList,

0 commit comments

Comments
 (0)