You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Xtra Coder (JIRA)" <ji...@apache.org> on 2016/08/19 14:23:20 UTC
[jira] [Created] (AVRO-1899) PascalCase for property names
generated by avrogen for C#
Xtra Coder created AVRO-1899:
--------------------------------
Summary: PascalCase for property names generated by avrogen for C#
Key: AVRO-1899
URL: https://issues.apache.org/jira/browse/AVRO-1899
Project: Avro
Issue Type: Improvement
Reporter: Xtra Coder
Currently (code in branch 1.8) avrogen generates properties in C# data classes 1:1 as they are defined in shema, what results for field named 'favorite_color' in code like following:
public string favorite_color {
get { return this._favorite_color; }
set { this._favorite_color = value; }
}
In general property names should use PascalCasing (see: https://msdn.microsoft.com/en-us/library/ms229043.aspx) and correctly generated code would look like
public string FavoriteColor {
get { return this._favorite_color; }
set { this._favorite_color = value; }
}
Potential change is rather minor:
.\avro\lang\csharp\src\apache\main\CodeGen\CodeGen.cs : 581
change
var mangledName = CodeGenUtil.Instance.Mangle(field.Name);
to
var mangledName = CodeGenUtil.Instance.Mangle(AsPropName(field.Name));
where AsPropName function may look like following
public string AsPropName(string name) {
return Regex.Replace(name, @"^\S|_\S", match => match.Value.Replace("_","").ToUpper());
}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)