Skip to content

Commit fb07dd9

Browse files
authored
Merge pull request #181 from hypercerts-org/fix/description-union-type
fix: widen description fields from Leaflet ref to union type
2 parents 7a226d8 + 06fce2c commit fb07dd9

7 files changed

Lines changed: 86 additions & 37 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@hypercerts-org/lexicon": minor
3+
---
4+
5+
Widen description fields on activity, collection, and attachment from a bare Leaflet ref to a union of inline descriptionString and Leaflet linearDocument, with a shared def in org.hypercerts.defs.
6+
7+
This is technically a breaking schema change (ref → union), but not breaking for most published records, as they already include a `$type` discriminator on the description object, so existing data validates against the union without modification.

ERD.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ dataclass collection {
235235
type?
236236
title
237237
shortDescription?
238-
description? (Leaflet ref)
238+
description?
239239
items[]?
240240
location?
241241
createdAt

SCHEMAS.md

Lines changed: 36 additions & 27 deletions
Large diffs are not rendered by default.

lexicons/org/hypercerts/claim/activity.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@
3030
}
3131
},
3232
"description": {
33-
"type": "ref",
34-
"ref": "pub.leaflet.pages.linearDocument#main",
35-
"description": "Rich-text description, represented as a Leaflet linear document."
33+
"type": "union",
34+
"refs": [
35+
"org.hypercerts.defs#descriptionString",
36+
"pub.leaflet.pages.linearDocument",
37+
"com.atproto.repo.strongRef"
38+
],
39+
"description": "Long-form description of the activity. An inline string for plain text or markdown, a Leaflet linear document for rich-text content, or a strong reference to an external description record."
3640
},
3741
"image": {
3842
"type": "union",

lexicons/org/hypercerts/collection.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@
3737
}
3838
},
3939
"description": {
40-
"type": "ref",
41-
"ref": "pub.leaflet.pages.linearDocument#main",
42-
"description": "Rich-text description, represented as a Leaflet linear document."
40+
"type": "union",
41+
"refs": [
42+
"org.hypercerts.defs#descriptionString",
43+
"pub.leaflet.pages.linearDocument",
44+
"com.atproto.repo.strongRef"
45+
],
46+
"description": "Long-form description of the collection. An inline string for plain text or markdown, a Leaflet linear document for rich-text content, or a strong reference to an external description record."
4347
},
4448
"avatar": {
4549
"type": "union",

lexicons/org/hypercerts/context/attachment.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@
6363
}
6464
},
6565
"description": {
66-
"type": "ref",
67-
"ref": "pub.leaflet.pages.linearDocument#main",
68-
"description": "Rich-text description, represented as a Leaflet linear document."
66+
"type": "union",
67+
"refs": [
68+
"org.hypercerts.defs#descriptionString",
69+
"pub.leaflet.pages.linearDocument",
70+
"com.atproto.repo.strongRef"
71+
],
72+
"description": "Long-form description of the attachment. An inline string for plain text or markdown, a Leaflet linear document for rich-text content, or a strong reference to an external description record."
6973
},
7074
"location": {
7175
"type": "ref",

lexicons/org/hypercerts/defs.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
"id": "org.hypercerts.defs",
44
"description": "Common type definitions used across all Hypercerts protocols.",
55
"defs": {
6+
"descriptionString": {
7+
"type": "object",
8+
"description": "An inline long-form description as plain text or markdown, with optional rich-text annotations.",
9+
"required": ["value"],
10+
"properties": {
11+
"value": {
12+
"type": "string",
13+
"description": "The description text (plain text or markdown).",
14+
"maxLength": 250000,
15+
"maxGraphemes": 25000
16+
},
17+
"facets": {
18+
"type": "array",
19+
"description": "Rich text annotations for the description (mentions, URLs, hashtags, etc).",
20+
"items": {
21+
"type": "ref",
22+
"ref": "app.bsky.richtext.facet"
23+
}
24+
}
25+
}
26+
},
627
"uri": {
728
"type": "object",
829
"required": ["uri"],

0 commit comments

Comments
 (0)