dog-and-duck.quack.quack

Validator for ActivityPub objects: if it walks like a duck, and it quacks like a duck…

activity?

(activity? x)

true iff x quacks like an activity, else false.

NOTE THAT Section 4.1 of the spec says explicitly that

Actor objects MUST have, in addition to the properties mandated by 3.1 Object Identifiers, the following properties:

inbox A reference to an [ActivityStreams] OrderedCollection comprised of all the messages received by the actor; see 5.2 Inbox. outbox An [ActivityStreams] OrderedCollection comprised of all the messages produced by the actor; see 5.1 Outbox.

However, none of the provided examples in the activitystreams-test-documents repository does in fact have these properties

activitystreams-context-uri

The URI of the context of an ActivityStreams object is expected to be this literal string.

actor-type?

(actor-type? x)

TODO: write docs

actor-types

The set of types we will accept as actors.

There’s an explicit set of allowed actor types.

actor?

(actor? x)

Returns true if x quacks like an actor, else false.

collection-page?

(collection-page? x)

true iff x quacks like a page in a paged collection, else false.

collection?

(collection? x type)(collection? x)

true iff x quacks like a collection of type type, else false.

With one argument, will recognise plain collections and ordered collections, but (currently) not collection pages.

context?

(context? x)

Returns true iff x quacks like an ActivityStreams context, else false.

A context is either 1. the URI (actually an IRI) activitystreams-context-uri, or 2. a collection comprising that URI and a map.

has-context?

macro

(has-context? x)

TODO: write docs

link?

(link? x)

true iff x quacks like a link, else false.

object?

(object? x)

Returns true iff x is recognisably an ActivityStreams object.

NOTE THAT The ActivityStreams spec says:

All properties are optional (including the id and type)

But we are just not having that, because otherwise we’re flying blind. We shall reject objects lacking at least :type. Missing :id keys are tolerable because they represent transient objects, which we expect to handle.

ordered-collection-page?

(ordered-collection-page? x)

true iff x quacks like a page in an ordered paged collection, else false.

ordered-collection?

(ordered-collection? x)

true iff x quacks like an ordered collection, else false.

persistent-object?

(persistent-object? x)

true iff x is a persistent object.

Transient objects in ActivityPub are not required to have an id key, but persistent ones must have a key, and it must be an IRI (but normally a URI).

unordered-collection?

(unordered-collection? x)

true iff x quacks like an unordered collection, else false.

verb-type?

(verb-type? x)

TODO: write docs

verb-types

The set of types we will accept as verbs.

There’s an explicit set of allowed verb types.