fork of indigo with slightly nicer lexgen
at main 1.0 kB view raw
1/* 2Package data supports schema-less serializaiton and deserialization of atproto data 3 4Some restrictions from the data model include: 5- string sizes 6- array and object element counts 7- the "shape" of $bytes and $blob data objects 8- $type must contain a non-empty string 9 10Details are specified at https://atproto.com/specs/data-model 11 12This package includes types (CIDLink, Bytes, Blob) which are represent the corresponding atproto data model types. These implement JSON and CBOR marshaling in (with whyrusleeping/cbor-gen) the expected way. 13 14Can parse generic atproto records (or other objects) in JSON or CBOR format in to map[string]interface{}, while validating atproto-specific constraints on data (eg, that cid-link objects have only a single field). 15 16Has a helper for serializing generic data (map[string]interface{}) to CBOR, which handles converting JSON-style object types (like $link and $bytes) as needed. There is no "MarshalJSON" method; simply use the standard library's `encoding/json`. 17*/ 18package data