-
Notifications
You must be signed in to change notification settings - Fork 0
/
amelinium.http.middleware.validators.html
51 lines (51 loc) · 35.8 KB
/
amelinium.http.middleware.validators.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>amelinium.http.middleware.validators documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Amelinium</span> <span class="project-version">1.0.1</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li><li class="depth-1 "><a href="20_hypermedia.html"><div class="inner"><span>Hypermedia-driven</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><a href="amelinium.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>amelinium</span></div></a></li><li class="depth-2 branch"><a href="amelinium.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-2"><a href="amelinium.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-3"><a href="amelinium.api.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4"><a href="amelinium.api.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3"><a href="amelinium.api.url.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>url</span></div></a></li><li class="depth-2 branch"><a href="amelinium.app.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>app</span></div></a></li><li class="depth-2"><a href="amelinium.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>algo</span></div></div></li><li class="depth-4 branch"><a href="amelinium.auth.algo.append.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>append</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.fail.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fail</span></div></a></li><li class="depth-4 branch"><a href="amelinium.auth.algo.pbkdf2.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pbkdf2</span></div></a></li><li class="depth-4"><a href="amelinium.auth.algo.scrypt.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scrypt</span></div></a></li><li class="depth-3 branch"><a href="amelinium.auth.pwd.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>pwd</span></div></a></li><li class="depth-3"><a href="amelinium.auth.specs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specs</span></div></a></li><li class="depth-2"><a href="amelinium.common.html"><div class="inner"><span class="tree" style="top: -238px;"><span class="top" style="height: 247px;"></span><span class="bottom"></span></span><span>common</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-3"><a href="amelinium.common.oplog.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oplog</span></div></a></li><li class="depth-4"><a href="amelinium.common.oplog.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.populators.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-3"><a href="amelinium.common.swagger.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>swagger</span></div></a></li><li class="depth-2 branch"><a href="amelinium.core.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="amelinium.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3"><a href="amelinium.db.sql.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sql</span></div></a></li><li class="depth-2 branch"><a href="amelinium.errors.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-2"><a href="amelinium.http.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>client</span></div></div></li><li class="depth-4"><a href="amelinium.http.client.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.handler.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>handler</span></div></a></li><li class="depth-3"><a href="amelinium.http.middleware.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>middleware</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.coercion.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>coercion</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.content.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>content</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.debug.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>debug</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>format</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.headers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>headers</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.language.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>language</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.lazy-req.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>lazy-req</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.populators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.remote-ip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>remote-ip</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.roles.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>roles</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-4 current"><a href="amelinium.http.middleware.validators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>validators</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.router.html"><div class="inner"><span class="tree" style="top: -424px;"><span class="top" style="height: 433px;"></span><span class="bottom"></span></span><span>router</span></div></a></li><li class="depth-3"><a href="amelinium.http.server.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.server.jetty.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jetty</span></div></a></li><li class="depth-4"><a href="amelinium.http.server.undertow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>undertow</span></div></a></li><li class="depth-2"><a href="amelinium.i18n.html"><div class="inner"><span class="tree" style="top: -672px;"><span class="top" style="height: 681px;"></span><span class="bottom"></span></span><span>i18n</span></div></a></li><li class="depth-3"><a href="amelinium.i18n.pluralizers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pluralizers</span></div></a></li><li class="depth-2 branch"><a href="amelinium.identity.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-2 branch"><a href="amelinium.locale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locale</span></div></a></li><li class="depth-2 branch"><a href="amelinium.logging.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logging</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>model</span></div></div></li><li class="depth-3 branch"><a href="amelinium.model.confirmation.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>confirmation</span></div></a></li><li class="depth-3"><a href="amelinium.model.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>proto</span></div></div></li><li class="depth-3 branch"><a href="amelinium.proto.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.proto.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.schemas.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>schemas</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></div></li><li class="depth-3"><a href="amelinium.server.ssl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ssl</span></div></a></li><li class="depth-2 branch"><a href="amelinium.system.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>system</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></div></li><li class="depth-3 branch"><a href="amelinium.types.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.types.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.utils.html"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="amelinium.web.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>web</span></div></a></li><li class="depth-3"><a href="amelinium.web.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4 branch"><a href="amelinium.web.controller.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-4"><a href="amelinium.web.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.js.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>js</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.taggers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>taggers</span></div></a></li><li class="depth-3"><a href="amelinium.web.url.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>url</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-bad-keys"><div class="inner"><span>bad-keys</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-check-required.3F"><div class="inner"><span>default-check-required?</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-config-key"><div class="inner"><span>default-config-key</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-default-pass.3F"><div class="inner"><span>default-default-pass?</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-explain-key"><div class="inner"><span>default-explain-key</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-explain.3F"><div class="inner"><span>default-explain?</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-required"><div class="inner"><span>default-required</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-required-blank"><div class="inner"><span>default-required-blank</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-required-some"><div class="inner"><span>default-required-some</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-result-key"><div class="inner"><span>default-result-key</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-default-validators"><div class="inner"><span>default-validators</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-gen-required"><div class="inner"><span>gen-required</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-gen-required-blank"><div class="inner"><span>gen-required-blank</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-gen-required-some"><div class="inner"><span>gen-required-some</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-prep-validators"><div class="inner"><span>prep-validators</span></div></a></li><li class="depth-1"><a href="amelinium.http.middleware.validators.html#var-wrap-validators"><div class="inner"><span>wrap-validators</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">amelinium.http.middleware.validators</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>amelinium service, validators.</p>
</div></div><div class="public anchor" id="var-bad-keys"><h3>bad-keys</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L137">view source</a></div></div><div class="public anchor" id="var-default-check-required.3F"><h3>default-check-required?</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L35">view source</a></div></div><div class="public anchor" id="var-default-config-key"><h3>default-config-key</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L67">view source</a></div></div><div class="public anchor" id="var-default-default-pass.3F"><h3>default-default-pass?</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L30">view source</a></div></div><div class="public anchor" id="var-default-explain-key"><h3>default-explain-key</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L40">view source</a></div></div><div class="public anchor" id="var-default-explain.3F"><h3>default-explain?</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L39">view source</a></div></div><div class="public anchor" id="var-default-required"><h3>default-required</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L52">view source</a></div></div><div class="public anchor" id="var-default-required-blank"><h3>default-required-blank</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L61">view source</a></div></div><div class="public anchor" id="var-default-required-some"><h3>default-required-some</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L55">view source</a></div></div><div class="public anchor" id="var-default-result-key"><h3>default-result-key</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L64">view source</a></div></div><div class="public anchor" id="var-default-validators"><h3>default-validators</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L44">view source</a></div></div><div class="public anchor" id="var-gen-required"><h3>gen-required</h3><div class="usage"><code>(gen-required {required-cat :required/cat, required-special :required/special} items rng)</code><code>(gen-required {required-cat :required/cat, required-special :required/special} items)</code><code>(gen-required {required-cat :required/cat, required-special :required/special})</code></div><div class="doc"><div class="markdown"><p>Generates a map with keys <code>:blank</code>, <code>:some</code> and <code>:any</code> containing vectors of randomly selected, unique names which fit into certain categories, accordingly: required keys which must be blank, required keys which must not be blank, required keys which may have any value.</p>
<p>Data for randomization is taken from a map under the key <code>:required/cat</code> and from a vector under the key <code>:required/special</code> of the provided configuration argument. This vector is randomized to get a list of <code>items</code> values marked in validators configuration as special (coming from <code>:required/blank</code>, <code>:required/some</code> or <code>:required</code> keys, without its validation function being overriden by any manually configured validator). When the list is ready its items are grouped by the mentioned categories and returned as a map.</p>
<p>The optional second argument <code>items</code> is a number of items to generate. The optional third argument <code>rng</code> should be a random number generator object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L104">view source</a></div></div><div class="public anchor" id="var-gen-required-blank"><h3>gen-required-blank</h3><div class="usage"><code>(gen-required-blank {required-blank :required/blank})</code><code>(gen-required-blank {required-blank :required/blank} items)</code><code>(gen-required-blank {required-blank :required/blank} items rng)</code></div><div class="doc"><div class="markdown"><p>Generates a list of randomly selected, unique names from a vector which should be available under the key <code>:required/blank</code> of the provided map.</p>
<p>The optional second argument <code>items</code> is a number of items to generate. The optional third argument <code>rng</code> should be a random number generator object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L72">view source</a></div></div><div class="public anchor" id="var-gen-required-some"><h3>gen-required-some</h3><div class="usage"><code>(gen-required-some {required-some :required/some})</code><code>(gen-required-some {required-some :required/some} items)</code><code>(gen-required-some {required-some :required/some} items rng)</code></div><div class="doc"><div class="markdown"><p>Generates a list of randomly selected, unique names from a vector which should be available under the key <code>:required/some</code> of the provided map.</p>
<p>The optional second argument <code>items</code> is a number of items to generate. The optional third argument <code>rng</code> should be a random number generator object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L88">view source</a></div></div><div class="public anchor" id="var-prep-validators"><h3>prep-validators</h3><div class="usage"><code>(prep-validators {required-mode :required/mode, required :required, :as config, :or {required default-required, default-pass? default-default-pass?, required-some default-required-some, config-key default-config-key, explain-key default-explain-key, enabled? true, required-blank default-required-blank, validators default-validators, explain? default-explain?, result-key default-result-key, check-required? default-check-required?}, default-pass? :default-pass?, required-some :required/some, config-key :config-key, explain-key :explain-key, enabled? :enabled?, required-blank :required/blank, validators :validators, required-source :required/source, explain? :explain?, result-key :result-key, check-required? :check-required?})</code></div><div class="doc"><div class="markdown"><p>Prepares validators configuration.</p>
<p>Sequences of values provided under <code>:required/some</code>, <code>:required/blank</code> and <code>:required</code> keys are cleaned-up and transformed into strings. Map under the key <code>:validators</code> is also transformed: its keys are converted into strings and values are dereferenced if they are symbols.</p>
<p>Any parameter in a sequence provided under <code>:required/some</code> or <code>:required/blank</code> key is removed if it has a custom validator assigned in <code>:validators</code> map.</p>
<p>Parameter names which exist in both <code>:required/some</code> and <code>:required/blank</code> sequences are removed from them and moved to a sequence under the <code>:required/any</code> key. Marking some required parameter to be blank and non-blank at the same time causes it to fall into a category where is can have any value to be considered valid.</p>
<p>Parameter names which exist in <code>:required</code> sequence and also exist in <code>:required/some</code> or <code>:required/blank</code> sequence are removed from the <code>:required</code> sequence.</p>
<p>Parameter names which exist in <code>:required/some</code>, <code>:required/blank</code> and <code>:required</code> are removed from <code>:required/some</code> and <code>:required/blank</code>, and only exist in <code>:required</code>. Unless their validator was already specified in <code>:validators</code> they are also added to <code>:required/any</code>.</p>
<p>For each parameter name from <code>:required/some</code> a validator is generated (checking if a given value is not blank). For each parameter name from <code>:required/blank</code> a validator is generated (checking if a given value is blank). For each parameter name from <code>:required/any</code> a validator is generated (accepting any value, including blanks).</p>
<p>Manually assigned validators are expressed as a map under <code>:validators</code> key.</p>
<p>Automatically created validators (for the aforementioned keys: <code>:required/some</code>, <code>:required/blank</code> and <code>:required/any</code>) are associated with their parameter names in a map under the <code>:validators/all</code> key, which also contains manually assigned validators.</p>
<p>During the operation a map is created under the <code>:required/cat</code> key. It contains all of the required parameter names as keys with validation categories assigned (expressed as keywords):</p>
<ul>
<li><code>:some</code> – parameter is valid if it has a non-blank value</li>
<li><code>:blank</code> – parameter is valid if it has a blank value</li>
<li><code>:any</code> – parameter is valid if it has any value</li>
<li><code>:custom</code> – parameter is valid if it passes a custom validation (see <code>:validators</code>).</li>
</ul>
<p>This function returns a given configuration map with the following keys transformed as described earlier:</p>
<p>Booleans: * <code>:enabled?</code> (<code>true</code> if enabled in configuration with <code>:enabled?</code>) * <code>:default-pass?</code> (<code>true</code> if unknown parameters are considered valid) * <code>:check-required?</code> (<code>true</code> if required parameters are to be checked)</p>
<p>Vectors: * <code>:required/some</code> (required parameters having auto-generated validators for non-blanks) * <code>:required/blank</code> (required parameters having auto-generated validators for blanks) * <code>:required/any</code> (required parameters having auto-generated validators for any values) * <code>:required/special</code> (all required parameters having auto-generated validators) * <code>:required/user</code> (required parameters which were manually configured) * <code>:required</code> (all required parameters, including those having auto-generated validators)</p>
<p>Maps: * <code>:required/cat</code> (all required parameters with categories assigned) * <code>:validators</code> (manually configured validators for parameter names) * <code>:validators/all</code> (manually and automatically configured validators)</p>
<p>Keywords: * <code>:result-key</code> (key identifying validation results in a request map) * <code>:config-key</code> (key identifying configuration in a request map) * <code>:required/source</code> (required parameters source, a keyword, defaults to <code>:required/user</code>) * <code>:required/mode</code> (required parameters checking mode: :all (default), :one or a number).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L144">view source</a></div></div><div class="public anchor" id="var-wrap-validators"><h3>wrap-validators</h3><div class="usage"><code>(wrap-validators k config)</code></div><div class="doc"><div class="markdown"><p>Validators wrapping middleware initializer. Processes the configuration expressed as a map which may have the following keys specified:</p>
<p>Switches: * <code>:enabled?</code> (<code>true</code> if enabled in configuration with <code>:enabled?</code>) * <code>:default-pass?</code> (<code>true</code> if unknown parameters are considered valid) * <code>:check-required?</code> (<code>true</code> if required parameters are to be checked)</p>
<p>Sequential collections: * <code>:required/some</code> (parameters which should have generated validators for non-blanks) * <code>:required/blank</code> (parameters which should have generated validators for blanks) * <code>:required/any</code> (parameters which should have generated validators for any values) * <code>:required/user</code> (parameters associated with the <code>:required</code> key) * <code>:required/special</code> (parameters for which validator was automatically generated) * <code>:required/nospecial</code> (parameters for which validator was not automatically generated) * <code>:required</code> (all required parameters)</p>
<p>Maps: * <code>:validators</code> (validators assigned to parameter names)</p>
<p>Keywords: * <code>:result-key</code> (key identifying validation results in a request map) * <code>:config-key</code> (key identifying configuration in a request map).</p>
<p>Validator names should be strings or objects which are convertible to strings. Validators can be various objects, see <code>io.randomseed.utils.validators/Validating</code> protocol.</p>
<p>The result of calling this function is a map intended to be used with Reitit router as a middleware. The handler function itself will add <code>:validators/config</code> and <code>:validators/params-valid?</code> entries to a request map. Names of these identifying keys can be changed by setting <code>:result-key</code> and/or <code>:config-key</code> configuration options.</p>
<p>The presence of validation function can be controlled by setting <code>:validators/disabled?</code> in a request context to override the defaults. It is a switch which disables the validation completely (any parameter will be considered valid).</p>
<p>By default, only manually configured required validators (assigned to the <code>:required/user</code> configuration key) will be checked for presence! It can be changed by setting <code>:required/check</code> to:</p>
<ul>
<li><code>:required/some</code> (parameters which should have generated validators for non-blanks)</li>
<li><code>:required/blank</code> (parameters which should have generated validators for blanks)</li>
<li><code>:required/any</code> (parameters which should have generated validators for any values)</li>
<li><code>:required/user</code> (parameters associated with the <code>:required</code> key)</li>
<li><code>:required/special</code> (parameters for which validator was automatically generated)</li>
<li><code>:required/nospecial</code> (parameters for which validator was not automatically generated)</li>
<li><code>:required</code> (all required parameters)</li>
</ul>
<p>See <code>amelinium.http.middleware.validators/prep-validators</code> to see the detailed logic behind preparing the configuration.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/http/middleware/validators.clj#L311">view source</a></div></div></div></body></html>