mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-16 00:21:19 +00:00
JavaScript client: use brackets to access mobel properties
to support nonstandard characters in property names, e.g. "user-status".
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user