forked from loafle/openapi-generator-original
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user