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"
|
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")
|
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]
|
val formParams = new ListBuffer[AnyRef]
|
||||||
var paramList = new ListBuffer[HashMap[String, AnyRef]]
|
var paramList = new ListBuffer[HashMap[String, AnyRef]]
|
||||||
var errorList = new ListBuffer[HashMap[String, AnyRef]]
|
var errorList = new ListBuffer[HashMap[String, AnyRef]]
|
||||||
|
var bodyParamRequired: Option[String] = Some("true")
|
||||||
|
|
||||||
if (operation.responseMessages != null) {
|
if (operation.responseMessages != null) {
|
||||||
operation.responseMessages.foreach(param => {
|
operation.responseMessages.foreach(param => {
|
||||||
@ -255,8 +256,9 @@ class Codegen(config: CodegenConfig) {
|
|||||||
params += "baseName" -> "body"
|
params += "baseName" -> "body"
|
||||||
param.required match {
|
param.required match {
|
||||||
case true => params += "required" -> "true"
|
case true => params += "required" -> "true"
|
||||||
case _ =>
|
case _ => bodyParamRequired = None
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyParam = Some("body")
|
bodyParam = Some("body")
|
||||||
bodyParams += params.clone
|
bodyParams += params.clone
|
||||||
}
|
}
|
||||||
@ -352,6 +354,7 @@ class Codegen(config: CodegenConfig) {
|
|||||||
"notes" -> operation.notes,
|
"notes" -> operation.notes,
|
||||||
"deprecated" -> operation.`deprecated`,
|
"deprecated" -> operation.`deprecated`,
|
||||||
"bodyParam" -> bodyParam,
|
"bodyParam" -> bodyParam,
|
||||||
|
"bodyParamRequired" -> bodyParamRequired,
|
||||||
"emptyBodyParam" -> (if (writeMethods contains operation.method.toUpperCase) "{}" else ""),
|
"emptyBodyParam" -> (if (writeMethods contains operation.method.toUpperCase) "{}" else ""),
|
||||||
"allParams" -> sp,
|
"allParams" -> sp,
|
||||||
"bodyParams" -> bodyParams.toList,
|
"bodyParams" -> bodyParams.toList,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user