FastATP

Lexicon

A class in fastatp.lexicon (source).

Based on BaseModel.

Base class for user-defined, atproto-conforming record types.

Subclasses declare their NSID as a bare class attribute:

class PressureReading(Lexicon):
    nsid = "com.example.telemetry.pressureReading"
    pressure_psi: int

Subclasses register themselves globally by NSID at definition time; the last definition for an NSID wins (re-definition is allowed to support notebooks and hot reload).

Attributes

Methods

to_json_dict

to_json_dict() -> dict[str, Any]

JSON-mode dict including $type; omitted optionals are dropped.

to_json

to_json() -> str

from_json_dict

from_json_dict(data: dict[str, Any]) -> L

to_dag_cbor

to_dag_cbor() -> bytes

Canonical DAG-CBOR bytes of this record (atproto data-model forms).

cid

cid() -> Any

The record's CID (CIDv1, dag-cbor, sha-256) — identical to atproto.

to_lexicon_json

to_lexicon_json() -> dict[str, Any]

Emit a valid lexicon: 1 schema document for this class.