forked from loafle/openapi-generator-original
Merge remote-tracking branch 'upstream/master' into fix-no-content
Conflicts: samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java
This commit is contained in:
@@ -10,6 +10,12 @@ public class {{classname}} {
|
||||
{{#description}}/* {{{description}}} */
|
||||
{{/description}}
|
||||
private {{{datatype}}} {{name}} = {{{defaultValue}}};
|
||||
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}
|
||||
{{/min}}
|
||||
//{{^min}}public enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };
|
||||
{{/min}}
|
||||
{{/allowableValues}}
|
||||
|
||||
{{/vars}}
|
||||
|
||||
{{#vars}}
|
||||
|
||||
@@ -188,6 +188,19 @@ class Codegen(config: CodegenConfig) {
|
||||
(srcName, engine -> template)
|
||||
}
|
||||
|
||||
def rawAllowableValuesToString(v: AllowableValues) = {
|
||||
v match {
|
||||
case av: AllowableListValues => {
|
||||
av
|
||||
}
|
||||
case av: AllowableRangeValues => {
|
||||
av
|
||||
}
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def allowableValuesToString(v: AllowableValues) = {
|
||||
v match {
|
||||
case av: AllowableListValues => {
|
||||
@@ -306,6 +319,11 @@ class Codegen(config: CodegenConfig) {
|
||||
case _ => requiredParams.last.asInstanceOf[HashMap[String, String]] -= "hasMore"
|
||||
}
|
||||
|
||||
headerParams.size match {
|
||||
case 0 =>
|
||||
case _ => headerParams.last.asInstanceOf[HashMap[String, String]] -= "hasMore"
|
||||
}
|
||||
|
||||
queryParams.size match {
|
||||
case 0 =>
|
||||
case _ => queryParams.last.asInstanceOf[HashMap[String, String]] -= "hasMore"
|
||||
@@ -466,6 +484,7 @@ class Codegen(config: CodegenConfig) {
|
||||
"defaultValue" -> config.toDeclaration(propertyDocSchema)._2,
|
||||
"description" -> propertyDocSchema.description,
|
||||
"notes" -> propertyDocSchema.description,
|
||||
"allowableValues" -> rawAllowableValuesToString(propertyDocSchema.allowableValues),
|
||||
(if(propertyDocSchema.required) "required" else "isNotRequired") -> "true",
|
||||
"getter" -> config.toGetter(prop._1, config.toDeclaration(propertyDocSchema)._1),
|
||||
"setter" -> config.toSetter(prop._1, config.toDeclaration(propertyDocSchema)._1),
|
||||
|
||||
@@ -347,10 +347,16 @@ object SwaggerSerializers {
|
||||
else {
|
||||
val min = (json \ "min") match {
|
||||
case e: JObject => e.extract[String]
|
||||
case e: JString => e.s
|
||||
case e: JInt => e.num.toString
|
||||
case e: JDouble => e.num.toString
|
||||
case _ => ""
|
||||
}
|
||||
val max = (json \ "max") match {
|
||||
case e: JObject => e.extract[String]
|
||||
case e: JString => e.s
|
||||
case e: JInt => e.num.toString
|
||||
case e: JDouble => e.num.toString
|
||||
case _ => ""
|
||||
}
|
||||
if(min != "" && max != "")
|
||||
|
||||
Reference in New Issue
Block a user