Steps
- Have a list with a decimal field
list({
fields: {
lineAmount: decimal({
validation: { isRequired: false, min: "0.0" },
defaultValue: "0",
precision: 10,
scale: 2,
}),
});
- Have a list
resolveInput that changes the value:
list({
hooks: {
resolveInput: ({ resolvedData }) {
return {
...resolvedData,
lineItem: 666
};
}
});
- Send a
create or update against the list
Expected
Items gets created/updated successfully (with the lineItem: 666 value)
Actual
An error occured while running "validateInput".
- ListName.lineAmount.hooks.validateInput: val.lessThan is not a function
Workarounds
- Moving the logic to
beforeOperation and mutating the resolvedData instance works around the problem.
- Adding
max to field config doesn't help.
- Removing
min max validation from field config works around it (but disables validation)
- Returning
number or string from resolveInput for the decimal field doesn't seem to change anything.
Steps
resolveInputthat changes the value:createorupdateagainst the listExpected
Items gets created/updated successfully (with the
lineItem: 666value)Actual
Workarounds
beforeOperationand mutating theresolvedDatainstance works around the problem.maxto field config doesn't help.minmaxvalidation from field config works around it (but disables validation)numberorstringfromresolveInputfor thedecimalfield doesn't seem to change anything.