Readonlycolumn: stringcolumn whose cells must resolve
Readonlyreferences: { column: string; table: string }the referenced table and the column its values are drawn from
Readonlytable: stringid of the [table] holding the referencing column
Readonlycolumn: stringcolumn whose cells must resolve
ReadonlyoneOf: readonly string[]the exact closed set the column's cells must belong to
Readonlytable: stringid of the [table] holding the referencing column
Readonlycolumn: stringcolumn whose cells must resolve
Readonlyreferences: { node: string }the authored node-id namespace (a node tag) the column's cells must belong to
Readonlytable: stringid of the [table] holding the referencing column
import { compile, validateCatalog } from '@datamoc/mwg/mwl';
const game = compile(
"[{ tag: 'table', id: 'items', columns: 'id:string', children: [{ tag: 'row', id: 'sword' }] }, { tag: 'table', id: 'recipes', columns: 'ingredient:string', children: [{ tag: 'row', ingredient: 'sword' }] }]",
);
const declarations = [{ table: 'recipes', column: 'ingredient', references: { table: 'items', column: 'id' } }];
console.log(validateCatalog(game, { tableReferences: declarations })); // []
One declarative cross-table reference: a column of one
[table]whose every cell must resolve: against a column of another[table], against an authored node-id namespace (references: { node: 'monster' }checks every cell names an authored[monster]id), or against a closed value set. The declaration names the shape; the contents (which column points where, which set is legal) stay game data in the consuming repository.