dog-and-duck.quack.picky
Fault-finder for ActivityPub documents.
Generally, each -faults
function will return:
nil
if no faults were found;- a sequence of fault objects if faults were found.
Each fault object shall have the properties:
:@context
whose value shall be the URL of a document specifying this vocabulary;:type
whose value shall beFault
;:severity
whose value shall be one ofinfo
,minor
,should
,must
orcritical
;:fault
whose value shall be a unique token representing the particular fault type;:narrative
whose value shall be a natural language description of the fault type.
Note that the reason for the :fault
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.
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.
accept-required-properties
As base-activity-required-properties, except that the type of the object is restricted.
activity-required-properties
Properties activities should have, keyed by activity type. Values are maps of the format of base-activity-required-properties
, q.v.
activity-type-faults
(activity-type-faults x)
(activity-type-faults x type)
Return a list of faults found in the activity x
; if type
is also specified, it should be a string naming a specific activity type for which checks should be performed.
Some specific activity types have specific requirements which are not requirements.
actor-faults
(actor-faults x)
Return a list of faults found in actor x
, or nil
if none are.
base-activity-required-properties
Properties most activities should have. Values are validating functions, each.
See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity
collection-faults
(collection-faults x)
(collection-faults x type)
Return a list of faults found in the collection x
; if type
is also specified, it should be a string naming a specific collection type for which checks should be performed.
Every collection should(?) have a totalItems
field (an integer).
Beyond that, collections are either ‘just collections’ (in which case they should have an items
field (a sequence)), or else they’re paged collections, in which case they must(?) have a first
field which is a collection page or a URI pointing to a collection page, and should have a last
field which is similar.
The pages of collections should be collection pages; the pages of ordered collections should be ordered collection pages.
intransitive-activity-required-properties
Properties intransitive activities should have.
See https://www.w3.org/TR/activitystreams-vocabulary/#dfn-intransitiveactivity
link-faults
(link-faults x)
A link object is required to have an href
property. It may have all of rel
| mediaType
| name
| hreflang
| height
| width
| preview
but I think they’re all optional.
persistent-object-faults
(persistent-object-faults x)
(persistent-object-faults x types severity token)
Return a list of faults found in persistent object x
, or nil
if none are.
uri-or-fault
(uri-or-fault u severity if-missing-token)
(uri-or-fault u severity if-missing-token if-invalid-token)
If u
is not a valid URI, return a fault object with this severity
and if-invalid-token
. If it’s nil
, return a fault object with this severity
and if-missing-token
. Otherwise return nil.