forked from loafle/openapi-generator-original
added check, fix for #1103
This commit is contained in:
parent
b68beefa69
commit
44b4af0374
@ -636,7 +636,9 @@ public class DefaultCodegen {
|
|||||||
if (np.getMaximum() != null) {
|
if (np.getMaximum() != null) {
|
||||||
allowableValues.put("max", np.getMaximum());
|
allowableValues.put("max", np.getMaximum());
|
||||||
}
|
}
|
||||||
property.allowableValues = allowableValues;
|
if(allowableValues.size() > 0) {
|
||||||
|
property.allowableValues = allowableValues;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p instanceof StringProperty) {
|
if (p instanceof StringProperty) {
|
||||||
|
@ -2,6 +2,7 @@ package Java
|
|||||||
|
|
||||||
import io.swagger.codegen.languages.JavaClientCodegen
|
import io.swagger.codegen.languages.JavaClientCodegen
|
||||||
import io.swagger.models._
|
import io.swagger.models._
|
||||||
|
import io.swagger.models.parameters._
|
||||||
import io.swagger.models.properties._
|
import io.swagger.models.properties._
|
||||||
import io.swagger.util.Json
|
import io.swagger.util.Json
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@ -382,7 +383,6 @@ class JavaModelTest2 extends FlatSpec with Matchers {
|
|||||||
cm.vars.size should be(1)
|
cm.vars.size should be(1)
|
||||||
|
|
||||||
val vars = cm.vars
|
val vars = cm.vars
|
||||||
Json.prettyPrint(vars.get(0))
|
|
||||||
vars.get(0).baseName should be("_")
|
vars.get(0).baseName should be("_")
|
||||||
vars.get(0).getter should be("getU")
|
vars.get(0).getter should be("getU")
|
||||||
vars.get(0).setter should be("setU")
|
vars.get(0).setter should be("setU")
|
||||||
@ -393,4 +393,17 @@ class JavaModelTest2 extends FlatSpec with Matchers {
|
|||||||
vars.get(0).hasMore should equal(null)
|
vars.get(0).hasMore should equal(null)
|
||||||
vars.get(0).isNotContainer should equal(true)
|
vars.get(0).isNotContainer should equal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it should "convert a parameter" in {
|
||||||
|
val parameter = new QueryParameter()
|
||||||
|
.property(
|
||||||
|
new IntegerProperty())
|
||||||
|
.name("limit")
|
||||||
|
.required(true)
|
||||||
|
|
||||||
|
val codegen = new JavaClientCodegen()
|
||||||
|
val cp = codegen.fromParameter(parameter, null)
|
||||||
|
|
||||||
|
cp.allowableValues should be (null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user