cleanup build error due to missing CodegenConfig configuration entry

#1294
This commit is contained in:
Johannes Fiala 2015-12-05 21:11:55 +01:00
parent 637b9937a8
commit 34fb2c561f
5 changed files with 29 additions and 24 deletions

View File

@ -588,39 +588,39 @@ public class DefaultCodegen {
*/
public String toDefaultValueWithParam(String name, Property p) {
if (p instanceof StringProperty) {
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof BooleanProperty) {
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof DateProperty) {
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof DateTimeProperty) {
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof DoubleProperty) {
DoubleProperty dp = (DoubleProperty) p;
if (dp.getDefault() != null) {
return dp.getDefault().toString();
}
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof FloatProperty) {
FloatProperty dp = (FloatProperty) p;
if (dp.getDefault() != null) {
return dp.getDefault().toString();
}
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof IntegerProperty) {
IntegerProperty dp = (IntegerProperty) p;
if (dp.getDefault() != null) {
return dp.getDefault().toString();
}
return "data." + name + ";";
return " = data." + name + ";";
} else if (p instanceof LongProperty) {
LongProperty dp = (LongProperty) p;
if (dp.getDefault() != null) {
return dp.getDefault().toString();
}
return "data." + name + ";";
return " = data." + name + ";";
} else {
return "data." + name + ";";
return " = data." + name + ";";
}
}

View File

@ -334,11 +334,13 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
if (p instanceof ArrayProperty) {
final ArrayProperty ap = (ArrayProperty) p;
final String pattern;
if (fullJavaUtil) {
pattern = "new java.util.ArrayList<%s>()";
} else {
pattern = "new ArrayList<%s>()";
}
//if (fullJavaUtil) {
// pattern = "new ArrayList()";
//} else {
// pattern = "new ArrayList<%s>()";
//}
pattern = "new Array()";
return String.format(pattern, getTypeDeclaration(ap.getItems()));
} else if (p instanceof MapProperty) {
final MapProperty ap = (MapProperty) p;
@ -376,17 +378,19 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
if (p instanceof ArrayProperty) {
final ArrayProperty ap = (ArrayProperty) p;
final String pattern;
if (fullJavaUtil) {
pattern = "new java.util.ArrayList<%s>()";
} else {
pattern = "new ArrayList<%s>()" ;
}
// if (fullJavaUtil) {
// pattern = "new java.util.ArrayList<%s>()";
// } else {
// pattern = "new ArrayList<%s>()" ;
// }
pattern = " = new Array()" ;
return String.format(pattern, getTypeDeclaration(ap.getItems()))+ ";";
} else if (p instanceof MapProperty) {
final MapProperty ap = (MapProperty) p;
final String pattern;
if (fullJavaUtil) {
pattern = "new java.util.HashMap<String, %s>()";
pattern = " = new java.util.HashMap<String, %s>()";
} else {
pattern = "new HashMap<String, %s>()";
}
@ -394,14 +398,14 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
} else if (p instanceof LongProperty) {
LongProperty dp = (LongProperty) p;
return "data." + name + ";";
return " = data." + name + ";";
// added for Javascript
} else if (p instanceof RefProperty) {
RefProperty rp = (RefProperty)p;
System.out.println("rp: " + rp.getName() + rp.getAccess() + rp.getDescription() + rp.getExample() + rp.getFormat() + rp.getSimpleRef() + rp.getTitle() + rp.getType());
return "new " +rp.getSimpleRef() + "(data." + name + ");";
return ".constructFromObject(data." + name + ");";
}
System.out.println("property: " + p);

View File

@ -26,7 +26,7 @@ function {{classname}}() {
{{/required}}{{/allParams}}
// create path and map variables
var {{localVariablePrefix}}path = '{{basePath}}' + replaceAll(replaceAll("{{{path}}}", "\\{format\\}","json"){{#pathParams}}
, "\\{" + "{{baseName}}" + "\\}", {{localVariablePrefix}}apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}});
, "\\{" + "{{baseName}}" + "\\}", {{localVariablePrefix}}apiClient.escapeString({{{paramName}}}.toString()){{/pathParams}});
var queryParams = {};
var headerParams = {};

View File

@ -18,7 +18,7 @@ function {{classname}}() { {{#parent}}/* extends {{{parent}}}*/{{/parent}}
self.constructFromObject = function(data) {
{{#vars}}
self.{{name}} = {{{defaultValueWithParam}}}
self.{{name}}{{{defaultValueWithParam}}}
{{/vars}}
}

View File

@ -5,6 +5,7 @@ io.swagger.codegen.languages.DartClientCodegen
io.swagger.codegen.languages.FlashClientCodegen
io.swagger.codegen.languages.FlaskConnexionCodegen
io.swagger.codegen.languages.JavaClientCodegen
io.swagger.codegen.languages.JavascriptClientCodegen
io.swagger.codegen.languages.JaxRSServerCodegen
io.swagger.codegen.languages.JavaInflectorServerCodegen
io.swagger.codegen.languages.NodeJSServerCodegen