forked from loafle/openapi-generator-original
added test case, update for #316
This commit is contained in:
parent
59b477d2da
commit
810c7f9ed2
@ -661,6 +661,10 @@ public class DefaultCodegen {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
property = PropertyBuilder.build(qp.getType(), qp.getFormat(), null);
|
property = PropertyBuilder.build(qp.getType(), qp.getFormat(), null);
|
||||||
|
if(property == null) {
|
||||||
|
System.out.println("couldn't find property for parameter: ");
|
||||||
|
Json.prettyPrint(param);
|
||||||
|
}
|
||||||
CodegenProperty model = fromProperty(qp.getName(), property);
|
CodegenProperty model = fromProperty(qp.getName(), property);
|
||||||
p.collectionFormat = collectionFormat;
|
p.collectionFormat = collectionFormat;
|
||||||
p.dataType = model.datatype;
|
p.dataType = model.datatype;
|
||||||
@ -675,11 +679,22 @@ public class DefaultCodegen {
|
|||||||
Model model = bp.getSchema();
|
Model model = bp.getSchema();
|
||||||
|
|
||||||
if(model instanceof ModelImpl) {
|
if(model instanceof ModelImpl) {
|
||||||
|
System.out.println("model impl");
|
||||||
ModelImpl impl = (ModelImpl) model;
|
ModelImpl impl = (ModelImpl) model;
|
||||||
CodegenModel cm = fromModel(bp.getName(), impl);
|
CodegenModel cm = fromModel(bp.getName(), impl);
|
||||||
|
if(cm.emptyVars != null && cm.emptyVars == false) {
|
||||||
p.dataType = getTypeDeclaration(cm.classname);
|
p.dataType = getTypeDeclaration(cm.classname);
|
||||||
imports.add(p.dataType);
|
imports.add(p.dataType);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// TODO: missing format, so this will not always work
|
||||||
|
Property prop = PropertyBuilder.build(impl.getType(), null, null);
|
||||||
|
CodegenProperty cp = fromProperty("property", prop);
|
||||||
|
if(cp != null) {
|
||||||
|
p.dataType = cp.datatype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(model instanceof ArrayModel) {
|
else if(model instanceof ArrayModel) {
|
||||||
// to use the built-in model parsing, we unwrap the ArrayModel
|
// to use the built-in model parsing, we unwrap the ArrayModel
|
||||||
// and get a single property from it
|
// and get a single property from it
|
||||||
@ -688,7 +703,9 @@ public class DefaultCodegen {
|
|||||||
// get the single property
|
// get the single property
|
||||||
ArrayProperty ap = new ArrayProperty().items(impl.getItems());
|
ArrayProperty ap = new ArrayProperty().items(impl.getItems());
|
||||||
CodegenProperty cp = fromProperty("inner", ap);
|
CodegenProperty cp = fromProperty("inner", ap);
|
||||||
|
if(cp.complexType != null) {
|
||||||
|
imports.add(cp.complexType);
|
||||||
|
}
|
||||||
imports.add(cp.baseType);
|
imports.add(cp.baseType);
|
||||||
p.dataType = cp.datatype;
|
p.dataType = cp.datatype;
|
||||||
p.isContainer = true;
|
p.isContainer = true;
|
||||||
@ -704,6 +721,7 @@ public class DefaultCodegen {
|
|||||||
if(defaultIncludes.contains(name)) {
|
if(defaultIncludes.contains(name)) {
|
||||||
imports.add(name);
|
imports.add(name);
|
||||||
}
|
}
|
||||||
|
imports.add(name);
|
||||||
name = getTypeDeclaration(name);
|
name = getTypeDeclaration(name);
|
||||||
}
|
}
|
||||||
p.dataType = name;
|
p.dataType = name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user