Open
Description
I have a use case where I have a RecordType like this:
const newProductRequestBodyType = $.RecordType({
product_number: $.NonEmpty ($.String),
name: $.NonEmpty ($.String),
category: $.NonEmpty ($.String),
sub_category: $.NonEmpty ($.String),
supplier: $.NonEmpty ($.String),
unit: $.NonEmpty ($.String),
volume_per_unit: $.NonEmpty ($.String)
});
And I use this function to validate it:
const isValidObjectByType = recordType => tagBy(is(recordType));
newProductRequestBodyType
is a post request, where I want to validate that each field is valid. Is there a simple way, to provide an error message for each field, so that I can show the right error message to the form on the client?
The Left
just gives me the sent object back, but it doesn't say why the validation of the Recordtype failed, if that makes sense?
It would be super-useful if the Left contained more details about the error.... Maybe even something I define myself when I create my RecordType.
(This issue was first mentioned on Gitter).
Metadata
Metadata
Assignees
Labels
No labels