add empty string validation for OptionalStringToX conversion
Will prevent Kafka Topics without config populating config with zeros
@@ -198,6 +198,10 @@ func parseOptionalStringToInt64(val interface{}) *int64 {
return nil
}
+ if v == "" {
+ return nil
+ }
+
res, err := strconv.ParseInt(v, 10, 64)
if err != nil {
return nil
@@ -212,6 +216,10 @@ func parseOptionalStringToFloat64(val interface{}) *float64 {
return nil
}
+ if v == "" {
+ return nil
+ }
+
res, err := strconv.ParseFloat(v, 64)
if err != nil {
return nil
@@ -226,6 +234,10 @@ func parseOptionalStringToBool(val interface{}) *bool {
return nil
}
+ if v == "" {
+ return nil
+ }
+
res, err := strconv.ParseBool(v)
if err != nil {
return nil
