Fix float default value

Decimal literals for floats must be casted to float, because that are
doubles by default
This commit is contained in:
mmschettler 2016-03-16 22:08:14 +01:00
parent 3147061345
commit 1b16d87dd5

View File

@ -299,11 +299,16 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
for (CodegenProperty var : cm.vars) { for (CodegenProperty var : cm.vars) {
Map<String, Object> allowableValues = var.allowableValues; Map<String, Object> allowableValues = var.allowableValues;
//handle float defaults
if((var.defaultValue != null) && (var.datatype.startsWith("float"))) {
var.defaultValue = String.format("%1$sF", var.defaultValue);
}
// handle ArrayProperty // handle ArrayProperty
if (var.items != null) { if (var.items != null) {
allowableValues = var.items.allowableValues; allowableValues = var.items.allowableValues;
} }
if (allowableValues == null) { if (allowableValues == null) {
continue; continue;
} }