You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data-sources/parameter.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ Optional:
57
57
58
58
Optional:
59
59
60
-
-`error` (String) An error message to display if the value doesn't match the provided regex.
60
+
-`error` (String) An error message to display if the value breaks the validation rules. The following placeholders are supported: {max}, {min}, and {value}.
61
61
-`max` (Number) The maximum of a number parameter.
62
62
-`min` (Number) The minimum of a number parameter.
63
63
-`monotonic` (String) Number monotonicity, either increasing or decreasing.
Description: "An error message to display if the value doesn't match the provided regex.",
318
+
Type: schema.TypeString,
319
+
Optional: true,
320
+
Description: "An error message to display if the value breaks the validation rules. The following placeholders are supported: {max}, {min}, and {value}.",
321
321
},
322
322
},
323
323
},
@@ -438,13 +438,13 @@ func (v *Validation) Valid(typ, value string) error {
438
438
case"number":
439
439
num, err:=strconv.Atoi(value)
440
440
iferr!=nil {
441
-
returnfmt.Errorf("value %q is not a number", value)
441
+
returntakeFirstError(v.errorRendered(value), fmt.Errorf("value %q is not a number", value))
442
442
}
443
443
if!v.MinDisabled&&num<v.Min {
444
-
returnfmt.Errorf("value %d is less than the minimum %d", num, v.Min)
444
+
returntakeFirstError(v.errorRendered(value), fmt.Errorf("value %d is less than the minimum %d", num, v.Min))
445
445
}
446
446
if!v.MaxDisabled&&num>v.Max {
447
-
returnfmt.Errorf("value %d is more than the maximum %d", num, v.Max)
447
+
returntakeFirstError(v.errorRendered(value), fmt.Errorf("value %d is more than the maximum %d", num, v.Max))
0 commit comments