dog-and-duck/docs/codox/dog-and-duck.quack.picky.html

30 lines
16 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="Desiderata.html"><div class="inner"><span>Desiderata</span></div></a></li><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>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 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-4 branch"><a href="dog-and-duck.quack.picky.constants.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>constants</span></div></a></li><li class="depth-4 branch"><a href="dog-and-duck.quack.picky.control-variables.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>control-variables</span></div></a></li><li class="depth-4 branch"><a href="dog-and-duck.quack.picky.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-4 branch"><a href="dog-and-duck.quack.picky.required-properties.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>required-properties</span></div></a></li><li class="depth-4"><a href="dog-and-duck.quack.picky.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-3"><a href="dog-and-duck.quack.quack.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></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: -238px;"><span class="top" style="height: 247px;"></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-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-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-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-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-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-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-uri-or-fault"><div class="inner"><span>uri-or-fault</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-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#L237">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#L303">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#L247">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#L286">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#L121">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#L222">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#L189">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#L231">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>A link object is required to have an <code>href</code> property. It may have all of <code>rel</code> | <code>mediaType</code> | <code>name</code> | <code>hreflang</code> | <code>height</code> | <code>width</code> | <code>preview</code> but I <em>think</em> theyre all optional.</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#L208">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#L58">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#L145">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><code>(persistent-object-faults x types severity token)</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#L100">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#L134">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 its <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#L84">view source</a></div></div></div></body></html>