Shared Definitions
org.hypercerts.defs
Overview#
org.hypercerts.defs is not a record. It holds small object definitions that other lexicons reuse, so that a long-form description, a link, or an uploaded file looks the same wherever it appears. There are seven:
descriptionString: an inline long-form description, as plain text or markdown, with optional rich-text facets.uri: a link to content held outside the network.smallBlobandlargeBlob: an uploaded file of any type.smallImageandlargeImage: an uploaded JPEG, PNG, or WebP image.smallVideo: an uploaded MP4 or WebM video.
Most file-valued fields are a union of uri and one of the blob definitions, so the publisher chooses between linking to content and uploading it. See A Shared Language in the Guide for how records fit together.
Where each definition is used#
| Definition | Used by |
|---|---|
descriptionString | description on activity, collection, feature, and attachment; longDescription on organization |
uri | Paired with a blob definition in every file-valued field listed in this table. Also context on acknowledgement, where it is the alternative to a strong reference. |
smallBlob | content items on attachment and evaluation; attachment on rights; location on location; referenceDocument on vocabulary tag and work-scope tag |
smallImage | image on activity and contributor information; avatar on collection and profile |
largeImage | banner on collection and profile |
smallVideo | Not currently used by the Hypercerts or Certified lexicons |
largeBlob | Not currently used by any lexicon |
Schema#
Lexicon version: 1.4.1 · View the schema
Definitions#
descriptionString
An inline long-form description as plain text or markdown, with optional rich-text annotations.
| Property | Type | Required | Description |
|---|---|---|---|
value | string | Yes | The description text (plain text or markdown). maxLength: 250000 maxGraphemes: 25000 |
facets | array of richtext facet | No | Rich text annotations for the description (mentions, URLs, hashtags, etc). |
uri
Object containing a URI to external data
| Property | Type | Required | Description |
|---|---|---|---|
uri | string (uri) | Yes | URI to external data |
smallBlob
Object containing a blob to external data
| Property | Type | Required | Description |
|---|---|---|---|
blob | blob | Yes | Blob to external data (up to 10MB) maxSize: 10485760 accept: */* |
largeBlob
Object containing a blob to external data
| Property | Type | Required | Description |
|---|---|---|---|
blob | blob | Yes | Blob to external data (up to 100MB) maxSize: 104857600 accept: */* |
smallImage
Object containing a small image
| Property | Type | Required | Description |
|---|---|---|---|
image | blob | Yes | Image (up to 5MB) maxSize: 5242880 accept: image/jpeg, image/jpg, image/png, image/webp |
smallVideo
Object containing a small video
| Property | Type | Required | Description |
|---|---|---|---|
video | blob | Yes | Video (up to 20MB) maxSize: 20971520 accept: video/mp4, video/webm |
largeImage
Object containing a large image
| Property | Type | Required | Description |
|---|---|---|---|
image | blob | Yes | Image (up to 10MB) maxSize: 10485760 accept: image/jpeg, image/jpg, image/png, image/webp |
Examples#
When one of these objects appears as a union member, it carries $type set to org.hypercerts.defs# followed by the definition name. The examples below show the object as it appears inside a record.
Inline description#
A descriptionString with a link facet. Facet offsets are byte positions in the UTF-8 encoding of value, here covering the words "maintenance plan":
{
"$type": "org.hypercerts.defs#descriptionString",
"value": "Phase 1 covers design, permits, and installation. Ongoing upkeep is described in the maintenance plan.",
"facets": [
{
"index": { "byteStart": 85, "byteEnd": 101 },
"features": [
{
"$type": "app.bsky.richtext.facet#link",
"uri": "https://villagehallsolar.example.org/maintenance-plan"
}
]
}
]
}
External link#
A uri pointing to a report hosted elsewhere:
{
"$type": "org.hypercerts.defs#uri",
"uri": "https://villagehallsolar.example.org/reports/phase-1.pdf"
}
Uploaded file#
A smallBlob holding a PDF uploaded to the publisher's repository. The blob value is the reference returned when the file was uploaded:
{
"$type": "org.hypercerts.defs#smallBlob",
"blob": {
"$type": "blob",
"ref": { "$link": "bafkreihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku" },
"mimeType": "application/pdf",
"size": 2418762
}
}
Uploaded image#
A smallImage, as used for an activity's image or a collection's avatar. The property is named image, not blob:
{
"$type": "org.hypercerts.defs#smallImage",
"image": {
"$type": "blob",
"ref": { "$link": "bafkreibme22gw2h7y2h7tg2fhqotaqjucnbc24deqo72b6mkl2egezxhvy" },
"mimeType": "image/jpeg",
"size": 842113
}
}
Rules and best practices#
- Include
$typeon every union member. Readers use it to tell which definition a value follows. A union value without it fails validation. - Upload when content must stay fixed; link when it can't be uploaded. A blob is stored in the publisher's repository and addressed by its content hash, so the record's CID commits to the exact bytes. A
urican point anywhere, and the content there can change or disappear without the record changing. Applications can show readers which kind they are looking at. - Check the size limits before uploading.
smallImageaccepts up to 5 MB,smallBlobandlargeImageup to 10 MB, andsmallVideoup to 20 MB. "Small" and "large" are relative within each family: a large image has the same limit as a small generic blob. For bigger files, use auri. - Use one of the accepted image types. The image definitions accept JPEG, PNG, and WebP. SVG is not accepted. Both
image/jpegandimage/jpgappear in the accept list; useimage/jpegwhen uploading, and treat the two as the same type when reading. - Don't trust the declared MIME type.
mimeTypeis what the uploader declared, not a property of the bytes. Applications typically check content before rendering it. - Write descriptions that read well as plain text or markdown.
descriptionStringallows plain text or markdown, and nothing in the record says which. Keep markup light so the text reads well either way, or follow the convention of the applications you publish for. - Compute facet offsets in bytes. Facet ranges are UTF-8 byte offsets, not character or UTF-16 positions. Offsets computed from native string indices drift as soon as the text contains non-ASCII characters such as accented letters or emoji.
- Prefer the inline description. In the description unions,
descriptionStringneeds no external lexicon and no extra fetch, so it is the variant applications are most likely to display. Keep a short description on the record as well where the record type has one.
Related#
- Attachment: the main user of
uriandsmallBlobfor evidence. - Activity Claim and Collection: users of
descriptionStringand the image definitions. - Certified shared definitions: the equivalent shared definitions for
app.certifiedlexicons. - Guide: A Shared Language, Evidence and Measurements.