From 170c77588339eb1a0a4c27e9b219d08f1e59c1ed Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Wed, 25 Mar 2026 20:17:36 +1300 Subject: [PATCH 1/5] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Move=20block=20lexicon?= =?UTF-8?q?=20defs=20to=20reusable=20namespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Place block type definitions in `pub.oxa.blocks.defs` and generate them at `lexicon/blocks/defs.json` instead of nesting them under the document lexicon. Update generated refs, conversion code, tests, docs, and examples to use the new block namespace.\n\nThis makes the block schema easier to reuse from other document lexicons rather than tying it to `pub.oxa.document.document`. For example, `pub.oxa.blocks.defs#block` can be referenced from an open `content` property in another record schema such as `site.standard.document`.\n\nCo-authored-by: Stencila <47797644+stencila[bot]@users.noreply.github.com> --- docs/atproto-lexicon.md | 12 ++++++------ examples/rfc0003.atproto.json | 20 ++++++++++---------- lexicon/{document => blocks}/defs.json | 2 +- lexicon/document/document.json | 4 ++-- packages/oxa-core/src/convert.test.ts | 18 +++++++++--------- packages/oxa-core/src/convert.ts | 16 ++++++++-------- packages/oxa/src/cli.test.ts | 2 +- scripts/lib/generate-lexicon.ts | 25 ++++++++++++++----------- 8 files changed, 51 insertions(+), 48 deletions(-) rename lexicon/{document => blocks}/defs.json (98%) diff --git a/docs/atproto-lexicon.md b/docs/atproto-lexicon.md index 18af741..dfb0248 100644 --- a/docs/atproto-lexicon.md +++ b/docs/atproto-lexicon.md @@ -19,12 +19,12 @@ By defining a lexicon, OXA documents become first-class objects on the AT Protoc ## Lexicon structure -The OXA lexicon is organized into two namespaces: +The OXA lexicon is organized into three namespaces: | File | NSID | Purpose | | -------------------------------- | --------------------------- | --------------------------------------------------------------------------------------- | | `lexicon/document/document.json` | `pub.oxa.document.document` | The `Document` record type — the root object stored in a PDS | -| `lexicon/document/defs.json` | `pub.oxa.document.defs` | Block-level type definitions (`paragraph`, `heading`, `richText`) and the `block` union | +| `lexicon/blocks/defs.json` | `pub.oxa.blocks.defs` | Block-level type definitions (`paragraph`, `heading`, `richText`) and the `block` union | | `lexicon/richtext/facet.json` | `pub.oxa.richtext.facet` | Facet annotations for inline formatting (`emphasis`, `strong`, `byteSlice`) | A `Document` record contains an array of `children` (blocks). Each block carries a `text` string and an optional `facets` array that annotates ranges of that text with formatting features. @@ -104,7 +104,7 @@ AT Protocol [uses facets instead of a tree](https://www.pfrazee.com/blog/why-fac ```json { - "$type": "pub.oxa.document.defs#paragraph", + "$type": "pub.oxa.blocks.defs#paragraph", "text": "This is bold and italic text.", "facets": [ { @@ -190,13 +190,13 @@ Produces: "$type": "pub.oxa.document.document", "children": [ { - "$type": "pub.oxa.document.defs#heading", + "$type": "pub.oxa.blocks.defs#heading", "level": 1, "text": "Hello", "facets": [] }, { - "$type": "pub.oxa.document.defs#paragraph", + "$type": "pub.oxa.blocks.defs#paragraph", "text": "Some emphasized text.", "facets": [ { @@ -248,7 +248,7 @@ The lexicon files are generated from the OXA YAML schema definitions by the code 1. Loads the merged OXA JSON Schema. 2. Classifies each type as inline or block based on the `Inline` and `Block` union definitions. 3. Maps inline types to facet features in `pub.oxa.richtext.facet` (excluding `Text`, which becomes the plain text string). -4. Maps block types to object definitions in `pub.oxa.document.defs`, replacing their inline `children` arrays with `text` + `facets` pairs. +4. Maps block types to object definitions in `pub.oxa.blocks.defs`, replacing their inline `children` arrays with `text` + `facets` pairs. 5. Emits the `Document` record type in `pub.oxa.document.document`. To regenerate the lexicon after changing the schema: diff --git a/examples/rfc0003.atproto.json b/examples/rfc0003.atproto.json index e62d593..429afe3 100644 --- a/examples/rfc0003.atproto.json +++ b/examples/rfc0003.atproto.json @@ -19,13 +19,13 @@ }, "children": [ { - "$type": "pub.oxa.document.defs#heading", + "$type": "pub.oxa.blocks.defs#heading", "text": "Introduction", "facets": [], "level": 1 }, { - "$type": "pub.oxa.document.defs#paragraph", + "$type": "pub.oxa.blocks.defs#paragraph", "text": "Water (H2O) undergoes autoionization, a process in which a water molecule donates a proton to another. The equilibrium constant for this reaction, Kw, is approximately 10−14 at 25 °C.", "facets": [ { @@ -50,15 +50,15 @@ } ] }, - { "$type": "pub.oxa.document.defs#thematicBreak" }, + { "$type": "pub.oxa.blocks.defs#thematicBreak" }, { - "$type": "pub.oxa.document.defs#heading", + "$type": "pub.oxa.blocks.defs#heading", "text": "Computing the Equilibrium", "facets": [], "level": 2 }, { - "$type": "pub.oxa.document.defs#paragraph", + "$type": "pub.oxa.blocks.defs#paragraph", "text": "The following Python snippet computes Kw from ion concentrations:", "facets": [ { @@ -68,12 +68,12 @@ ] }, { - "$type": "pub.oxa.document.defs#code", + "$type": "pub.oxa.blocks.defs#code", "value": "H_plus = 1e-7 # mol/L\nOH_minus = 1e-7 # mol/L\nKw = H_plus * OH_minus\nprint(f\"Kw = {Kw:.2e}\") # Kw = 1.00e-14", "language": "python" }, { - "$type": "pub.oxa.document.defs#paragraph", + "$type": "pub.oxa.blocks.defs#paragraph", "text": "You can run this with python kw.py. The result confirms the well-known value of Kw.", "facets": [ { @@ -90,15 +90,15 @@ } ] }, - { "$type": "pub.oxa.document.defs#thematicBreak" }, + { "$type": "pub.oxa.blocks.defs#thematicBreak" }, { - "$type": "pub.oxa.document.defs#heading", + "$type": "pub.oxa.blocks.defs#heading", "text": "Summary", "facets": [], "level": 2 }, { - "$type": "pub.oxa.document.defs#paragraph", + "$type": "pub.oxa.blocks.defs#paragraph", "text": "This example demonstrates every node type from RFC0003: Heading, Paragraph, Code, ThematicBreak, Text, Emphasis, Strong, Superscript, Subscript, and InlineCode.", "facets": [ { diff --git a/lexicon/document/defs.json b/lexicon/blocks/defs.json similarity index 98% rename from lexicon/document/defs.json rename to lexicon/blocks/defs.json index 904c586..12333d3 100644 --- a/lexicon/document/defs.json +++ b/lexicon/blocks/defs.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "pub.oxa.document.defs", + "id": "pub.oxa.blocks.defs", "defs": { "richText": { "type": "object", diff --git a/lexicon/document/document.json b/lexicon/document/document.json index b2bcac3..567ac75 100644 --- a/lexicon/document/document.json +++ b/lexicon/document/document.json @@ -26,13 +26,13 @@ }, "title": { "type": "ref", - "ref": "pub.oxa.document.defs#richText" + "ref": "pub.oxa.blocks.defs#richText" }, "children": { "type": "array", "items": { "type": "ref", - "ref": "pub.oxa.document.defs#block" + "ref": "pub.oxa.blocks.defs#block" } }, "createdAt": { diff --git a/packages/oxa-core/src/convert.test.ts b/packages/oxa-core/src/convert.test.ts index 131a5cd..0bcee8d 100644 --- a/packages/oxa-core/src/convert.test.ts +++ b/packages/oxa-core/src/convert.test.ts @@ -26,8 +26,8 @@ const lexiconFiles = { path: resolve(REPO_ROOT, "lexicon/richtext/facet.json"), }, defs: { - id: "pub.oxa.document.defs", - path: resolve(REPO_ROOT, "lexicon/document/defs.json"), + id: "pub.oxa.blocks.defs", + path: resolve(REPO_ROOT, "lexicon/blocks/defs.json"), }, document: { id: "pub.oxa.document.document", @@ -342,9 +342,9 @@ describe("ATProto lexicon structure", () => { expect(main.type).toBe("record"); expect(main.key).toBe("tid"); expect(record.required).toEqual(["children", "createdAt"]); - expect(record.properties.title.ref).toBe("pub.oxa.document.defs#richText"); + expect(record.properties.title.ref).toBe("pub.oxa.blocks.defs#richText"); expect(record.properties.children.items.ref).toBe( - "pub.oxa.document.defs#block", + "pub.oxa.blocks.defs#block", ); expect(record.properties.createdAt).toEqual({ type: "string", @@ -380,7 +380,7 @@ describe("mapBlock", () => { ); await expect(map(block)).resolves.toEqual({ - $type: "pub.oxa.document.defs#paragraph", + $type: "pub.oxa.blocks.defs#paragraph", id: "para-1", classes: ["lead"], data: { align: "left" }, @@ -402,7 +402,7 @@ describe("mapBlock", () => { }); await expect(map(block)).resolves.toEqual({ - $type: "pub.oxa.document.defs#heading", + $type: "pub.oxa.blocks.defs#heading", id: "intro", classes: ["hero"], data: { section: true }, @@ -475,13 +475,13 @@ describe("oxaToAtproto", () => { }, children: [ { - $type: "pub.oxa.document.defs#heading", + $type: "pub.oxa.blocks.defs#heading", level: 1, text: "Introduction", facets: [], }, { - $type: "pub.oxa.document.defs#paragraph", + $type: "pub.oxa.blocks.defs#paragraph", text: "This is bold and italic text.", facets: [ { @@ -543,7 +543,7 @@ describe("oxaToAtproto", () => { metadata, children: [ { - $type: "pub.oxa.document.defs#paragraph", + $type: "pub.oxa.blocks.defs#paragraph", text: "Keep this paragraph", facets: [], }, diff --git a/packages/oxa-core/src/convert.ts b/packages/oxa-core/src/convert.ts index e303807..2bbde8b 100644 --- a/packages/oxa-core/src/convert.ts +++ b/packages/oxa-core/src/convert.ts @@ -96,23 +96,23 @@ interface RichText { type AtprotoParagraph = RichText & BlockNodeBase & { - $type: "pub.oxa.document.defs#paragraph"; + $type: "pub.oxa.blocks.defs#paragraph"; }; type AtprotoHeading = RichText & BlockNodeBase & { - $type: "pub.oxa.document.defs#heading"; + $type: "pub.oxa.blocks.defs#heading"; level: number; }; type AtprotoCode = BlockNodeBase & { - $type: "pub.oxa.document.defs#code"; + $type: "pub.oxa.blocks.defs#code"; value: string; language?: string; }; type AtprotoThematicBreak = BlockNodeBase & { - $type: "pub.oxa.document.defs#thematicBreak"; + $type: "pub.oxa.blocks.defs#thematicBreak"; }; type AtprotoBlock = @@ -177,10 +177,10 @@ export const compatibleFeatures: Record< const formattingPropertyNames = ["id", "classes", "data"] as const; const blockPropertyNames = ["id", "classes", "data"] as const; -const paragraphType = "pub.oxa.document.defs#paragraph" as const; -const headingType = "pub.oxa.document.defs#heading" as const; -const codeType = "pub.oxa.document.defs#code" as const; -const thematicBreakType = "pub.oxa.document.defs#thematicBreak" as const; +const paragraphType = "pub.oxa.blocks.defs#paragraph" as const; +const headingType = "pub.oxa.blocks.defs#heading" as const; +const codeType = "pub.oxa.blocks.defs#code" as const; +const thematicBreakType = "pub.oxa.blocks.defs#thematicBreak" as const; const encoder = new TextEncoder(); diff --git a/packages/oxa/src/cli.test.ts b/packages/oxa/src/cli.test.ts index d440f08..b454a72 100644 --- a/packages/oxa/src/cli.test.ts +++ b/packages/oxa/src/cli.test.ts @@ -85,7 +85,7 @@ describe("oxa cli", () => { metadata: { license: "CC-BY-4.0" }, children: [ { - $type: "pub.oxa.document.defs#paragraph", + $type: "pub.oxa.blocks.defs#paragraph", text: "Hello from CLI", facets: [], }, diff --git a/scripts/lib/generate-lexicon.ts b/scripts/lib/generate-lexicon.ts index 0e255d5..80b451b 100644 --- a/scripts/lib/generate-lexicon.ts +++ b/scripts/lib/generate-lexicon.ts @@ -10,8 +10,8 @@ * model (a plain text string + facets with byte-slice annotations). * * Output files: - * lexicon/richtext/facet.json — facet definition + inline feature types - * lexicon/document/defs.json — block-level type defs and rich text helper + * lexicon/richtext/facet.json — facet definition + inline feature types + * lexicon/blocks/defs.json — block-level type defs and rich text helper * lexicon/document/document.json — the Document record type */ @@ -59,12 +59,15 @@ export async function generateLexicon(): Promise { // Generate the three lexicon files const facetFile = generateFacetLexicon(definitions, inlineMembers); - const defsFile = generateDefsLexicon(definitions, blockMembers); + const blocksDefsFile = generateBlocksDefsLexicon(definitions, blockMembers); const documentFile = generateDocumentLexicon(definitions); // Write files writeLexiconFile(join(LEXICON_DIR, "richtext", "facet.json"), facetFile); - writeLexiconFile(join(LEXICON_DIR, "document", "defs.json"), defsFile); + writeLexiconFile( + join(LEXICON_DIR, "blocks", "defs.json"), + blocksDefsFile, + ); writeLexiconFile( join(LEXICON_DIR, "document", "document.json"), documentFile, @@ -163,14 +166,14 @@ function generateFacetLexicon( } /** - * Generate pub.oxa.document.defs lexicon. + * Generate pub.oxa.blocks.defs lexicon. * * Contains: * - richText: reusable object with text + facets (like Bluesky's pattern) * - One def per block type, with children: Inline[] flattened to richText * - block: union of all block types */ -function generateDefsLexicon( +function generateBlocksDefsLexicon( definitions: Record, blockMembers: string[], ): LexiconFile { @@ -254,7 +257,7 @@ function generateDefsLexicon( return { lexicon: 1, - id: "pub.oxa.document.defs", + id: "pub.oxa.blocks.defs", defs, }; } @@ -284,7 +287,7 @@ function generateDocumentLexicon( if (propName === "title" && isInlineArray(prop)) { recordProperties["title"] = { type: "ref", - ref: "pub.oxa.document.defs#richText", + ref: "pub.oxa.blocks.defs#richText", }; continue; } @@ -295,7 +298,7 @@ function generateDocumentLexicon( type: "array", items: { type: "ref", - ref: "pub.oxa.document.defs#block", + ref: "pub.oxa.blocks.defs#block", }, }; if (schemaRequired.has(propName)) { @@ -451,8 +454,8 @@ function extractNonStructuralProperties( * This is a placeholder for when more types are added to the schema. */ function resolveRefToLexicon(typeName: string): string { - // For now, types map to document defs - return `pub.oxa.document.defs#${toCamelCase(typeName)}`; + // For now, types map to block defs + return `pub.oxa.blocks.defs#${toCamelCase(typeName)}`; } function toCamelCase(s: string): string { From 725892f793a75d41bab7e0a7da296dc116e606f5 Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Wed, 25 Mar 2026 07:19:51 +0000 Subject: [PATCH 2/5] chore(*): update formatted/generated files [skip ci] --- scripts/lib/generate-lexicon.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/lib/generate-lexicon.ts b/scripts/lib/generate-lexicon.ts index 80b451b..ac4ffe0 100644 --- a/scripts/lib/generate-lexicon.ts +++ b/scripts/lib/generate-lexicon.ts @@ -64,10 +64,7 @@ export async function generateLexicon(): Promise { // Write files writeLexiconFile(join(LEXICON_DIR, "richtext", "facet.json"), facetFile); - writeLexiconFile( - join(LEXICON_DIR, "blocks", "defs.json"), - blocksDefsFile, - ); + writeLexiconFile(join(LEXICON_DIR, "blocks", "defs.json"), blocksDefsFile); writeLexiconFile( join(LEXICON_DIR, "document", "document.json"), documentFile, From cbfc32ba06ef3ec0d2d83c4a6227bcc5fa5329ed Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Thu, 26 Mar 2026 08:55:51 +1300 Subject: [PATCH 3/5] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Simplify=20document=20?= =?UTF-8?q?lexicon=20id=20to=20`pub.oxa.document`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- docs/atproto-lexicon.md | 6 +++--- examples/rfc0003.atproto.json | 2 +- lexicon/document/document.json | 2 +- packages/oxa-core/src/convert.test.ts | 8 ++++---- packages/oxa-core/src/convert.ts | 4 ++-- packages/oxa/src/cli.test.ts | 2 +- scripts/lib/generate-lexicon.ts | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/atproto-lexicon.md b/docs/atproto-lexicon.md index dfb0248..e932d9d 100644 --- a/docs/atproto-lexicon.md +++ b/docs/atproto-lexicon.md @@ -23,7 +23,7 @@ The OXA lexicon is organized into three namespaces: | File | NSID | Purpose | | -------------------------------- | --------------------------- | --------------------------------------------------------------------------------------- | -| `lexicon/document/document.json` | `pub.oxa.document.document` | The `Document` record type — the root object stored in a PDS | +| `lexicon/document/document.json` | `pub.oxa.document` | The `Document` record type — the root object stored in a PDS | | `lexicon/blocks/defs.json` | `pub.oxa.blocks.defs` | Block-level type definitions (`paragraph`, `heading`, `richText`) and the `block` union | | `lexicon/richtext/facet.json` | `pub.oxa.richtext.facet` | Facet annotations for inline formatting (`emphasis`, `strong`, `byteSlice`) | @@ -187,7 +187,7 @@ Produces: ```json { - "$type": "pub.oxa.document.document", + "$type": "pub.oxa.document", "children": [ { "$type": "pub.oxa.blocks.defs#heading", @@ -249,7 +249,7 @@ The lexicon files are generated from the OXA YAML schema definitions by the code 2. Classifies each type as inline or block based on the `Inline` and `Block` union definitions. 3. Maps inline types to facet features in `pub.oxa.richtext.facet` (excluding `Text`, which becomes the plain text string). 4. Maps block types to object definitions in `pub.oxa.blocks.defs`, replacing their inline `children` arrays with `text` + `facets` pairs. -5. Emits the `Document` record type in `pub.oxa.document.document`. +5. Emits the `Document` record type in `pub.oxa.document`. To regenerate the lexicon after changing the schema: diff --git a/examples/rfc0003.atproto.json b/examples/rfc0003.atproto.json index 429afe3..af9867b 100644 --- a/examples/rfc0003.atproto.json +++ b/examples/rfc0003.atproto.json @@ -1,5 +1,5 @@ { - "$type": "pub.oxa.document.document", + "$type": "pub.oxa.document", "title": { "text": "Water Dissociation: H2O → H+ + OH−", "facets": [ diff --git a/lexicon/document/document.json b/lexicon/document/document.json index 567ac75..2a555b8 100644 --- a/lexicon/document/document.json +++ b/lexicon/document/document.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "pub.oxa.document.document", + "id": "pub.oxa.document", "defs": { "main": { "type": "record", diff --git a/packages/oxa-core/src/convert.test.ts b/packages/oxa-core/src/convert.test.ts index 0bcee8d..f35457a 100644 --- a/packages/oxa-core/src/convert.test.ts +++ b/packages/oxa-core/src/convert.test.ts @@ -30,7 +30,7 @@ const lexiconFiles = { path: resolve(REPO_ROOT, "lexicon/blocks/defs.json"), }, document: { - id: "pub.oxa.document.document", + id: "pub.oxa.document", path: resolve(REPO_ROOT, "lexicon/document/document.json"), }, } as const; @@ -464,7 +464,7 @@ describe("oxaToAtproto", () => { ); await expect(convertDocument(document, { createdAt })).resolves.toEqual({ - $type: "pub.oxa.document.document", + $type: "pub.oxa.document", title: { text: "Hello, World", facets: [], @@ -505,7 +505,7 @@ describe("oxaToAtproto", () => { await expect( convertDocument(documentNode([]), { createdAt }), ).resolves.toEqual({ - $type: "pub.oxa.document.document", + $type: "pub.oxa.document", children: [], createdAt, }); @@ -539,7 +539,7 @@ describe("oxaToAtproto", () => { ); expect(converted).toEqual({ - $type: "pub.oxa.document.document", + $type: "pub.oxa.document", metadata, children: [ { diff --git a/packages/oxa-core/src/convert.ts b/packages/oxa-core/src/convert.ts index 2bbde8b..834cec4 100644 --- a/packages/oxa-core/src/convert.ts +++ b/packages/oxa-core/src/convert.ts @@ -122,7 +122,7 @@ type AtprotoBlock = | AtprotoThematicBreak; type AtprotoDocument = { - $type: "pub.oxa.document.document"; + $type: "pub.oxa.document"; title?: RichText; metadata?: Record; children: AtprotoBlock[]; @@ -414,7 +414,7 @@ export function oxaToAtproto( options: OxaToAtprotoOptions = {}, ): AtprotoDocument { return { - $type: "pub.oxa.document.document", + $type: "pub.oxa.document", ...getOptionalDocumentFields(session, document), children: mapKnownBlocks(session, document.children), createdAt: options.createdAt ?? new Date().toISOString(), diff --git a/packages/oxa/src/cli.test.ts b/packages/oxa/src/cli.test.ts index b454a72..f9c722a 100644 --- a/packages/oxa/src/cli.test.ts +++ b/packages/oxa/src/cli.test.ts @@ -77,7 +77,7 @@ describe("oxa cli", () => { describe("convert", () => { const createdAt = "2026-03-22T00:00:00.000Z"; const expectedConverted = { - $type: "pub.oxa.document.document", + $type: "pub.oxa.document", title: { text: "CLI Example", facets: [], diff --git a/scripts/lib/generate-lexicon.ts b/scripts/lib/generate-lexicon.ts index ac4ffe0..1044c5c 100644 --- a/scripts/lib/generate-lexicon.ts +++ b/scripts/lib/generate-lexicon.ts @@ -66,7 +66,7 @@ export async function generateLexicon(): Promise { writeLexiconFile(join(LEXICON_DIR, "richtext", "facet.json"), facetFile); writeLexiconFile(join(LEXICON_DIR, "blocks", "defs.json"), blocksDefsFile); writeLexiconFile( - join(LEXICON_DIR, "document", "document.json"), + join(LEXICON_DIR, "document.json"), documentFile, ); @@ -260,7 +260,7 @@ function generateBlocksDefsLexicon( } /** - * Generate pub.oxa.document.document lexicon. + * Generate pub.oxa.document lexicon. * * The Document type becomes a record (matching Bluesky's app.bsky.feed.post pattern). */ @@ -331,7 +331,7 @@ function generateDocumentLexicon( return { lexicon: 1, - id: "pub.oxa.document.document", + id: "pub.oxa.document", defs: { main: { type: "record", From 932184e71e10950de4fac809627131f4cd86ad0f Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Wed, 25 Mar 2026 19:57:36 +0000 Subject: [PATCH 4/5] chore(*): update formatted/generated files [skip ci] --- lexicon/document.json | 50 +++++++++++++++++++++++++++++++++ scripts/lib/generate-lexicon.ts | 5 +--- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 lexicon/document.json diff --git a/lexicon/document.json b/lexicon/document.json new file mode 100644 index 0000000..2a555b8 --- /dev/null +++ b/lexicon/document.json @@ -0,0 +1,50 @@ +{ + "lexicon": 1, + "id": "pub.oxa.document", + "defs": { + "main": { + "type": "record", + "description": "A document with metadata, title, and block content.", + "key": "tid", + "record": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "classes": { + "type": "array", + "items": { + "type": "string" + } + }, + "data": { + "type": "unknown" + }, + "metadata": { + "type": "unknown" + }, + "title": { + "type": "ref", + "ref": "pub.oxa.blocks.defs#richText" + }, + "children": { + "type": "array", + "items": { + "type": "ref", + "ref": "pub.oxa.blocks.defs#block" + } + }, + "createdAt": { + "type": "string", + "format": "datetime" + } + }, + "required": [ + "children", + "createdAt" + ] + } + } + } +} diff --git a/scripts/lib/generate-lexicon.ts b/scripts/lib/generate-lexicon.ts index 1044c5c..8573f40 100644 --- a/scripts/lib/generate-lexicon.ts +++ b/scripts/lib/generate-lexicon.ts @@ -65,10 +65,7 @@ export async function generateLexicon(): Promise { // Write files writeLexiconFile(join(LEXICON_DIR, "richtext", "facet.json"), facetFile); writeLexiconFile(join(LEXICON_DIR, "blocks", "defs.json"), blocksDefsFile); - writeLexiconFile( - join(LEXICON_DIR, "document.json"), - documentFile, - ); + writeLexiconFile(join(LEXICON_DIR, "document.json"), documentFile); console.log(`Generated lexicon files in ${LEXICON_DIR}`); } From 54ab91a0852bcac85c8b8c99eb67a74306ecaa63 Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Thu, 26 Mar 2026 09:04:25 +1300 Subject: [PATCH 5/5] Move generated file --- lexicon/document/document.json | 50 ---------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 lexicon/document/document.json diff --git a/lexicon/document/document.json b/lexicon/document/document.json deleted file mode 100644 index 2a555b8..0000000 --- a/lexicon/document/document.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "lexicon": 1, - "id": "pub.oxa.document", - "defs": { - "main": { - "type": "record", - "description": "A document with metadata, title, and block content.", - "key": "tid", - "record": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "classes": { - "type": "array", - "items": { - "type": "string" - } - }, - "data": { - "type": "unknown" - }, - "metadata": { - "type": "unknown" - }, - "title": { - "type": "ref", - "ref": "pub.oxa.blocks.defs#richText" - }, - "children": { - "type": "array", - "items": { - "type": "ref", - "ref": "pub.oxa.blocks.defs#block" - } - }, - "createdAt": { - "type": "string", - "format": "datetime" - } - }, - "required": [ - "children", - "createdAt" - ] - } - } - } -}