Module yctest

Copyright © (C) 2002-2021 ProcessOne, SARL. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -------------------------------------------------------------------

Authors: Evgeny Khramtsov (ekhramtsov@process-one.net).

Data Types

ctx()

ctx() = [atom() | binary() | integer()]

error_reason()

error_reason() = term()

error_return()

error_return() = {error, error_reason(), ctx()}

exports()

exports() = [{atom(), arity()} | [{atom(), arity()}]]

infinity()

infinity() = infinity | infinite | unlimited

options()

options() = [{atom(), term()}] | #{atom() => term()} | dict:dict(atom(), term())

parse_option()

parse_option() = replace_macros | {replace_macros, boolean()} | include_files | {include_files, boolean()} | plain_as_atom | {plain_as_atom, boolean()}

return_type()

return_type() = list | map | dict | orddict

sorted_opt()

sorted_opt() = sorted | {sorted, boolean()}

timeout_unit()

timeout_unit() = millisecond | second | minute | hour | day

unique_opt()

unique_opt() = unique | {unique, boolean()}

validator()

validator(T) = fun((yaml()) -> T)

validator()

validator() = fun((yaml()) -> term())

validator_option()

validator_option() = {required, [atom()]} | {disallowed, [atom()]} | unique | {unique, boolean()} | {return, return_type()}

validators()

validators() = #{atom() => validator()}

yaml()

yaml() = yaml_val() | yaml_list() | yaml_map()

yaml_list()

yaml_list() = [yaml()]

yaml_map()

yaml_map() = [{yaml_val(), yaml()}]

yaml_val()

yaml_val() = atom() | number() | binary()

Function Index

and_then/2
any/0
atom/0
base64/0
beam/0
beam/1
binary/0
binary/1
binary/2
binary_sep/1
bool/0
directory/0
directory/1
either/2
enum/1
fail/2
file/0
file/1
format_ctx/1
format_error/1
format_error/2
glob/0
glob/1
include_files/3
int/0
int/2
ip/0
ip_mask/0
ipv4/0
ipv6/0
list/1
list/2
list_or_single/1
list_or_single/2
map/2
map/3
non_empty/1
non_neg_int/0
non_neg_int/1
number/1
octal/0
options/1
options/2
parse/2
parse/3
path/0
port/0
pos_int/0
pos_int/1
re/0
re/1
replace_macros/1
start/0
stop/0
string/0
string/1
string/2
timeout/1
timeout/2
url/0
url/1
validate/2

Function Details

and_then/2

and_then(Fun::validator(T1), Then::fun((T1) -> T2)) -> validator(T2)

any/0

any() -> validator(yaml())

atom/0

atom() -> validator(atom())

base64/0

base64() -> validator(binary())

beam/0

beam() -> validator(module())

beam/1

beam(Exports::exports()) -> validator(module())

binary/0

binary() -> validator(binary())

binary/1

binary(Regexp::iodata()) -> validator(binary())

binary/2

binary(Regexp::iodata(), Opts::[re:compile_option()]) -> validator(binary())

binary_sep/1

binary_sep(Sep::iodata()) -> validator([binary()])

bool/0

bool() -> validator(boolean())

directory/0

directory() -> validator(binary())

directory/1

directory(X1::read | write) -> validator(binary())

either/2

either(Atom::atom(), Fun::validator(T)) -> validator(atom() | T)

either(Atom::validator(T1), Fun::validator(T2)) -> validator(T1 | T2)

enum/1

enum(List::[atom() | binary()]) -> validator(atom() | binary())

fail/2

fail(Tag::term(), Reason::term()) -> no_return()

file/0

file() -> validator(binary())

file/1

file(X1::read | write) -> validator(binary())

format_ctx/1

format_ctx(Ctx::ctx()) -> string()

format_error/1

format_error(Unexpected::error_reason()) -> string()

format_error/2

format_error(Why::error_reason(), Ctx::ctx()) -> string()

glob/0

glob() -> validator(re:mp())

glob/1

glob(Opts::[re:compile_option()]) -> validator(re:mp())

include_files/3

include_files(List::options(), Opts::[parse_option()], Paths::[binary()]) -> yaml_map()

int/0

int() -> validator(integer())

int/2

int(Min::integer(), Max::integer()) -> validator(integer())

ip/0

ip() -> validator(inet:ip_address())

ip_mask/0

ip_mask() -> validator({inet:ip4_address(), 0..32} | {inet:ip6_address(), 0..128})

ipv4/0

ipv4() -> validator(inet:ip4_address())

ipv6/0

ipv6() -> validator(inet:ip6_address())

list/1

list(Fun::validator(T)) -> validator([T])

list/2

list(Fun::validator(T), Opts::[unique_opt() | sorted_opt()]) -> validator([T])

list_or_single/1

list_or_single(Fun::validator(T)) -> validator([T])

list_or_single/2

list_or_single(Fun::validator(T), Opts::[unique_opt() | sorted_opt()]) -> validator([T])

map/2

map(Fun1::validator(T1), Fun2::validator(T2)) -> validator([{T1, T2}] | #{T1 => T2})

map/3

map(Fun1::validator(T1), Fun2::validator(T2), Opts::[{return, return_type()} | unique_opt()]) -> validator([{T1, T2}] | #{T1 => T2} | dict:dict(T1, T2))

non_empty/1

non_empty(Fun::validator(T)) -> validator(T)

non_neg_int/0

non_neg_int() -> validator(non_neg_integer())

non_neg_int/1

non_neg_int(Inf::infinity()) -> validator(non_neg_integer() | infinity())

number/1

number(Min::number()) -> validator(number())

octal/0

octal() -> validator(non_neg_integer())

options/1

options(Validators::validators()) -> validator()

options/2

options(Validators::validators(), Options::[validator_option()]) -> validator()

parse/2

parse(Path::file:filename_all(), Validators::validator() | validators()) -> {ok, options()} | error_return()

parse/3

parse(Path0::file:filename_all(), Validators::validator() | validators(), Opts::[parse_option() | validator_option()]) -> {ok, options()} | error_return()

path/0

path() -> validator(binary())

port/0

port() -> validator(1..65535)

pos_int/0

pos_int() -> validator(pos_integer())

pos_int/1

pos_int(Inf::infinity()) -> validator(pos_integer() | infinity())

re/0

re() -> validator(re:mp())

re/1

re(Opts::[re:compile_option()]) -> validator(re:mp())

replace_macros/1

replace_macros(Y::yaml_map()) -> {ok, yaml_map()} | error_return()

start/0

start() -> any()

stop/0

stop() -> any()

string/0

string() -> validator(string())

string/1

string(Regexp::iodata()) -> validator(string())

string/2

string(Regexp::iodata(), Opts::[re:compile_option()]) -> validator(string())

timeout/1

timeout(Unit::timeout_unit()) -> validator(pos_integer())

timeout/2

timeout(Unit::timeout_unit(), Inf::infinity()) -> validator(pos_integer() | infinity())

url/0

url() -> validator(binary())

url/1

url(Schemes::[atom()]) -> validator(binary())

validate/2

validate(Validator::validator(), Y::yaml()) -> {ok, any()} | error_return()


Generated by EDoc