52 lines
31 KiB
HTML
52 lines
31 KiB
HTML
<!DOCTYPE html PUBLIC ""
|
||
"">
|
||
<html><head><meta charset="UTF-8" /><title>dog-and-duck.quack.picky 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></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">Dog-and-duck</span> <span class="project-version">0.1.0-SNAPSHOT</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="Using_ActivityPub.html"><div class="inner"><span>Using ActivityPub</span></div></a></li><li class="depth-1 "><a href="Validation_Faults.html"><div class="inner"><span>Validation Faults in ActivityPub documents</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clj-activitypub</span></div></div></li><li class="depth-2 branch"><a href="clj-activitypub.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</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>internal</span></div></div></li><li class="depth-3 branch"><a href="clj-activitypub.internal.crypto.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>crypto</span></div></a></li><li class="depth-3 branch"><a href="clj-activitypub.internal.http-util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http-util</span></div></a></li><li class="depth-3"><a href="clj-activitypub.internal.thread-cache.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>thread-cache</span></div></a></li><li class="depth-2"><a href="clj-activitypub.webfinger.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>webfinger</span></div></a></li><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>dog-and-duck</span></div></div></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>quack</span></div></div></li><li class="depth-3 branch"><a href="dog-and-duck.quack.fault-messages.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fault-messages</span></div></a></li><li class="depth-3 branch current"><a href="dog-and-duck.quack.picky.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>picky</span></div></a></li><li class="depth-3"><a href="dog-and-duck.quack.quack.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>scratch</span></div></div></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="dog-and-duck.scratch.scratch.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scratch</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>utils</span></div></div></li><li class="depth-3"><a href="dog-and-duck.utils.process.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>process</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="dog-and-duck.quack.picky.html#var-*reify-refs*"><div class="inner"><span>*reify-refs*</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-*reject-severity*"><div class="inner"><span>*reject-severity*</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-accept-required-properties"><div class="inner"><span>accept-required-properties</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-activity-faults"><div class="inner"><span>activity-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-activity-required-properties"><div class="inner"><span>activity-required-properties</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-activity-type-faults"><div class="inner"><span>activity-type-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-activitystreams-context-uri"><div class="inner"><span>activitystreams-context-uri</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-actor-faults"><div class="inner"><span>actor-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-actor-type.3F"><div class="inner"><span>actor-type?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-actor-types"><div class="inner"><span>actor-types</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-base-activity-required-properties"><div class="inner"><span>base-activity-required-properties</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-coll-object-reference-or-fault"><div class="inner"><span>coll-object-reference-or-fault</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-context-key"><div class="inner"><span>context-key</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-context.3F"><div class="inner"><span>context?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-filter-severity"><div class="inner"><span>filter-severity</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-has-activity-type.3F"><div class="inner"><span>has-activity-type?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-has-actor-type.3F"><div class="inner"><span>has-actor-type?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-has-context.3F"><div class="inner"><span>has-context?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-has-type-or-fault"><div class="inner"><span>has-type-or-fault</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-has-type.3F"><div class="inner"><span>has-type?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-intransitive-activity-required-properties"><div class="inner"><span>intransitive-activity-required-properties</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-link-faults"><div class="inner"><span>link-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-make-fault-object"><div class="inner"><span>make-fault-object</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-nil-if-empty"><div class="inner"><span>nil-if-empty</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-object-faults"><div class="inner"><span>object-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-object-reference-or-faults"><div class="inner"><span>object-reference-or-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-persistent-object-faults"><div class="inner"><span>persistent-object-faults</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-severity"><div class="inner"><span>severity</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-severity-filters"><div class="inner"><span>severity-filters</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-string-or-fault"><div class="inner"><span>string-or-fault</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-truthy.3F"><div class="inner"><span>truthy?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-uri-or-fault"><div class="inner"><span>uri-or-fault</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-validation-fault-context-uri"><div class="inner"><span>validation-fault-context-uri</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-verb-type.3F"><div class="inner"><span>verb-type?</span></div></a></li><li class="depth-1"><a href="dog-and-duck.quack.picky.html#var-verb-types"><div class="inner"><span>verb-types</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">dog-and-duck.quack.picky</h1><div class="doc"><div class="markdown"><p>Fault-finder for ActivityPub documents. </p>
|
||
<p>Generally, each <code>-faults</code> function will return:</p>
|
||
<ol>
|
||
<li><code>nil</code> if no faults were found;</li>
|
||
<li>a sequence of fault objects if faults were found.</li>
|
||
</ol>
|
||
<p>Each fault object shall have the properties:</p>
|
||
<ol>
|
||
<li><code>:@context</code> whose value shall be the URL of a document specifying this vocabulary;</li>
|
||
<li><code>:type</code> whose value shall be <code>Fault</code>;</li>
|
||
<li><code>:severity</code> whose value shall be one of <code>info</code>, <code>minor</code>, <code>should</code>, <code>must</code> or <code>critical</code>;</li>
|
||
<li><code>:fault</code> whose value shall be a unique token representing the particular fault type;</li>
|
||
<li><code>:narrative</code> whose value shall be a natural language description of the fault type.</li>
|
||
</ol>
|
||
<p>Note that the reason for the <code>:fault</code> property is to be able to have a well known place, linked to from the @context URL, which allows narratives for each fault type to be served in as many natural languages as possible.</p>
|
||
<p>The idea further is that it should ultimately be possible to serialise a fault report as a document which in its own right conforms to the ActivityStreams spec.</p></div></div><div class="public anchor" id="var-*reify-refs*"><h3>*reify-refs*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>If <code>true</code>, references to objects in fields will be reified and validated. If <code>false</code>, they won’t, but an <code>:info</code> level fault report will be generated.</p>
|
||
<p>There are several things in the spec which, in a document, may correctly be either</p>
|
||
<ol>
|
||
<li>a fully fleshed out object, or</li>
|
||
<li>a URI pointing to such an object.</li>
|
||
</ol>
|
||
<p>Obviously to fully validate a document we ought to reify all the refs and check that they are themselves valid, but</p>
|
||
<p>a. in some of the published test documents the URIs do not reference a valid document; b. there will be performance costs to reifying all the refs; c. in perverse cases, reifying refs might result in runaway recursion.</p>
|
||
<p>TODO: I think that in production this should default to <code>true</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L57">view source</a></div></div><div class="public anchor" id="var-*reject-severity*"><h3>*reject-severity*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>The severity at which the binary validator will return <code>false</code>.</p>
|
||
<p>In practice documents seen in the wild do not typically appear to be fully valid, and this does not matter. This allows the sensitivity of the binary validator (<code>dog-and-duck.quack.quack</code>) to be tuned. It’s in this (<code>dog-and-duck.quack.picky</code>) namespace, not that one, because this namespace is where concerns about severity are handled.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L78">view source</a></div></div><div class="public anchor" id="var-accept-required-properties"><h3>accept-required-properties</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>As base-activity-required-properties, except that the type of the object is restricted.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L471">view source</a></div></div><div class="public anchor" id="var-activity-faults"><h3>activity-faults</h3><div class="usage"><code>(activity-faults x)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L537">view source</a></div></div><div class="public anchor" id="var-activity-required-properties"><h3>activity-required-properties</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Properties activities should have, keyed by activity type. Values are maps of the format of <code>base-activity-required-properties</code>, q.v.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L481">view source</a></div></div><div class="public anchor" id="var-activity-type-faults"><h3>activity-type-faults</h3><div class="usage"><code>(activity-type-faults x)</code><code>(activity-type-faults x type)</code></div><div class="doc"><div class="markdown"><p>Return a list of faults found in the activity <code>x</code>; if <code>type</code> is also specified, it should be a string naming a specific activity type for which checks should be performed.</p>
|
||
<p>Some specific activity types have specific requirements which are not requirements.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L520">view source</a></div></div><div class="public anchor" id="var-activitystreams-context-uri"><h3>activitystreams-context-uri</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>The URI of the context of an ActivityStreams object is expected to be this literal string.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L152">view source</a></div></div><div class="public anchor" id="var-actor-faults"><h3>actor-faults</h3><div class="usage"><code>(actor-faults x)</code></div><div class="doc"><div class="markdown"><p>Return a list of faults found in actor <code>x</code>, or <code>nil</code> if none are.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L324">view source</a></div></div><div class="public anchor" id="var-actor-type.3F"><h3>actor-type?</h3><div class="usage"><code>(actor-type? x)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if the <code>x</code> is a recognised actor type, else <code>false</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L310">view source</a></div></div><div class="public anchor" id="var-actor-types"><h3>actor-types</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>The set of types we will accept as actors.</p>
|
||
<p>There’s an <a href="https://www.w3.org/TR/activitystreams-vocabulary/#actor-types">explicit set of allowed actor types</a>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L299">view source</a></div></div><div class="public anchor" id="var-base-activity-required-properties"><h3>base-activity-required-properties</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Properties most activities should have. Values are validating functions, each.</p>
|
||
<p>See <a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity">https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity</a></p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L456">view source</a></div></div><div class="public anchor" id="var-coll-object-reference-or-fault"><h3>coll-object-reference-or-fault</h3><div class="usage"><code>(coll-object-reference-or-fault value expected-type severity token)</code></div><div class="doc"><div class="markdown"><p>As object-reference-or-fault, except <code>value</code> argument may also be a list of objects and/or object references.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L435">view source</a></div></div><div class="public anchor" id="var-context-key"><h3>context-key</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>The Clojure reader barfs on <code>:@context</code>, although it is in principle a valid keyword. So we’ll make it once, here, to make the code more performant and easier to read.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L88">view source</a></div></div><div class="public anchor" id="var-context.3F"><h3>context?</h3><div class="usage"><code>(context? x)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> iff <code>x</code> quacks like an ActivityStreams context, else false.</p>
|
||
<p>A context is either 1. the URI (actually an IRI) <code>activitystreams-context-uri</code>, or 2. a collection comprising that URI and a map.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L162">view source</a></div></div><div class="public anchor" id="var-filter-severity"><h3>filter-severity</h3><div class="usage"><code>(filter-severity reports severity)</code></div><div class="doc"><div class="markdown"><p>Return a list of reports taken from these <code>reports</code> where the severity of the report is greater than this or equal to this <code>severity</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L134">view source</a></div></div><div class="public anchor" id="var-has-activity-type.3F"><h3>has-activity-type?</h3><div class="usage"><code>(has-activity-type? x)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if the object <code>x</code> has a type which is an activity type, else <code>false</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L354">view source</a></div></div><div class="public anchor" id="var-has-actor-type.3F"><h3>has-actor-type?</h3><div class="usage"><code>(has-actor-type? x)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if the object <code>x</code> has a type which is an actor type, else <code>false</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L315">view source</a></div></div><div class="public anchor" id="var-has-context.3F"><h3>has-context?</h3><h4 class="type">macro</h4><div class="usage"><code>(has-context? x)</code></div><div class="doc"><div class="markdown"><p>True if <code>x</code> is an ActivityStreams object with a valid context, else <code>false</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L177">view source</a></div></div><div class="public anchor" id="var-has-type-or-fault"><h3>has-type-or-fault</h3><div class="usage"><code>(has-type-or-fault x acceptable severity token)</code></div><div class="doc"><div class="markdown"><p>If object <code>x</code> has a <code>:type</code> value which is <code>acceptable</code>, return <code>nil</code>; else return a fault object with this <code>severity</code> and <code>token</code>.</p>
|
||
<p><code>acceptable</code> may be passed as either nil, a string, or a set of strings. If <code>acceptable</code> is <code>nil</code>, no type specific tests will be performed.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L213">view source</a></div></div><div class="public anchor" id="var-has-type.3F"><h3>has-type?</h3><div class="usage"><code>(has-type? x type)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if object <code>x</code> has type <code>type</code>, else <code>false</code>.</p>
|
||
<p>The values of <code>type</code> fields of ActivityStreams objects may be lists; they are considered to have a type if the type token is a member of the list.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L122">view source</a></div></div><div class="public anchor" id="var-intransitive-activity-required-properties"><h3>intransitive-activity-required-properties</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Properties intransitive activities should have.</p>
|
||
<p>See <a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-intransitiveactivity">https://www.w3.org/TR/activitystreams-vocabulary/#dfn-intransitiveactivity</a></p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L465">view source</a></div></div><div class="public anchor" id="var-link-faults"><h3>link-faults</h3><div class="usage"><code>(link-faults x)</code></div><div class="doc"><div class="markdown"><p>Return a list of faults found in the link <code>x</code>, or <code>nil</code> if none are found.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L430">view source</a></div></div><div class="public anchor" id="var-make-fault-object"><h3>make-fault-object</h3><div class="usage"><code>(make-fault-object severity fault)</code></div><div class="doc"><div class="markdown"><p>Return a fault object with these <code>severity</code>, <code>fault</code> and <code>narrative</code> values.</p>
|
||
<p>An ActivityPub object MUST have a globally unique ID. Whether this is meaningful depends on whether we persist fault report objects and serve them, which at present I have no plans to do.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L182">view source</a></div></div><div class="public anchor" id="var-nil-if-empty"><h3>nil-if-empty</h3><h4 class="type">macro</h4><div class="usage"><code>(nil-if-empty x)</code></div><div class="doc"><div class="markdown"><p>if <code>x</code> is an empty collection, return <code>nil</code>; else return <code>x</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L207">view source</a></div></div><div class="public anchor" id="var-object-faults"><h3>object-faults</h3><div class="usage"><code>(object-faults x)</code><code>(object-faults x expected-type)</code></div><div class="doc"><div class="markdown"><p>Return a list of faults found in object <code>x</code>, or <code>nil</code> if none are.</p>
|
||
<p>If <code>expected-type</code> is also passed, verify that <code>x</code> has <code>expected-type</code>. <code>expected-type</code> may be passed as a string or as a set of strings.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L237">view source</a></div></div><div class="public anchor" id="var-object-reference-or-faults"><h3>object-reference-or-faults</h3><div class="usage"><code>(object-reference-or-faults value expected-type severity token)</code></div><div class="doc"><div class="markdown"><p>If this <code>value</code> is either </p>
|
||
<ol>
|
||
<li>an object of <code>expected-type</code>;</li>
|
||
<li>a URI referencing an object of <code>expected-type</code>; or</li>
|
||
<li>a link object referencing an object of <code>expected-type</code></li>
|
||
</ol>
|
||
<p>and no faults are returned from validating the linked object, then return <code>nil</code>; else return a sequence comprising a fault object with this <code>severity</code> and <code>token</code>, prepended to the faults returned.</p>
|
||
<p>As with <code>has-type-or-fault</code> (q.v.), <code>expected-type</code> may be passed as a string or as a set of strings.</p>
|
||
<p><strong>NOTE THAT</strong> if <code>*reify-refs*</code> is <code>false</code>, referenced objects will not actually be checked.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L386">view source</a></div></div><div class="public anchor" id="var-persistent-object-faults"><h3>persistent-object-faults</h3><div class="usage"><code>(persistent-object-faults x)</code></div><div class="doc"><div class="markdown"><p>Return a list of faults found in persistent object <code>x</code>, or <code>nil</code> if none are.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L281">view source</a></div></div><div class="public anchor" id="var-severity"><h3>severity</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Severity of faults found, as follows:</p>
|
||
<ol>
|
||
<li><code>:info</code> not actually a fault, but an issue noted during validation;</li>
|
||
<li><code>:minor</code> things which I consider to be faults, but which don’t actually breach the spec;</li>
|
||
<li><code>:should</code> instances where the spec says something SHOULD be done, which isn’t;</li>
|
||
<li><code>:must</code> instances where the spec says something MUST be done, which isn’t;</li>
|
||
<li><code>:critical</code> instances where I believe the fault means that the object cannot be meaningfully processed.</li>
|
||
</ol></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L94">view source</a></div></div><div class="public anchor" id="var-severity-filters"><h3>severity-filters</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Hack for implementing a severity hierarchy</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L108">view source</a></div></div><div class="public anchor" id="var-string-or-fault"><h3>string-or-fault</h3><div class="usage"><code>(string-or-fault value severity token)</code><code>(string-or-fault value severity token pattern)</code></div><div class="doc"><div class="markdown"><p>If this <code>value</code> is not a string, return a fault object with this <code>severity</code> and <code>token</code>, else <code>nil</code>. If <code>pattern</code> is also passed, it is expected to be a Regex, and the fault object will be returned unless <code>value</code> matches the <code>pattern</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L363">view source</a></div></div><div class="public anchor" id="var-truthy.3F"><h3>truthy?</h3><div class="usage"><code>(truthy? x)</code></div><div class="doc"><div class="markdown"><p>Return <code>true</code> if <code>x</code> is truthy, else <code>false</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L117">view source</a></div></div><div class="public anchor" id="var-uri-or-fault"><h3>uri-or-fault</h3><div class="usage"><code>(uri-or-fault u severity if-missing-token)</code><code>(uri-or-fault u severity if-missing-token if-invalid-token)</code></div><div class="doc"><div class="markdown"><p>If <code>u</code> is not a valid URI, return a fault object with this <code>severity</code> and <code>if-invalid-token</code>. If it’s <code>nil</code>, return a fault object with this <code>severity</code> and <code>if-missing-token</code>. Otherwise return nil.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L265">view source</a></div></div><div class="public anchor" id="var-validation-fault-context-uri"><h3>validation-fault-context-uri</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>The URI of the context of a validation fault report object shall be this literal string.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L157">view source</a></div></div><div class="public anchor" id="var-verb-type.3F"><h3>verb-type?</h3><div class="usage"><code>(verb-type? x)</code></div><div class="doc"><div class="markdown"><p><code>true</code> if <code>x</code>, a string, represents a recognised ActivityStreams activity type.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L348">view source</a></div></div><div class="public anchor" id="var-verb-types"><h3>verb-types</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>The set of types we will accept as verbs.</p>
|
||
<p>There’s an <a href="https://www.w3.org/TR/activitystreams-vocabulary/#activity-types">explicit set of allowed verb types</a>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/quack/picky.clj#L338">view source</a></div></div></div></body></html> |