actpub-activitystreams 0.2.1

Activity Streams 2.0 data model and vocabulary for ActivityPub.
Documentation

Activity Streams 2.0 data model and vocabulary.

This crate provides pure data types (no I/O, no networking) for the W3C Activity Streams 2.0 Core and Activity Vocabulary specifications, as used by the ActivityPub protocol.

Design

The types are designed for idiomatic serde (de)serialization with tolerant handling of the JSON-LD variants emitted by real-world Fediverse implementations such as Mastodon, Pleroma, Lemmy and Misskey.

Core AS 2.0 types ([Object], [Link], [Activity], [Collection]) are concrete structs with every specification-defined property represented as Option<T> or [OneOrMany<T>]. Concrete vocabulary types that add no new properties (Note, Article, Create, …) share the core structs and are discriminated by string type constants ([kind]), while types that add new properties (Question, Place, Tombstone) are provided as dedicated structs that flatten the core object.

Interoperability

Real Fediverse JSON-LD is inconsistent and requires tolerance:

  • Array-typed properties may appear as a single value (handled by [OneOrMany<T>])
  • Object properties may be inlined or appear as plain URL strings (handled by [UrlOr<T>])
  • The [Public] audience appears in multiple equivalent forms
  • Unknown properties are preserved via flattened extension maps