A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1/**
2 * Single-sources the one SkyPress-owned lexicon for the public /lexicon page.
3 *
4 * The owned schema is imported from its canonical JSON (not retyped), so the page's
5 * "the format we own" section cannot silently drift from the lexicon. The interop
6 * `site.standard.*` tables on the page are hand-authored — those lexicons are
7 * community-owned (Decision 0005).
8 */
9import schema from '../../../lexicons/blog.skypress.content.gutenberg.json';
10
11interface LexiconObjectDef {
12 type: string;
13 description: string;
14 required?: string[];
15 properties: Record< string, { type: string; description: string } >;
16}
17
18interface LexiconDoc {
19 lexicon: number;
20 id: string;
21 defs: { main: LexiconObjectDef };
22}
23
24const doc = schema as LexiconDoc;
25
26/** A documented field of the owned content lexicon's `main` object. */
27export interface SchemaField {
28 name: string;
29 type: string;
30 required: boolean;
31 description: string;
32}
33
34/** The owned lexicon's NSID, e.g. `blog.skypress.content.gutenberg`. */
35export const CONTENT_LEXICON_ID = doc.id;
36
37/** The `defs.main` description straight from the schema. */
38export const CONTENT_LEXICON_DESCRIPTION = doc.defs.main.description;
39
40/** The raw schema object, for rendering the actual JSON on the page. */
41export const CONTENT_LEXICON = doc;
42
43/** Ordered field rows for the owned lexicon's `main` object (insertion order). */
44export function contentSchemaFields(): SchemaField[] {
45 const main = doc.defs.main;
46 const required = new Set( main.required ?? [] );
47 return Object.entries( main.properties ).map( ( [ name, def ] ) => ( {
48 name,
49 type: def.type,
50 required: required.has( name ),
51 description: def.description,
52 } ) );
53}