JavaScript client: use brackets to access mobel properties

to support nonstandard characters in property names, e.g. "user-status".
This commit is contained in:
xhh
2016-01-30 21:34:11 +08:00
parent cd1e9b0504
commit 5463015725
8 changed files with 157 additions and 157 deletions

View File

@@ -318,10 +318,10 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
@Override
public String toDefaultValueWithParam(String name, Property p) {
if (p instanceof RefProperty) {
return ".constructFromObject(data." + name + ");";
return ".constructFromObject(data['" + name + "']);";
} else {
return " = data['" + name + "'];";
}
return super.toDefaultValueWithParam(name, p);
}
@Override