liver icon indicating copy to clipboard operation
liver copied to clipboard

Can't validate boolean

Open mcesaro opened this issue 1 year ago • 0 comments

Hi, I'm trying to validate a boolean input like this:

liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"false">>}]).
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, 1}])
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"0">>}]).
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"false">>}], [{strict, true}]).
liver:validate([{<<"test">>, [string, is_boolean]}], [{<<"test">>, <<"off">>}], [{strict, true}]).

but the result is invariably:

{error,[{<<"test">>,not_boolean}]}

Am I doing something wrong?

mcesaro avatar Feb 05 '24 11:02 mcesaro