use singular NoDecimal option name
This commit is contained in:
@@ -158,8 +158,8 @@ func (validator *RecordDataValidator) checkNumberValue(field *schema.SchemaField
|
||||
|
||||
options, _ := field.Options.(*schema.NumberOptions)
|
||||
|
||||
if options.NoDecimals && val != float64(int64(val)) {
|
||||
return validation.NewError("validation_no_decimals_constraint", "Decimal numbers are not allowed")
|
||||
if options.NoDecimal && val != float64(int64(val)) {
|
||||
return validation.NewError("validation_no_decimal_constraint", "Decimal numbers are not allowed")
|
||||
}
|
||||
|
||||
if options.Min != nil && val < *options.Min {
|
||||
|
||||
@@ -184,7 +184,7 @@ func TestRecordDataValidatorValidateNumber(t *testing.T) {
|
||||
Name: "field4",
|
||||
Type: schema.FieldTypeNumber,
|
||||
Options: &schema.NumberOptions{
|
||||
NoDecimals: true,
|
||||
NoDecimal: true,
|
||||
},
|
||||
},
|
||||
)
|
||||
@@ -254,7 +254,7 @@ func TestRecordDataValidatorValidateNumber(t *testing.T) {
|
||||
[]string{"field3"},
|
||||
},
|
||||
{
|
||||
"(number) check NoDecimals",
|
||||
"(number) check NoDecimal",
|
||||
map[string]any{
|
||||
"field2": 1,
|
||||
"field4": 456.789,
|
||||
|
||||
Reference in New Issue
Block a user