update parameter name to camelize lower

This commit is contained in:
wing328
2015-06-29 23:14:00 +08:00
parent 59987a54a9
commit f290de95dd
8 changed files with 276 additions and 260 deletions

View File

@@ -163,8 +163,24 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig
@Override
public String toParamName(String name) {
// should be the same as variable name
return toVarName(name);
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_");
// if it's all uppper case, do nothing
if (name.matches("^[A-Z_]*$")) {
return name;
}
// camelize(lower) the variable name
// pet_id => petId
name = camelize(name, true);
// for reserved word or word starting with number, append _
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
name = escapeReservedWord(name);
}
return name;
}
@Override