Skip to content

Commit cbfc32b

Browse files
nokomestencila[bot]
andcommitted
♻️ Simplify document lexicon id to pub.oxa.document
Simplify the document record NSID from `pub.oxa.document.document` to `pub.oxa.document`, consistent with the naming convention used by `site.standard.document` and others. This is possible now that block type definitions have been moved to their own `pub.oxa.blocks.defs` namespace. Co-authored-by: Stencila <47797644+stencila[bot]@users.noreply.github.com>
1 parent 725892f commit cbfc32b

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/atproto-lexicon.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The OXA lexicon is organized into three namespaces:
2323

2424
| File | NSID | Purpose |
2525
| -------------------------------- | --------------------------- | --------------------------------------------------------------------------------------- |
26-
| `lexicon/document/document.json` | `pub.oxa.document.document` | The `Document` record type — the root object stored in a PDS |
26+
| `lexicon/document/document.json` | `pub.oxa.document` | The `Document` record type — the root object stored in a PDS |
2727
| `lexicon/blocks/defs.json` | `pub.oxa.blocks.defs` | Block-level type definitions (`paragraph`, `heading`, `richText`) and the `block` union |
2828
| `lexicon/richtext/facet.json` | `pub.oxa.richtext.facet` | Facet annotations for inline formatting (`emphasis`, `strong`, `byteSlice`) |
2929

@@ -187,7 +187,7 @@ Produces:
187187

188188
```json
189189
{
190-
"$type": "pub.oxa.document.document",
190+
"$type": "pub.oxa.document",
191191
"children": [
192192
{
193193
"$type": "pub.oxa.blocks.defs#heading",
@@ -249,7 +249,7 @@ The lexicon files are generated from the OXA YAML schema definitions by the code
249249
2. Classifies each type as inline or block based on the `Inline` and `Block` union definitions.
250250
3. Maps inline types to facet features in `pub.oxa.richtext.facet` (excluding `Text`, which becomes the plain text string).
251251
4. Maps block types to object definitions in `pub.oxa.blocks.defs`, replacing their inline `children` arrays with `text` + `facets` pairs.
252-
5. Emits the `Document` record type in `pub.oxa.document.document`.
252+
5. Emits the `Document` record type in `pub.oxa.document`.
253253

254254
To regenerate the lexicon after changing the schema:
255255

examples/rfc0003.atproto.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$type": "pub.oxa.document.document",
2+
"$type": "pub.oxa.document",
33
"title": {
44
"text": "Water Dissociation: H2O → H+ + OH−",
55
"facets": [

lexicon/document/document.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"lexicon": 1,
3-
"id": "pub.oxa.document.document",
3+
"id": "pub.oxa.document",
44
"defs": {
55
"main": {
66
"type": "record",

packages/oxa-core/src/convert.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const lexiconFiles = {
3030
path: resolve(REPO_ROOT, "lexicon/blocks/defs.json"),
3131
},
3232
document: {
33-
id: "pub.oxa.document.document",
33+
id: "pub.oxa.document",
3434
path: resolve(REPO_ROOT, "lexicon/document/document.json"),
3535
},
3636
} as const;
@@ -464,7 +464,7 @@ describe("oxaToAtproto", () => {
464464
);
465465

466466
await expect(convertDocument(document, { createdAt })).resolves.toEqual({
467-
$type: "pub.oxa.document.document",
467+
$type: "pub.oxa.document",
468468
title: {
469469
text: "Hello, World",
470470
facets: [],
@@ -505,7 +505,7 @@ describe("oxaToAtproto", () => {
505505
await expect(
506506
convertDocument(documentNode([]), { createdAt }),
507507
).resolves.toEqual({
508-
$type: "pub.oxa.document.document",
508+
$type: "pub.oxa.document",
509509
children: [],
510510
createdAt,
511511
});
@@ -539,7 +539,7 @@ describe("oxaToAtproto", () => {
539539
);
540540

541541
expect(converted).toEqual({
542-
$type: "pub.oxa.document.document",
542+
$type: "pub.oxa.document",
543543
metadata,
544544
children: [
545545
{

packages/oxa-core/src/convert.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ type AtprotoBlock =
122122
| AtprotoThematicBreak;
123123

124124
type AtprotoDocument = {
125-
$type: "pub.oxa.document.document";
125+
$type: "pub.oxa.document";
126126
title?: RichText;
127127
metadata?: Record<string, unknown>;
128128
children: AtprotoBlock[];
@@ -414,7 +414,7 @@ export function oxaToAtproto(
414414
options: OxaToAtprotoOptions = {},
415415
): AtprotoDocument {
416416
return {
417-
$type: "pub.oxa.document.document",
417+
$type: "pub.oxa.document",
418418
...getOptionalDocumentFields(session, document),
419419
children: mapKnownBlocks(session, document.children),
420420
createdAt: options.createdAt ?? new Date().toISOString(),

packages/oxa/src/cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe("oxa cli", () => {
7777
describe("convert", () => {
7878
const createdAt = "2026-03-22T00:00:00.000Z";
7979
const expectedConverted = {
80-
$type: "pub.oxa.document.document",
80+
$type: "pub.oxa.document",
8181
title: {
8282
text: "CLI Example",
8383
facets: [],

scripts/lib/generate-lexicon.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export async function generateLexicon(): Promise<void> {
6666
writeLexiconFile(join(LEXICON_DIR, "richtext", "facet.json"), facetFile);
6767
writeLexiconFile(join(LEXICON_DIR, "blocks", "defs.json"), blocksDefsFile);
6868
writeLexiconFile(
69-
join(LEXICON_DIR, "document", "document.json"),
69+
join(LEXICON_DIR, "document.json"),
7070
documentFile,
7171
);
7272

@@ -260,7 +260,7 @@ function generateBlocksDefsLexicon(
260260
}
261261

262262
/**
263-
* Generate pub.oxa.document.document lexicon.
263+
* Generate pub.oxa.document lexicon.
264264
*
265265
* The Document type becomes a record (matching Bluesky's app.bsky.feed.post pattern).
266266
*/
@@ -331,7 +331,7 @@ function generateDocumentLexicon(
331331

332332
return {
333333
lexicon: 1,
334-
id: "pub.oxa.document.document",
334+
id: "pub.oxa.document",
335335
defs: {
336336
main: {
337337
type: "record",

0 commit comments

Comments
 (0)