View Source ndto_validation (ndto v0.3.1)

Summary

Types

-type condition() :: {condition_fun(), condition_args()}.
-type condition_args() :: [term()].
-type condition_fun() :: fun((term()) -> t()).
-type t() :: true | {false, term()}.

Functions

-spec 'andalso'(Conditions) -> Result
             when
                 Conditions :: [condition()],
                 Result :: true | {false, Reason},
                 Reason :: {SchemaPath, Description, FailedIndex},
                 SchemaPath :: atom(),
                 Description :: binary(),
                 FailedIndex :: non_neg_integer().
-spec find(Predicate, List) -> Resp
        when
            Predicate :: function(),
            List :: list(),
            Resp :: {true, Result} | {false, none},
            Result :: term().
-spec format_properties(List) -> Resp
                     when List :: [Property, ...], Property :: binary(), Resp :: binary().
-spec mfoldl(Fun, Acc, List) -> Resp
          when
              Fun :: function(),
              Acc :: term(),
              List :: list(),
              Resp :: {true, term()} | {false, term(), Reason},
              Reason :: binary().
-spec 'orelse'(Conditions) -> Result
            when
                Conditions :: [condition()],
                Result :: true | {false, Reason},
                Reason :: none_matched.
-spec 'xor'(Conditions) -> Result
         when
             Conditions :: [condition()],
             Result :: true | {false, Reason},
             Reason :: none_matched | {many_matched, {ValidationError, ValidationError}},
             ValidationError :: {SchemaPath, Description},
             SchemaPath :: atom(),
             Description :: binary().