[csharp] Fix enum default value (#4681)

* [csharp] Prevent enum assign to string

see swagger-api/swagger-codegen#4670

* [csharp] Regenerate client sample
This commit is contained in:
Jim Schubert
2017-02-06 04:33:10 -05:00
committed by wing328
parent b891a4a4cf
commit 96b0d155b5
38 changed files with 447 additions and 53 deletions

View File

@@ -484,7 +484,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
if (p instanceof StringProperty) {
StringProperty dp = (StringProperty) p;
if (dp.getDefault() != null) {
return "\"" + dp.getDefault() + "\"";
String _default = dp.getDefault();
if (dp.getEnum() == null) {
return "\"" + _default + "\"";
} else {
// convert to enum var name later in postProcessModels
return _default;
}
}
} else if (p instanceof BooleanProperty) {
BooleanProperty dp = (BooleanProperty) p;