forked from loafle/openapi-generator-original
adds bodyParamRequired
This commit is contained in:
parent
0a47fc23a3
commit
f17654cd96
@ -7,7 +7,7 @@ name := "swagger-codegen"
|
||||
|
||||
version := "2.0.10-SNAPSHOT"
|
||||
|
||||
scalaVersion := "2.9.1"
|
||||
scalaVersion := "2.10.0"
|
||||
|
||||
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-Xlint:deprecation")
|
||||
|
||||
|
@ -208,6 +208,7 @@ class Codegen(config: CodegenConfig) {
|
||||
val formParams = new ListBuffer[AnyRef]
|
||||
var paramList = new ListBuffer[HashMap[String, AnyRef]]
|
||||
var errorList = new ListBuffer[HashMap[String, AnyRef]]
|
||||
var bodyParamRequired: Option[String] = Some("true")
|
||||
|
||||
if (operation.responseMessages != null) {
|
||||
operation.responseMessages.foreach(param => {
|
||||
@ -255,8 +256,9 @@ class Codegen(config: CodegenConfig) {
|
||||
params += "baseName" -> "body"
|
||||
param.required match {
|
||||
case true => params += "required" -> "true"
|
||||
case _ =>
|
||||
case _ => bodyParamRequired = None
|
||||
}
|
||||
|
||||
bodyParam = Some("body")
|
||||
bodyParams += params.clone
|
||||
}
|
||||
@ -352,6 +354,7 @@ class Codegen(config: CodegenConfig) {
|
||||
"notes" -> operation.notes,
|
||||
"deprecated" -> operation.`deprecated`,
|
||||
"bodyParam" -> bodyParam,
|
||||
"bodyParamRequired" -> bodyParamRequired,
|
||||
"emptyBodyParam" -> (if (writeMethods contains operation.method.toUpperCase) "{}" else ""),
|
||||
"allParams" -> sp,
|
||||
"bodyParams" -> bodyParams.toList,
|
||||
|
Loading…
x
Reference in New Issue
Block a user