diff --git a/changelog.d/metamodel-docs-mustache.md b/changelog.d/metamodel-docs-mustache.md new file mode 100644 index 0000000000..1272c17519 --- /dev/null +++ b/changelog.d/metamodel-docs-mustache.md @@ -0,0 +1,17 @@ +- **metamodel-docs: the vocabulary reference pages are shared Mustache templates, and every + port writes them.** `INDEX.md`, `providers.md` and the `types/.md` pages are now the + `templates/metamodel/` template set rendered over page data each port builds from its own + registry vocabulary manifest and its embedded provider definitions. C#, Java, Kotlin, Python + and Rust gain a `metamodel-docs` generator; every port is held to `fixtures/metamodel-docs/` + (the page data under `data/` and the bytes under `expected/`). A project can override a + page by placing a `templates/metamodel/.mustache` of its own. The TypeScript pages are + unchanged except one fix: `index.lookup` was missing its owning provider + (`metaobjects-core-types`) and the provider of its `@fields`, because the index definition + was left out of the provenance list. + + Upgrading: `@metaobjectsdev/metadata` no longer exports `renderMetamodelDocs`, + `renderCoreMetamodelDocs`, `buildMetamodelProvenance` or the `MetamodelProvenance` type; it + exports `coreMetamodelDocsPages()` and `buildMetamodelDocsPages()` (each page's path, + template ref and data) instead, and codegen-ts renders them. An ejected + `codegen/generators/metamodel-docs.ts` that calls `renderCoreMetamodelDocs` stops compiling: + eject it again (`meta eject metamodel-docs`). diff --git a/docs/CONFORMANCE.md b/docs/CONFORMANCE.md index 6fd17c37ae..86264bbe6c 100644 --- a/docs/CONFORMANCE.md +++ b/docs/CONFORMANCE.md @@ -56,7 +56,7 @@ regenerate with `ls -d fixtures//*/ | wc -l` for directory-shaped corpor | [`fixtures/agent-context-conformance/`](../fixtures/agent-context-conformance/) | 6 | ✓ (the emitter is TS-owned) | — | — | — | — | — | | [`fixtures/list-query-conformance/`](../fixtures/list-query-conformance/) (how a list route reads its query string: filter tree, search, sort, page, or the named 400) | 95 cases | ✓ (reference; the source of the expected answers) | planned (R-JV) | planned (R-KT) | ✓ (`ListQueryConformanceTests`) | planned (R-PY) | ✓ (`list_query_conformance.rs`, the parser `meta_http` ships) | | [`fixtures/docs-page-conformance/`](../fixtures/docs-page-conformance/) (the requirements pages and the model-only schema page: each page's data and bytes) | 4 cases | ✓ (reference; the source of the expected bytes) | planned | planned (through Java) | ✓ | planned | planned (G-RS-1) | -| [`fixtures/metamodel-docs/`](../fixtures/metamodel-docs/) | 1 | ✓ (docs emit is TS-owned) | — | — | — | — | — | +| [`fixtures/metamodel-docs/`](../fixtures/metamodel-docs/) (the vocabulary reference pages: each page's data and bytes, shared `templates/metamodel/`) | 1 (23 pages) | ✓ (reference; the source of the expected bytes) | ✓ (`MetamodelDocsCorpusTest`) | ✓ (through Java's builder and emitter) | ✓ (`MetamodelDocsTests`) | ✓ (`test_metamodel_docs_conformance.py`) | ✓ (`tests/metamodel_docs.rs`) | | [`fixtures/fmt-conformance/`](../fixtures/fmt-conformance/) (#304 — `meta fmt`) | 13 | ✓ (reference) | ✓ | inherits via Java | ✓ | ✓ | — (no `fmt`) | | [`fixtures/field-lint-conformance/`](../fixtures/field-lint-conformance/) (the `verify` field authoring lint) | 15 | ✓ (reference) | ✓ | inherits via Java | ✓ | ✓ | — | | [`fixtures/model-lint-conformance/`](../fixtures/model-lint-conformance/) (the `verify` overlay, node-name and deprecated-reference authoring lints) | 17 | ✓ (reference) | planned | planned (through Java) | ✓ | planned | — | diff --git a/docs/features/own-your-codegen.md b/docs/features/own-your-codegen.md index 3fa7607b22..e8411c78e6 100644 --- a/docs/features/own-your-codegen.md +++ b/docs/features/own-your-codegen.md @@ -292,7 +292,7 @@ it yourself. | `api-docs` | which units get a page, where a page lands, whether the index and the agent form (`AGENT-API.md`) are written | the model of the generated API (`buildApiModelForRun`, which also reads the run: layout, `apiPrefix`, whether Hono routes are wired) and its renderers (`renderEntityApiPage`, `renderApiIndex`, `renderAgentApi`) | | `requirements` | which files the ledger becomes and where they land (`requirements.md`, `requirements.toon`); a project with no `requirement.*` node gets none | the two page builders (`requirements-markdown`, `requirements-toon`) and the projection they read (`requirements-view`) | | `agent-docs` | which of the three pages are written and where | the three page builders (`agent-schema-page`, which also walks the model for the column-to-field map, lineage, relationships and enums; `agent-ui-page`; `agent-requirements-page`) | -| `metamodel-docs` | where the pages land | nothing: the pages are rendered by `@metaobjectsdev/metadata`, which is core | +| `metamodel-docs` | which pages are written and where they land | the page render call (`renderDocPage`); each page's data comes from `coreMetamodelDocsPages` in `@metaobjectsdev/metadata`, which is core, and its layout from the shared `metamodel/*.mustache` templates | The page templates themselves (the Mustache files the docs generators render) stay in the package. To change the wording of a model page you need no eject: put a file of the same diff --git a/docs/ports/csharp.md b/docs/ports/csharp.md index cce71caf63..f0546ce187 100644 --- a/docs/ports/csharp.md +++ b/docs/ports/csharp.md @@ -360,6 +360,11 @@ a project whose `codegen/Codegen.csproj` pins an older `MetaObjects.Codegen` tha prints a warning naming the line to change. See [Own your codegen → C#](../features/own-your-codegen.md#c-dotnet-meta-eject). +**The metamodel reference.** The `metamodel-docs` generator writes the metamodel vocabulary +reference (`metamodel/INDEX.md`, `providers.md`, `types/.md`) from the shared +`templates/metamodel/` Mustache set; a `metamodel/.mustache` under its `TemplateRoot` +overrides a shipped page. + **Generators write through a code writer.** `MetaObjects.Codegen.Writer.CsWriter` is where a generator's layout lives (ADR-0063): it owns the indent, the braces, the `using` lines and the blank lines, so a generator states what the file says and not how many spaces it takes. Every diff --git a/docs/ports/java.md b/docs/ports/java.md index 4e16e40415..f8d7638489 100644 --- a/docs/ports/java.md +++ b/docs/ports/java.md @@ -468,6 +468,7 @@ name in every port. | `template` | `TemplateScopeGenerator` | `metaobjects-codegen-base` | The generic Mustache primitive: walk the model by a named `scope`, render one shared template per walk result, write each file. The declarative alternative to writing a generator class — see [Declarative template-codegen](#declarative-template-codegen-templatescopegenerator) below. It renders through `render.templategen.TemplateGenerator`, the byte-pinned cross-port factory; that factory takes a walk callback and is not itself a `Generator`, so `TemplateScopeGenerator` is the class a pom names. | | `api-docs` | `JavaApiDocsGenerator` | `metaobjects-codegen-spring` | The Java SDK api reference: one page per entity, value object, projection, served report and template, an index and `AGENT-API.md`, under `/`. A `` entry like any other, run by `metaobjects:generate` and checked by `metaobjects:verify`. Args: `outputDir` (required; give it generated files only, since `verify` compares the whole tree), `apiSubDir` (default `api/java`), `layout` (`flat`, the default, or `package`), `projectName` (the agent page's header label, default `project`) and `modelBaseUrl` (absolute base for the links to the model pages; with none set the pages carry no `Model / metadata` link, since nothing writes a page for it to point at). The `metaobjects:docs` goal was removed in 8.1.0 ([migration](../features/migrations/docs-are-generators.md#java-and-kotlin)). Ejectable: the copy takes the page IR, the builder, the renderer, the page paths and the page templates with it. | | `plantuml` | `PlantUMLGenerator` | `metaobjects-codegen-plantuml` | One PlantUML class diagram of the object model (`outputDir`, `outputFilename`; `showAttrs`, `showFields`, `showAbstracts`, `drawKeys`, `drawRefs` choose what is drawn). Ejectable: the copy takes `PlantUMLWriter` with it. | +| `metamodel-docs` | `MetamodelDocsGenerator` | `metaobjects-codegen-base` | The reference of the built-in metamodel as Markdown: `INDEX.md`, `providers.md` and one `types/.md` per type family, rendered from the shared `templates/metamodel/` Mustache set over the build's own registry, so every port writes the same pages. Args: `outputDir` (required, generated files only), `subDir` (default `metamodel`; empty writes at the root) and `metamodelTemplateDir` (a directory holding `metamodel/.mustache` that win over the packaged ones; a same-path resource earlier on the classpath does too). Reads no model objects. Ejectable: the page data and templates stay in the package. | | `html-docs` | `MetaDataHtmlDocumentationGenerator` | `metaobjects-codegen-base` | One HTML page describing the registered metamodel types (`outputDir`, `outputFilename`). It reads the type registry, not your model, so it documents the vocabulary your build loads, providers included. Ejectable: the copy takes `MetaDataHtmlDocumentationWriter` with it. | | `ai-docs` | `MetaDataAIDocumentationGenerator` | `metaobjects-codegen-base` | The same type reference as JSON, laid out for an AI reader (`outputDir`, `outputFilename`). Ejectable: the copy takes `MetaDataAIDocumentationWriter` with it. | | `json-schema` | `MetaDataFileJsonSchemaGenerator` | `metaobjects-codegen-base` | A JSON Schema that validates metadata files, built from the type registry (`outputDir`, `outputFilename`). Ejectable: the copy takes `MetaDataFileSchemaWriter` with it. | diff --git a/docs/ports/kotlin.md b/docs/ports/kotlin.md index a2a0b1c4c5..e05ee86362 100644 --- a/docs/ports/kotlin.md +++ b/docs/ports/kotlin.md @@ -186,6 +186,7 @@ The 18 generators registered in `codegen-kotlin` (`GeneratorRegistry.kt`): | `KotlinReportExportGenerator` | Standalone export of a served report (`?format=csv\|json\|xml`, see [Report export](#report-export)): one `Export.kt` per served report beside its controller and one shared `ReportExportWriter.kt`. Args: `outputDir` (required), `maxRows` (default `100000`), `xmlNulls` (`empty`, the default, or `nil`), `csvBom` (default `false`) and `writerPackage` (default: the package prefix the served reports share, else `export`). Never implied by a library. Ejectable | every served report | | `KotlinSharedModelGenerator` | `.metaobjects.json` and `metaobjects.pkg.json` — the FR-023 shared-model artifact and manifest a consumer's `meta deps sync` reads. See [Publishing a shared model](#publishing-a-shared-model-shared-model) | once per project (`include` selects the nodes) | | `KotlinApiDocsGenerator` | The Kotlin SDK api reference, under `/`: `.md` per entity, value object, projection, served report and template, a `README.md` index and `AGENT-API.md`. A `` entry like any other, run by `metaobjects:generate` and checked by `metaobjects:verify`. Args: `outputDir` (required, generated files only), `apiSubDir` (default `api/kotlin`), `layout` (`flat` or `package`), `projectName` and `modelBaseUrl`, as for the Java `api-docs` (with no `modelBaseUrl` the pages carry no `Model / metadata` link). The `metaobjects:docs` goal was removed in 8.1.0 ([migration](../features/migrations/docs-are-generators.md#java-and-kotlin)). Ejectable, with the page model, builder, renderer and path math | the whole model, once | +| `KotlinMetamodelDocsGenerator` | The reference of the built-in metamodel, under `/`: `INDEX.md`, `providers.md` and one `types/.md` per type family, rendered from the shared `templates/metamodel/` Mustache set over the build's own registry, so every port writes the same pages. Args: `outputDir` (required, generated files only), `subDir` (default `metamodel`; empty writes at the root) and `metamodelTemplateDir` (a directory holding `metamodel/.mustache` that win over the packaged ones). Reads no model objects. Ejectable | once per project | Maven wiring. The plugin bundles `metaobjects-codegen-kotlin`, so it is not a dependency of your project. Keep `` at plugin level and bind the goal in ``: without the diff --git a/docs/ports/python.md b/docs/ports/python.md index 8456983740..ede38a0985 100644 --- a/docs/ports/python.md +++ b/docs/ports/python.md @@ -1087,6 +1087,7 @@ definitions, and import lines are stable. | Drift verify | Yes — template / payload drift (`metaobjects verify`); `verify --codegen` regenerates the config's list and diffs each target's `outDir` | | API reference docs | Yes — `api-docs` in a target's `generators`, options in the top-level `apiDocs` block (`apiSubDir`, `projectName`, `modelBaseUrl`); `metaobjects docs` was removed in 1.1.0 ([migration](../features/migrations/docs-are-generators.md#python)) | | Requirements and agent pages | Yes — `requirements` (`requirements.md`, `requirements.toon`) and `agent-docs` (`agent/requirements.md` and the model-only `agent/schema.md`: no SQL types, defaults, indexes or checks; `agent/ui.md` is TypeScript-only) in a target's `generators`, rendered from the shared templates bundled in the package; a same-named file under the project's templates directory overrides a page; both ejectable | +| Metamodel reference | Yes — `metamodel-docs` in a target's `generators` (`INDEX.md`, `providers.md` and `types/.md` under `metamodel/`; option `subDir`), rendered from the shared templates bundled in the package over the port's own registry manifest and embedded provider definitions; reads no model objects; a same-named file under the project's templates directory overrides a page; ejectable | | Requirement gate + requirement tests | Yes (`metaobjects verify`, on every run; `requirement-tests` emits pytest and is ejectable) | | Business-rules gate (ADR-0066, experimental) | Yes (`metaobjects verify`, on every run; see [business rules](../features/business-rules.md)) | | Runtime metadata | Yes (`metaobjects.runtime.ObjectManagerDb` — DB-API 2 drivers: Postgres via pg8000/psycopg, `SqliteDriver` over the standard library's `sqlite3`, `MySqlDriver` over PyMySQL with the `mysql` extra) + loader API + render engine | diff --git a/docs/ports/rust.md b/docs/ports/rust.md index 9b9eca7b3a..40a94feb12 100644 --- a/docs/ports/rust.md +++ b/docs/ports/rust.md @@ -35,7 +35,7 @@ The loader is the `metaobjects` crate, and the workspace at `server/rust/` adds | Frozen tree | The loader freezes the tree when it finishes. A frozen tree memoizes its resolved reads (effective children, attributes and array-ness), so many readers can share one. | | Timings | Every load records how long each phase and each validation pass took (`LoadResult::timings`). | | Report shapes | `metaobjects::report_shape::report_shape` derives an `object.report`'s fields (FR-044 Table B, with Table C's `required`): each dimension and measure, its subtype, and the `@of` field it takes its type from. It byte-matches `fixtures/persistence-conformance/report-shapes.json`, as every port does. | -| Code generation (`cargo meta`) | The run engine, eleven generators (`entity`, `rules-names`, `contract-types`, `repository`, `service`, `service-routes`, `client`, `commands`, `render-helper`, `output-parser`, `output-prompt`), the codegen and template drift gates and `eject`. See [The command](#the-command-cargo-meta) and [What `gen` writes](#what-gen-writes) below. | +| Code generation (`cargo meta`) | The run engine, twelve generators (`entity`, `rules-names`, `contract-types`, `repository`, `service`, `service-routes`, `client`, `commands`, `render-helper`, `output-parser`, `output-prompt`, and the opt-in `metamodel-docs`, the metamodel reference pages rendered from the shared Mustache set), the codegen and template drift gates and `eject`. See [The command](#the-command-cargo-meta) and [What `gen` writes](#what-gen-writes) below. | ## The command: `cargo meta` @@ -78,10 +78,11 @@ one, and no eject is needed: The file takes that one key: a layer is only a generator, so there are no layer settings. An entry is a name, or `{"name": "", "options": {...}}` for a generator that takes options; the generator's `configure` reads them and refuses a key it does not know (`ERR_UNKNOWN_GENERATOR_OPTION`, -naming the options it takes). The shipped generators take none, so any option given to one fails the -run, also a run `--generators` narrows to other generators. A project with no such file runs every -generator but `service-routes`, which runs only when it is listed: an HTTP server is a choice the -project makes, not a default. A generator that leaves the list has its files removed +naming the options it takes). Of the shipped generators only `metamodel-docs` takes one (`subDir`), so +any other option fails the run, also a run `--generators` narrows to other generators. A project with +no such file runs every generator but `service-routes` and `metamodel-docs`, which run only when they +are listed: an HTTP server is a choice the project makes, not a default, and so are the metamodel +reference pages. A generator that leaves the list has its files removed on the next `gen` (a file somebody edited is refused by name instead), and the run fails, naming the file, for a name nothing offers, a duplicate, an unknown key, or a generator listed without one it builds on (`client`, `render-helper` and `output-parser` need `entity`; `commands` needs `entity` and `client`; each layer needs the one beneath it, up to `service-routes`, which needs `service`). `cargo meta gen --list` shows each generator diff --git a/fixtures/generator-registry-conformance/registry.json b/fixtures/generator-registry-conformance/registry.json index 8854ecaca7..a6a3d2e7f1 100644 --- a/fixtures/generator-registry-conformance/registry.json +++ b/fixtures/generator-registry-conformance/registry.json @@ -349,9 +349,9 @@ "concept": "The reference of the built-in metamodel: every type, subtype and attribute the build registers, by provider.", "tier": "neutral", "layer": "docs", - "note": "TYPESCRIPT ONLY: it was `meta docs --metamodel` until 1.1.0 (ADR-0034 Amendment 9).", + "note": "Every port renders the shared templates/metamodel/ Mustache set over its own registry manifest and provider definitions, gated by fixtures/metamodel-docs/. In TypeScript it was `meta docs --metamodel` until 1.1.0 (ADR-0034 Amendment 9).", "eject": "full", - "ports": ["typescript"] + "ports": ["typescript", "csharp", "java", "kotlin", "python", "rust"] }, "docs-site": { "concept": "The browsable HTML site of the model: navigation, search, a page per package and per object, ER diagrams.", diff --git a/fixtures/metamodel-docs/README.md b/fixtures/metamodel-docs/README.md new file mode 100644 index 0000000000..51bff640b5 --- /dev/null +++ b/fixtures/metamodel-docs/README.md @@ -0,0 +1,47 @@ +# metamodel-docs + +The shared corpus for the vocabulary reference pages the `metamodel-docs` generator writes in +every port: `INDEX.md`, `providers.md` and one `types/.md` per type family. They +document the metamodel itself (every registered type, subtype and attribute, and the provider +that registers each), not a project's model, so there is one case and no input model. + +**The TypeScript generator is the source of the expected bytes.** A port that disagrees with +the corpus is wrong, not the corpus. Regenerate it with `bun run scripts/regen-metamodel-docs.ts` +after a vocabulary, description or template change, then run `scripts/sync-doc-templates.sh` +so every port's template copy follows. + +## How a page is made + +Every page is a shared Mustache template fed the data a builder computes: + +| Page | Template (canonical copy) | +|---|---| +| `INDEX.md` | `templates/metamodel/index.md.mustache` | +| `providers.md` | `templates/metamodel/providers.md.mustache` | +| `types/.md` | `templates/metamodel/type-page.md.mustache` | + +Each port builds the data from what it already holds: + +- **its registry vocabulary manifest**, the one `registry-conformance` byte-matches to + `expected-registry.json`: the types, attributes, descriptions, rules and child rules; +- **its embedded provider definitions** (the vendored `spec/metamodel/*.json`): which provider + owns each type and contributes each attribute, and each attribute's default. The manifest is + provider-blind by design (ADR-0050), so this is the only place that fact lives; +- **`templates/metamodel/provider-descriptions.json`**, shipped beside the templates: each + provider's one-line description. The TypeScript test holds it equal to the descriptions on + the TypeScript provider objects. + +The builder makes every decision (sorting, table cells, joined lists, links, the provider and +default of each attribute); the template only lays the lines out. So a case has two checks: + +1. **Builder.** The port's builder produces `data/.json` (compare as JSON values). +2. **Page.** Rendering the page's template with that data produces `expected/` byte for + byte, and the port writes exactly the pages `expected/` holds. + +Ownership follows the definitions: a definition's `types[]` entries are what that provider +owns, with their inline attributes; its `extends[]` entries are attributes it contributes to a +type another provider owns (`"*"` resolves to every subtype the manifest lists for that type); +the universal `*.*` entry's attributes are common attributes. The first definition to declare +an attribute on a type names its provider and default, and an attribute a subtype inherits +from `.base` takes the base's. Documentation (common) attributes are left off the type +pages and listed once on the providers page. diff --git a/fixtures/metamodel-docs/data/INDEX.md.json b/fixtures/metamodel-docs/data/INDEX.md.json new file mode 100644 index 0000000000..0990113b09 --- /dev/null +++ b/fixtures/metamodel-docs/data/INDEX.md.json @@ -0,0 +1,509 @@ +{ + "rows": [ + { + "typeSubType": "api.base", + "description": "Registry anchor for the declared API surface (ADR-0030, ADR-0054): not authorable. The `api` subtype axis is the interaction model, never the protocol; protocol lives in `binding.*` on each operation.", + "page": "types/api.md#apibase" + }, + { + "typeSubType": "api.operational", + "description": "A named, packaged request/response surface whose children are operations (ADR-0030). It is a wire contract: two of them (`v1`, `v2`) may declare the same operation side by side. The code behind it is one service per metadata package, whose surface is the package's operations (ADR-0067). Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "page": "types/api.md#apioperational" + }, + { + "typeSubType": "attr.base", + "description": "Abstract base attribute — the polymorphic/unconstrained value-type marker. Stores its value type-preserved (never stringified), accepting any type; used for an untyped attr (e.g. a field's @default, whose value-type follows the owning field's subtype). Not authored directly: a `attr.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/attr.md#attrbase" + }, + { + "typeSubType": "attr.boolean", + "description": "A boolean-valued metadata attribute. Coerces to and validates as true/false.", + "page": "types/attr.md#attrboolean" + }, + { + "typeSubType": "attr.class", + "description": "A class-/type-reference-valued metadata attribute. String-backed (a fully-qualified class or type name) used by binding facets.", + "page": "types/attr.md#attrclass" + }, + { + "typeSubType": "attr.double", + "description": "A double-precision floating-point-valued metadata attribute. Coerces to and validates as a number.", + "page": "types/attr.md#attrdouble" + }, + { + "typeSubType": "attr.expression", + "description": "A structured expression tree (closed node grammar: field/value refs, comparisons sharing the filter op vocabulary, isNull/isNotNull, and/or/not, coalesce, case, now). Backs origin.computed; a filter object embeds canonically. A { field } ref names one of the projection's own fields (a passthrough, joined or not, an origin.first or another origin.computed — never an aggregate, never itself), else a field of the base entity (rc.19 computed-over-joined). { case: [ { when, then }, ... ], else? } is a searched CASE (each when boolean); with operand: it is a simple CASE (each when a value compared with operand by equality); every then/else shares one type. { now: \"\", startOf? } is the current instant shifted by the duration (rc.19 now), its kind (date, local or instant timestamp) taken from the field it is compared with. rc.21: a { field } ref may also name a scalar origin.aggregate of the projection (read on the grouped row; such a value is not filterable) or, on a projection, a PATH of to-one hops from the base and a field of the entity reached ('customerId.regionId'), joined but not output. { fn } takes a closed, typed set: coalesce, greatest, least, nullif (arguments of one type), lower, upper, btrim (string[, chars]), splitPart (string, delimiter, int), concat (scalars; NULL reads as empty), concatWs (separator, scalars), substring (string, start[, length]), replace (string, from, to), left and right (string, int), length (string to int). { cast: , as: , dbColumnType? } converts to string, int, long, double, float, decimal, boolean, date, timestamp or uuid, optionally with a text @dbColumnType spelling for a string; an enum casts to an integer only when stored as one (@intValueMap). A cross-field validator's @condition (a CHECK) takes only fields, literals, comparisons, null tests, and/or/not and coalesce. Arithmetic is #159.", + "page": "types/attr.md#attrexpression" + }, + { + "typeSubType": "attr.filter", + "description": "A filter-expression-valued metadata attribute. Object-shaped value that desugars a preset filter to the canonical { field: { op: value } } form (scalar→eq, array→in, null→isNull; or/and recurse).", + "page": "types/attr.md#attrfilter" + }, + { + "typeSubType": "attr.int", + "description": "A 32-bit-integer-valued metadata attribute. Coerces to and validates as a number.", + "page": "types/attr.md#attrint" + }, + { + "typeSubType": "attr.intMap", + "description": "An object-shaped attribute whose values are all integers (e.g. field.enum's @intValueMap: {memberSymbol: int}). Generic shape check only; a consumer field type layers its own semantic rules (key-set membership, uniqueness) in its own content-rule validation.", + "page": "types/attr.md#attrintmap" + }, + { + "typeSubType": "attr.long", + "description": "A 64-bit-integer-valued metadata attribute. Coerces to and validates as a number.", + "page": "types/attr.md#attrlong" + }, + { + "typeSubType": "attr.properties", + "description": "A key/value map attribute (a bag of arbitrary author-supplied properties). Object-shaped value; the registered escape hatch for author-supplied properties (exempt from the strict-attr check, ADR-0023).", + "page": "types/attr.md#attrproperties" + }, + { + "typeSubType": "attr.string", + "description": "A string-valued metadata attribute. Coerces to and validates as text; the default value-type for inline @-syntax attrs (array-of-string is the same subtype with isArray).", + "page": "types/attr.md#attrstring" + }, + { + "typeSubType": "binding.base", + "description": "Registry anchor for protocol bindings (ADR-0030, ADR-0054): not authorable.", + "page": "types/binding.md#bindingbase" + }, + { + "typeSubType": "binding.rest", + "description": "The HTTP method and path of an operation, declared only to override the derived ones. A query is `GET`, a command `POST`; the path is `//{id}/` for an operation with a target key and `//` without one. Most models never write it. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "page": "types/binding.md#bindingrest" + }, + { + "typeSubType": "dimension.attribute", + "description": "A named group-by attribute of the entity that declares it (FR-044). Groups report rows by a column value as-is. @of names Entity.field: the owning entity, or the @via terminal. @via may follow only to-one hops, so grouping by a related row's column can never multiply the measured rows.", + "page": "types/dimension.md#dimensionattribute" + }, + { + "typeSubType": "dimension.time", + "description": "A named time dimension (FR-044): groups report rows by a date or timestamp column truncated to a grain. @of names a field.date or field.timestamp. Weeks start on Monday (ISO-8601) in every lowering. A report names it as 'dimension:grain' and the derived report field is (e.g. purchasedAtDay).", + "page": "types/dimension.md#dimensiontime" + }, + { + "typeSubType": "field.base", + "description": "Abstract base field — the shared root subtype that concrete field subtypes specialize. Carries the attrs common to every field but binds no concrete data type of its own (falls back to string). Not authored directly: a `field.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/field.md#fieldbase" + }, + { + "typeSubType": "field.boolean", + "description": "True/false flag. Binds to the native boolean type; DB column is BOOLEAN.", + "page": "types/field.md#fieldboolean" + }, + { + "typeSubType": "field.currency", + "description": "Stores money as integer minor units (cents). Binds to long; the client formats via @currency/@locale. Float arithmetic for money is forbidden.", + "page": "types/field.md#fieldcurrency" + }, + { + "typeSubType": "field.date", + "description": "Calendar date (no time-of-day). Binds to the native date/temporal type; DB column is DATE.", + "page": "types/field.md#fielddate" + }, + { + "typeSubType": "field.decimal", + "description": "Precision-exact decimal (use @precision/@scale). Native TS binding is string (lossless); DB column is NUMERIC(p,s); the wire form is a string. Classified DATA_TYPE_STRING so an exact decimal is never silently rounded through a double.", + "page": "types/field.md#fielddecimal" + }, + { + "typeSubType": "field.double", + "description": "Double-precision (64-bit) IEEE-754 floating point. Binds to the native double/number type; DB column is DOUBLE PRECISION. Not for money — use field.currency or field.decimal.", + "page": "types/field.md#fielddouble" + }, + { + "typeSubType": "field.duration", + "description": "A fixed-length span of time: days, hours, minutes and seconds (ADR-0036/0037 — a concept with a native type + behavior). Binds to TS string (TS has no native duration type); other ports bind to their native type (C# System.TimeSpan, Java and Kotlin java.time.Duration, Python datetime.timedelta). DB column is the Postgres-native interval type; SQLite, D1 and MySQL store a 64-bit integer count of microseconds, which orders and compares as the span does. The wire form is an ISO-8601 duration: every port writes [-]PT[nH][nM][n[.f]S] (hours never folded into days, as many fractional digits as its native type holds, zero is PT0S) and reads that form plus leading week and day counts (nW, exactly 7 days; nD, exactly 24 hours) and a fraction of any length, truncated toward zero. Years and months are refused: a calendar span is not a fixed length. Justified in ADR-0023 Amendment 1.", + "page": "types/field.md#fieldduration" + }, + { + "typeSubType": "field.enum", + "description": "String-backed enumeration constrained to a closed set of member symbols (@values). Each member is its own stored string, unless @stringValueMap gives it another (or @intValueMap an integer).", + "page": "types/field.md#fieldenum" + }, + { + "typeSubType": "field.float", + "description": "Single-precision floating point. Binds to the native double/number type (TS has no distinct float); DB column is REAL. Not for money.", + "page": "types/field.md#fieldfloat" + }, + { + "typeSubType": "field.inet", + "description": "An IP-address string (IPv4 or IPv6) (ADR-0036/0037 — a concept with a native type + behavior, so a subtype not a @stringFormat). Binds to TS string (TS has no native IP type, same as field.uuid); other ports bind to their native IP type (Java java.net.InetAddress, C# System.Net.IPAddress, Python ipaddress, Kotlin java.net.InetAddress). DB column is the Postgres-native inet type. Codegen emits an IPv4-or-IPv6 literal validator (a Zod regex union in TS — z.string().ip() was removed in Zod 4 — native IP-type parsing in the other ports); add @lenient to bind a plain string with no validator. v1 ships WITHOUT @kind — the native type subsumes ipv4/ipv6; @kind is reserved for a later ipv4\\|ipv6 value-constraint.", + "page": "types/field.md#fieldinet" + }, + { + "typeSubType": "field.int", + "description": "32-bit signed integer. Binds to the native int type; DB column is INTEGER.", + "page": "types/field.md#fieldint" + }, + { + "typeSubType": "field.long", + "description": "64-bit signed integer. Binds to the native long/bigint type; DB column is BIGINT.", + "page": "types/field.md#fieldlong" + }, + { + "typeSubType": "field.map", + "description": "An open-keyed map (Record / dict[str,V]) stored in a single jsonb column. Keys are always strings (the JSON object constraint); the value type is set by @valueType (a scalar field subtype) or @objectRef (a value-object).", + "page": "types/field.md#fieldmap" + }, + { + "typeSubType": "field.object", + "description": "A nested structured value (set @objectRef to the target object). Storage is governed by @storage: flattened (prefixed columns), jsonb (single jsonb column, supports isArray), or subdocument (document-store hint).", + "page": "types/field.md#fieldobject" + }, + { + "typeSubType": "field.string", + "description": "Variable-length text. Binds to the native string type; DB column is VARCHAR/TEXT (use @maxLength for VARCHAR(n)).", + "page": "types/field.md#fieldstring" + }, + { + "typeSubType": "field.time", + "description": "Time-of-day (no calendar date). Binds to the native date/temporal type; DB column is TIME.", + "page": "types/field.md#fieldtime" + }, + { + "typeSubType": "field.timestamp", + "description": "Date + time-of-day instant (optionally with timezone). Binds to the native date/temporal type; DB column is TIMESTAMP(TZ). Pair with @autoSet for created/updated stamping.", + "page": "types/field.md#fieldtimestamp" + }, + { + "typeSubType": "field.uri", + "description": "A URI/URL string (ADR-0036/0037 — a concept with a native type + behavior, so a subtype not a @stringFormat). Binds to TS string (TS has no native URI type, same as field.uuid); other ports bind to their native URI type (Java java.net.URI, C# System.Uri, Python urllib.parse, Kotlin java.net.URI) and parse scheme/authority/path. DB column is text (Postgres has no uri type). Codegen emits a URL/URI validator (TS Zod z.string().url()). v1 ships WITHOUT @kind — the native type subsumes url/urn; @kind is reserved for a later url\\|urn value-constraint.", + "page": "types/field.md#fielduri" + }, + { + "typeSubType": "field.uuid", + "description": "Logical UUID identity scalar. A bare scalar (no required attrs, no loader value-validation) — binds to TS string (no native UUID type); DB column is Postgres-native uuid.", + "page": "types/field.md#fielduuid" + }, + { + "typeSubType": "identity.primary", + "description": "The primary key — one per entity; @fields names its column(s), @generation the value strategy.", + "page": "types/identity.md#identityprimary" + }, + { + "typeSubType": "identity.reference", + "description": "A foreign-key reference to another entity (@references target; @enforce toggles a physical FK).", + "page": "types/identity.md#identityreference" + }, + { + "typeSubType": "identity.secondary", + "description": "A secondary unique index on one or more fields. Always enforces uniqueness — use index.lookup for non-unique query-performance indexes.", + "page": "types/identity.md#identitysecondary" + }, + { + "typeSubType": "index.lookup", + "description": "A non-unique lookup index on one or more fields. Use for query-performance indexes that do NOT enforce uniqueness — declare identity.secondary for unique constraints instead.", + "page": "types/index.md#indexlookup" + }, + { + "typeSubType": "layout.base", + "description": "Abstract base layout — the shared root subtype for object-level UI surfaces. A layout attaches a presentation concern (grids, forms, tabs, cards) to an object. The base carries no attrs of its own; concrete subtypes add their presentation attrs. Not authored directly: a `layout.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/layout.md#layoutbase" + }, + { + "typeSubType": "layout.dataGrid", + "description": "A metadata-driven data grid attached to an object: declares the displayed columns, page size, default sort, and an optional preset filter the generated grid renders.", + "page": "types/layout.md#layoutdatagrid" + }, + { + "typeSubType": "measure.aggregate", + "description": "A named aggregate over the declaring entity's own rows (FR-044). @agg count without @distinct counts rows; with @distinct it counts distinct values of @of (a list in @of is a distinct count of the tuple). Unlike origin.aggregate, count is NOT distinct by default: a measure aggregates its own rows and dimensions reach only to-one paths, so no join inflates it.", + "page": "types/measure.md#measureaggregate" + }, + { + "typeSubType": "measure.derived", + "description": "A named arithmetic expression (FR-044 R13) over measures of the same entity and the report's numeric attribute dimensions, typed decimal. @expr is FR-037 R5's first arithmetic wave: add, subtract, multiply and divide, each of two operands. divide lowers as a ratio does, so a zero divisor yields null. A report listing a derived measure that reads a dimension must list that dimension.", + "page": "types/measure.md#measurederived" + }, + { + "typeSubType": "measure.ratio", + "description": "A named quotient of two numeric measure.aggregate siblings (FR-044), lowered as numerator / NULLIF(denominator, 0) and typed decimal. A zero denominator yields null.", + "page": "types/measure.md#measureratio" + }, + { + "typeSubType": "metadata.root", + "description": "Root metadata document", + "page": "types/metadata.md#metadataroot" + }, + { + "typeSubType": "object.base", + "description": "Abstract object base — the shared root subtype that concrete object subtypes (entity/value/projection) specialize. Declares the structural children common to EVERY object subtype (the intersection: field/identity/validator/layout/source); subtype-specific children (relationship, template) and attrs (discriminator) ride their own subtypes. Has no runtime semantics of its own; not authored directly. A `object.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED): this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/object.md#objectbase" + }, + { + "typeSubType": "object.entity", + "description": "An object that owns its data: own identity, writable sources, and lifecycle. The default object subtype — a bare `object:` key resolves to entity. May co-locate templates (template.prompt and friends) with the owning entity.", + "page": "types/object.md#objectentity" + }, + { + "typeSubType": "object.projection", + "description": "A derived read-only representation of entities. Its fields are extends-bound / origin-derived / self-declared-under-external-assembly, all read-only at the subtype level. Identity is optional and MUST extend an entity identity; sources are restricted to read-only @kinds. The declared field set IS the exposure (inclusive, fail-closed).", + "page": "types/object.md#objectprojection" + }, + { + "typeSubType": "object.report", + "description": "A declared report (FR-044): a fixed combination of dimensions and measures of ONE entity (@from), compiled to a read-only view. One row per distinct dimension tuple; no dimensions means exactly one row. Fields are DERIVED, not declared: one per dimension (a time dimension's field is , e.g. purchasedAtDay) and one per measure. Every measure must belong to @from (two fact tables are two reports). @filter and @segment scope rows before grouping and combine by AND. Read-only: no writes, no get-by-id.", + "page": "types/object.md#objectreport" + }, + { + "typeSubType": "object.value", + "description": "A value object — pure shape with NO identity and NO source, ever. Constructed (by caller / embedding), never populated from a store. May `extends` an entity's fields to reuse shape. Equality is by content.", + "page": "types/object.md#objectvalue" + }, + { + "typeSubType": "operation.base", + "description": "Registry anchor for the attributes every operation shares (ADR-0054): not authorable.", + "page": "types/operation.md#operationbase" + }, + { + "typeSubType": "operation.command", + "description": "A named operation that changes state. Takes an `object.value` (ADR-0030). Its body is hand-written. The contract (ADR-0066) is that a generated shell around it loads the row, checks the permission and the current state, runs the body, and makes the guarded update in one transaction. No shell is generated yet: this vocabulary is registered, loaded and checked, and nothing is generated from it. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "page": "types/operation.md#operationcommand" + }, + { + "typeSubType": "operation.query", + "description": "A named operation that reads. Returns an `object.projection` (or an entity or value). It changes nothing. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "page": "types/operation.md#operationquery" + }, + { + "typeSubType": "origin.aggregate", + "description": "A value reduced from the related row-set reached along a relationship path (@via) from the base entity: count/sum/avg/min/max over a column (@of); any/all predicate quantifiers over a @filter; or collect (an array rollup — of the @of column, or of the carrying field.object's declared @objectRef value object when @of is omitted).", + "page": "types/origin.md#originaggregate" + }, + { + "typeSubType": "origin.base", + "description": "Abstract base origin — the shared root subtype for field-level provenance. A field carrying any origin.* is derived ⇒ read-only wherever it lives. The base carries no attrs of its own; concrete subtypes add their provenance attrs. Not authored directly: a `origin.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/origin.md#originbase" + }, + { + "typeSubType": "origin.computed", + "description": "A row-level value computed from the base entity's own fields via a structured expression tree (@expr). No related rows, no @via. Read-only; the expression's inferred type must equal the field's declared subType.", + "page": "types/origin.md#origincomputed" + }, + { + "typeSubType": "origin.first", + "description": "The single related row selected by @orderBy along @via, projecting its @of column (argmax then project). Latest = @orderBy desc. Read-only; empty related set (after @filter) → null, so the field must not be @required.", + "page": "types/origin.md#originfirst" + }, + { + "typeSubType": "origin.function", + "description": "A value computed by a database function the project owns (rc.21): @function names it, @schema its schema (absent: public), and @args the fields passed to it, in order. On an entity an argument is one of its fields; on a projection, one of its own fields (not an aggregate) or a field of its base entity. @params declares each argument's type and @returns the result's: an argument must have its parameter's type (cast it through an origin.computed field otherwise), @returns must be the carrying field's subtype, and the view casts the call to the field's full column type (the one its table column would have: length or @dbColumnType spelling, precision and scale, a local or zoned timestamp), so the call is checked, never free SQL. The signature is a declaration: meta verify --db reads the function from pg_proc and fails on a parameter or return type that differs. MetaObjects never creates the function: it is owned SQL, created before the view. Declared on an entity, it is entity-derived: a projection reaching the entity reads it like any derived field. Postgres only; the SQLite view emitter refuses it.", + "page": "types/origin.md#originfunction" + }, + { + "typeSubType": "origin.passthrough", + "description": "A cross-entity field reference: this projection field passes a source entity's value straight through (@from), optionally reached via a relationship path (@via).", + "page": "types/origin.md#originpassthrough" + }, + { + "typeSubType": "relationship.aggregation", + "description": "A shared/independent containment — the parent groups the target but does not own its lifecycle (default @onDelete set-null).", + "page": "types/relationship.md#relationshipaggregation" + }, + { + "typeSubType": "relationship.association", + "description": "A plain reference to another entity — no ownership; the target has an independent lifecycle (default @onDelete restrict).", + "page": "types/relationship.md#relationshipassociation" + }, + { + "typeSubType": "relationship.base", + "description": "Abstract relationship base — shared shape for the concrete association/aggregation/composition subtypes; not authored directly. A `relationship.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED): this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/relationship.md#relationshipbase" + }, + { + "typeSubType": "relationship.composition", + "description": "An owned containment — the parent owns the target's lifecycle; deleting the parent deletes the children (default @onDelete cascade).", + "page": "types/relationship.md#relationshipcomposition" + }, + { + "typeSubType": "requirement.architectural", + "description": "How the system is built, applied uniformly across the model. Its check is UNIVERSALITY, the opposite polarity to a functional requirement. What `meta verify` enforces is that a live or partial policy is applied at all — one claiming nothing is an error — not that each node it claims complies. Flat by default and object-independent; it may optionally sit in a levelled tree when a quality taxonomy is being used to organise non-functional requirements.", + "page": "types/requirement.md#requirementarchitectural" + }, + { + "typeSubType": "requirement.functional", + "description": "What the product does for a user, stated as one violable claim. Its check is EXISTENCE, run by `meta verify`: a live or partial claim with no implementing node anywhere in its subtree is a warning, and a named node that no longer exists is an error. Hierarchy is nesting — an L1 solution contains its L2 segments, which contain L3 services, and so on down to the levels that reference the model.", + "page": "types/requirement.md#requirementfunctional" + }, + { + "typeSubType": "segment.filter", + "description": "A named, reusable row filter on the declaring entity (FR-044). Measures and reports reference it by name; exporters emit it as a named segment.", + "page": "types/segment.md#segmentfilter" + }, + { + "typeSubType": "source.base", + "description": "Abstract base source — the shared root subtype for declaring where an object's data lives (Project E). The base carries no attrs of its own; the concrete paradigm subtype (rdb) carries the physical-storage attrs, which are contributed by the db domain provider. Not authored directly: a `source.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/source.md#sourcebase" + }, + { + "typeSubType": "source.rdb", + "description": "The relational-database paradigm source (ADR-0007): binds an object to a physical relational object. Its physical name is the @table attr (not the structural `name`), and read-only-ness is DERIVED from @kind — table is writable; view, materializedView, storedProc, and tableFunction are read-only. The @table/@kind/@role/@schema/@parameterRef attrs are contributed by the db domain provider, not by core-types.", + "page": "types/source.md#sourcerdb" + }, + { + "typeSubType": "template.base", + "description": "Abstract base template — the shared root subtype for the fourth pillar (FR-004, ADR-0011). A template is a typed payload bound to either a rendered text artifact (prompt/output) or a tool-call envelope. The base carries no attrs of its own; concrete subtypes add their reference + governance attrs. Not authored directly: a `template.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/template.md#templatebase" + }, + { + "typeSubType": "template.output", + "description": "An output / serialization template (FR-004): every rendered artifact other than an LLM prompt — a document (email, export, docs, config) or an email. Carries the generic reference + governance attrs and the @kind + email part-refs. OUTBOUND ONLY (ADR-0052) — it renders, and generates no parser.", + "page": "types/template.md#templateoutput" + }, + { + "typeSubType": "template.prompt", + "description": "An LLM-targeted renderable prompt template (FR-004). Carries the generic reference + governance attrs plus the LLM overlay (@maxTokens / @requiredSlots / @model / @responseRef). Its renderable body is required via @textRef. A prompt declaring @responseRef also owns the INBOUND half (ADR-0052): the parser-on-receipt, the FR-010 response-format fragment (@promptStyle), and the reply syntax (@responseFormat).", + "page": "types/template.md#templateprompt" + }, + { + "typeSubType": "template.toolcall", + "description": "A vendor-agnostic LLM tool-call envelope (ADR-0011). Unlike prompt/output it has NO renderable text body — the body IS the structured output schema resolved via @payloadRef. This is why toolcall is its own subtype rather than template.output + @toolName. Does NOT inherit the generic attrs.", + "page": "types/template.md#templatetoolcall" + }, + { + "typeSubType": "transition.action", + "description": "An allowed move between two values of a `field.enum`, made by an operation (ADR-0066). A `field.enum` with at least one is a lifecycle, named after the field. Its states are the enum's @values, its initial state the enum's @default, its terminal states the members no transition leaves; none of them has vocabulary of its own. Each transition is held to become a guarded update (`... WHERE id = ? AND IN (@from) [AND @condition]`), its own command when no declared operation claims it, its own permission point and its own wire error. No shell is generated yet: nothing is generated from this vocabulary, and the loader and `verify` only check it. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "page": "types/transition.md#transitionaction" + }, + { + "typeSubType": "transition.base", + "description": "Registry anchor for the attributes every lifecycle move shares (ADR-0054): not authorable.", + "page": "types/transition.md#transitionbase" + }, + { + "typeSubType": "validator.array", + "description": "Bounds the element count of an array-valued field via @min/@max.", + "page": "types/validator.md#validatorarray" + }, + { + "typeSubType": "validator.atLeastOne", + "description": "Cardinality of presence: at least one of the named fields (@fields) must be present (NOT NULL). Entity-scoped; references fields by name (same @fields-by-name pattern as identity.*).", + "page": "types/validator.md#validatoratleastone" + }, + { + "typeSubType": "validator.base", + "description": "Abstract base validator — the shared root subtype concrete validators specialize. Carries the @min/@max bounds attrs but enforces no rule of its own. Not authored directly: a `validator.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/validator.md#validatorbase" + }, + { + "typeSubType": "validator.comparison", + "description": "Cross-field ordering: requires two sibling fields of the owning entity stand in a relational order (@left @op @right), e.g. current_hp <= max_hp or expires_at > created_at. Entity-scoped; references fields by name. Backends derive the rule (CHECK constraint, cross-field assertion) — no raw expression is stored.", + "page": "types/validator.md#validatorcomparison" + }, + { + "typeSubType": "validator.exactlyOne", + "description": "Cardinality of presence: exactly one of the named fields (@fields) is present (NOT NULL), and the others are null. Entity-scoped; references fields by name (same @fields-by-name pattern as identity.*). Justified in ADR-0023 Amendment 1.", + "page": "types/validator.md#validatorexactlyone" + }, + { + "typeSubType": "validator.length", + "description": "Bounds string length / collection size via @min/@max.", + "page": "types/validator.md#validatorlength" + }, + { + "typeSubType": "validator.numeric", + "description": "Bounds a numeric value's magnitude via @min/@max.", + "page": "types/validator.md#validatornumeric" + }, + { + "typeSubType": "validator.presentIff", + "description": "Biconditional presence: the target field (@field) is present (NOT NULL) if and only if the gating field (@when) equals @equals. Models paired flag/companion-column invariants, e.g. used_at present iff is_used=true. Entity-scoped; references fields by name.", + "page": "types/validator.md#validatorpresentiff" + }, + { + "typeSubType": "validator.regex", + "description": "Requires the value match a regular expression (@pattern).", + "page": "types/validator.md#validatorregex" + }, + { + "typeSubType": "validator.required", + "description": "Fails when the value is null (NOT NULL). Equivalent to @required on the owning field: on a non-array string, generated wire-tier input validation also rejects the empty string by default unless an explicit validator.length @min: 0 opts back to presence-only.", + "page": "types/validator.md#validatorrequired" + }, + { + "typeSubType": "validator.requiredWhen", + "description": "One-directional conditional presence: when the gating field (@when) equals @equals, the target field (@field) must be present (NOT NULL); otherwise @field is unconstrained. Mirrors JSON Schema dependentRequired / Rails validates_presence_of :x, if:. Entity-scoped; references fields by name.", + "page": "types/validator.md#validatorrequiredwhen" + }, + { + "typeSubType": "view.base", + "description": "Abstract view base — the shared root subtype for field-level UI/render hints. A view declares how a field's value is rendered or edited; the base carries no attrs of its own. Not authored directly: a `view.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "page": "types/view.md#viewbase" + }, + { + "typeSubType": "view.checkbox", + "description": "Checkbox selection control.", + "page": "types/view.md#viewcheckbox" + }, + { + "typeSubType": "view.currency", + "description": "Currency display formatting (locale-aware via @locale).", + "page": "types/view.md#viewcurrency" + }, + { + "typeSubType": "view.date", + "description": "Date picker / date display.", + "page": "types/view.md#viewdate" + }, + { + "typeSubType": "view.dropdown", + "description": "Single-select dropdown control.", + "page": "types/view.md#viewdropdown" + }, + { + "typeSubType": "view.hidden", + "description": "Not rendered; carried but not shown.", + "page": "types/view.md#viewhidden" + }, + { + "typeSubType": "view.hotlink", + "description": "Renders the value as a clickable link.", + "page": "types/view.md#viewhotlink" + }, + { + "typeSubType": "view.image", + "description": "Image upload/display control; the field stores an opaque storage key (field.string).", + "page": "types/view.md#viewimage" + }, + { + "typeSubType": "view.month", + "description": "Month picker / month display.", + "page": "types/view.md#viewmonth" + }, + { + "typeSubType": "view.number", + "description": "Numeric input control.", + "page": "types/view.md#viewnumber" + }, + { + "typeSubType": "view.password", + "description": "Masked input for sensitive values.", + "page": "types/view.md#viewpassword" + }, + { + "typeSubType": "view.radio", + "description": "Radio-button selection control.", + "page": "types/view.md#viewradio" + }, + { + "typeSubType": "view.text", + "description": "Single-line text input/display.", + "page": "types/view.md#viewtext" + }, + { + "typeSubType": "view.textarea", + "description": "Multi-line text area.", + "page": "types/view.md#viewtextarea" + }, + { + "typeSubType": "view.web", + "description": "Abstract base for web-rendered views.", + "page": "types/view.md#viewweb" + } + ] +} diff --git a/fixtures/metamodel-docs/data/providers.md.json b/fixtures/metamodel-docs/data/providers.md.json new file mode 100644 index 0000000000..dc66a89c92 --- /dev/null +++ b/fixtures/metamodel-docs/data/providers.md.json @@ -0,0 +1,633 @@ +{ + "providers": [ + { + "id": "metaobjects-core-types", + "hasDescription": true, + "description": "Core metaobjects metamodel types and subtypes.", + "hasOwns": true, + "owns": "`attr.base`, `attr.boolean`, `attr.class`, `attr.double`, `attr.expression`, `attr.filter`, `attr.int`, `attr.intMap`, `attr.long`, `attr.properties`, `attr.string`, `field.base`, `field.boolean`, `field.currency`, `field.date`, `field.decimal`, `field.double`, `field.duration`, `field.enum`, `field.float`, `field.inet`, `field.int`, `field.long`, `field.map`, `field.object`, `field.string`, `field.time`, `field.timestamp`, `field.uri`, `field.uuid`, `identity.primary`, `identity.reference`, `identity.secondary`, `index.lookup`, `layout.base`, `layout.dataGrid`, `object.base`, `object.entity`, `object.projection`, `object.value`, `origin.aggregate`, `origin.base`, `origin.computed`, `origin.first`, `origin.passthrough`, `relationship.aggregation`, `relationship.association`, `relationship.base`, `relationship.composition`, `source.base`, `source.rdb`, `template.base`, `template.output`, `template.prompt`, `template.toolcall`, `validator.array`, `validator.atLeastOne`, `validator.base`, `validator.comparison`, `validator.exactlyOne`, `validator.length`, `validator.numeric`, `validator.presentIff`, `validator.regex`, `validator.required`, `validator.requiredWhen`, `view.base`, `view.checkbox`, `view.currency`, `view.date`, `view.dropdown`, `view.hidden`, `view.hotlink`, `view.image`, `view.month`, `view.number`, `view.password`, `view.radio`, `view.text`, `view.textarea`, `view.web`", + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "field.base", + "attrs": "`@default`, `@mutability`, `@required`, `@unique`" + }, + { + "typeSubType": "field.currency", + "attrs": "`@currency`" + }, + { + "typeSubType": "field.decimal", + "attrs": "`@precision`, `@scale`" + }, + { + "typeSubType": "field.enum", + "attrs": "`@intValueMap`, `@maxLength`, `@provided`, `@stringValueMap`, `@values`" + }, + { + "typeSubType": "field.inet", + "attrs": "`@lenient`" + }, + { + "typeSubType": "field.map", + "attrs": "`@objectRef`, `@valueType`" + }, + { + "typeSubType": "field.object", + "attrs": "`@objectRef`" + }, + { + "typeSubType": "field.string", + "attrs": "`@maxLength`, `@stringFormat`" + }, + { + "typeSubType": "field.uri", + "attrs": "`@lenient`" + }, + { + "typeSubType": "identity.primary", + "attrs": "`@fields`, `@generation`" + }, + { + "typeSubType": "identity.reference", + "attrs": "`@enforce`, `@fields`, `@references`" + }, + { + "typeSubType": "identity.secondary", + "attrs": "`@fields`" + }, + { + "typeSubType": "index.lookup", + "attrs": "`@fields`" + }, + { + "typeSubType": "object.base", + "attrs": "`@object`, `@objectAdapter`" + }, + { + "typeSubType": "object.entity", + "attrs": "`@collectionName`, `@discriminator`, `@discriminatorValue`" + }, + { + "typeSubType": "object.projection", + "attrs": "`@collectionName`, `@filter`" + }, + { + "typeSubType": "origin.aggregate", + "attrs": "`@agg`, `@distinct`, `@filter`, `@of`, `@orderBy`, `@via`" + }, + { + "typeSubType": "origin.computed", + "attrs": "`@expr`" + }, + { + "typeSubType": "origin.first", + "attrs": "`@filter`, `@of`, `@orderBy`, `@via`" + }, + { + "typeSubType": "origin.passthrough", + "attrs": "`@convert`, `@from`, `@via`" + }, + { + "typeSubType": "relationship.aggregation", + "attrs": "`@cardinality`, `@objectRef`, `@onDelete`, `@onUpdate`, `@sourceRefField`, `@symmetric`, `@through`" + }, + { + "typeSubType": "relationship.association", + "attrs": "`@cardinality`, `@objectRef`, `@onDelete`, `@onUpdate`, `@sourceRefField`, `@symmetric`, `@through`" + }, + { + "typeSubType": "relationship.base", + "attrs": "`@cardinality`, `@objectRef`, `@onDelete`, `@onUpdate`, `@sourceRefField`, `@symmetric`, `@through`" + }, + { + "typeSubType": "relationship.composition", + "attrs": "`@cardinality`, `@objectRef`, `@onDelete`, `@onUpdate`, `@sourceRefField`, `@symmetric`, `@through`" + }, + { + "typeSubType": "template.output", + "attrs": "`@format`, `@htmlBodyRef`, `@kind`, `@maxChars`, `@owner`, `@payloadRef`, `@requiredTags`, `@since`, `@subjectRef`, `@textBodyRef`, `@textRef`" + }, + { + "typeSubType": "template.prompt", + "attrs": "`@format`, `@maxChars`, `@maxTokens`, `@model`, `@owner`, `@payloadRef`, `@promptStyle`, `@requiredSlots`, `@requiredTags`, `@responseFormat`, `@responseRef`, `@since`, `@textRef`" + }, + { + "typeSubType": "template.toolcall", + "attrs": "`@maxTokens`, `@owner`, `@payloadRef`, `@since`, `@toolName`" + }, + { + "typeSubType": "validator.array", + "attrs": "`@max`, `@min`" + }, + { + "typeSubType": "validator.atLeastOne", + "attrs": "`@condition`, `@fields`" + }, + { + "typeSubType": "validator.base", + "attrs": "`@max`, `@min`" + }, + { + "typeSubType": "validator.comparison", + "attrs": "`@condition`, `@left`, `@op`, `@right`" + }, + { + "typeSubType": "validator.exactlyOne", + "attrs": "`@condition`, `@fields`" + }, + { + "typeSubType": "validator.length", + "attrs": "`@max`, `@min`" + }, + { + "typeSubType": "validator.numeric", + "attrs": "`@max`, `@min`" + }, + { + "typeSubType": "validator.presentIff", + "attrs": "`@condition`, `@equals`, `@field`, `@when`" + }, + { + "typeSubType": "validator.regex", + "attrs": "`@max`, `@min`, `@pattern`" + }, + { + "typeSubType": "validator.requiredWhen", + "attrs": "`@condition`, `@equals`, `@field`, `@when`" + } + ] + }, + { + "id": "metaobjects-db", + "hasDescription": true, + "description": "DB-domain attributes — @column / @db.indexed / @dbColumnType on every field, @storage on field.object, @autoSet on temporal fields, @table/@kind/@role/@schema on source.rdb.", + "hasOwns": false, + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "field.base", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.boolean", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.currency", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.date", + "attrs": "`@autoSet`, `@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.decimal", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.double", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.duration", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.enum", + "attrs": "`@column`, `@constraintName`, `@db.indexed`, `@dbCheck`, `@dbColumnType`" + }, + { + "typeSubType": "field.float", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.inet", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.int", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.long", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.map", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.object", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`, `@flattenedColumnPrefix`, `@storage`" + }, + { + "typeSubType": "field.string", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.time", + "attrs": "`@autoSet`, `@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.timestamp", + "attrs": "`@autoSet`, `@column`, `@db.indexed`, `@dbColumnType`, `@localTime`" + }, + { + "typeSubType": "field.uri", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "field.uuid", + "attrs": "`@column`, `@db.indexed`, `@dbColumnType`" + }, + { + "typeSubType": "identity.primary", + "attrs": "`@sequenceName`, `@sequenceStart`" + }, + { + "typeSubType": "identity.reference", + "attrs": "`@constraintName`, `@onDelete`, `@onUpdate`" + }, + { + "typeSubType": "identity.secondary", + "attrs": "`@expr`, `@orders`, `@using`, `@where`" + }, + { + "typeSubType": "index.lookup", + "attrs": "`@expr`, `@orders`, `@using`, `@where`" + }, + { + "typeSubType": "source.rdb", + "attrs": "`@function`, `@kind`, `@materializedView`, `@parameterRef`, `@proc`, `@role`, `@schema`, `@sql`, `@table`, `@unmanaged`, `@view`" + }, + { + "typeSubType": "validator.atLeastOne", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.comparison", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.exactlyOne", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.length", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.numeric", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.presentIff", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.regex", + "attrs": "`@constraintName`, `@dbCheck`" + }, + { + "typeSubType": "validator.requiredWhen", + "attrs": "`@constraintName`, `@dbCheck`" + } + ] + }, + { + "id": "metaobjects-documentation", + "hasDescription": true, + "description": "Universal documentation common attrs (description / title / notes / deprecated / replacedBy / seeAlso / aliases) accepted on every metatype.", + "hasOwns": false, + "hasUniversal": true, + "universal": "`@aliases`, `@deprecated`, `@description`, `@notes`, `@replacedBy`, `@seeAlso`, `@summary`, `@title`", + "hasContributes": false, + "contributes": [] + }, + { + "id": "metaobjects-prompt", + "hasDescription": true, + "description": "Prompt / AI + serialization domain — @xmlText / @example / @instruction field markers on every field subtype, the @enumAlias/@enumDoc/@coerceDefault/@normalize tolerant-extract overlays on field.enum, and the object-level @normalize default on object.value.", + "hasOwns": false, + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "field.base", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.boolean", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.currency", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.date", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.decimal", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.double", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.duration", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.enum", + "attrs": "`@coerceDefault`, `@enumAlias`, `@enumDoc`, `@example`, `@instruction`, `@normalize`, `@xmlText`" + }, + { + "typeSubType": "field.float", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.inet", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.int", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.long", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.map", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.object", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.string", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.time", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.timestamp", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.uri", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "field.uuid", + "attrs": "`@example`, `@instruction`, `@xmlText`" + }, + { + "typeSubType": "object.value", + "attrs": "`@normalize`" + } + ] + }, + { + "id": "metaobjects-reporting", + "hasDescription": true, + "description": "Reporting (FR-044): object.report, dimension / measure / segment on an entity, and @segment on origin.aggregate and origin.first.", + "hasOwns": true, + "owns": "`dimension.attribute`, `dimension.time`, `measure.aggregate`, `measure.derived`, `measure.ratio`, `object.report`, `segment.filter`", + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "dimension.attribute", + "attrs": "`@of`, `@via`" + }, + { + "typeSubType": "dimension.time", + "attrs": "`@grains`, `@of`, `@via`" + }, + { + "typeSubType": "measure.aggregate", + "attrs": "`@agg`, `@default`, `@distinct`, `@filter`, `@of`, `@segment`" + }, + { + "typeSubType": "measure.derived", + "attrs": "`@expr`" + }, + { + "typeSubType": "measure.ratio", + "attrs": "`@default`, `@denominator`, `@numerator`" + }, + { + "typeSubType": "object.report", + "attrs": "`@collectionName`, `@dimensions`, `@filter`, `@from`, `@measures`, `@segment`, `@spine`" + }, + { + "typeSubType": "origin.aggregate", + "attrs": "`@segment`" + }, + { + "typeSubType": "origin.first", + "attrs": "`@segment`" + }, + { + "typeSubType": "segment.filter", + "attrs": "`@filter`" + } + ] + }, + { + "id": "metaobjects-requirements", + "hasDescription": true, + "description": "Requirements: requirement.functional and requirement.architectural, declared at the document root and checked by meta verify.", + "hasOwns": true, + "owns": "`requirement.architectural`, `requirement.functional`", + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "requirement.architectural", + "attrs": "`@counterexample`, `@disposition`, `@implementedBy`, `@level`, `@statement`, `@status`, `@supersededBy`, `@trackedBy`" + }, + { + "typeSubType": "requirement.functional", + "attrs": "`@counterexample`, `@disposition`, `@implementedBy`, `@level`, `@statement`, `@status`, `@supersededBy`, `@trackedBy`" + } + ] + }, + { + "id": "metaobjects-rules", + "hasDescription": true, + "description": "Business rules (ADR-0066, experimental): the declared API surface (api / operation / binding) and lifecycle moves (transition on a field.enum).", + "hasOwns": true, + "owns": "`api.base`, `api.operational`, `binding.base`, `binding.rest`, `operation.base`, `operation.command`, `operation.query`, `transition.action`, `transition.base`", + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "binding.rest", + "attrs": "`@method`, `@path`" + }, + { + "typeSubType": "operation.base", + "attrs": "`@inputRef`, `@objectRef`, `@outputRef`, `@permission`, `@public`" + }, + { + "typeSubType": "operation.command", + "attrs": "`@errors`, `@transitions`" + }, + { + "typeSubType": "operation.query", + "attrs": "`@many`" + }, + { + "typeSubType": "transition.action", + "attrs": "`@condition`, `@from`, `@to`" + }, + { + "typeSubType": "transition.base", + "attrs": "`@permission`, `@public`" + } + ] + }, + { + "id": "metaobjects-ui", + "hasDescription": true, + "description": "UI/query-surface domain — @filterable / @sortable / @sortableDefaultOrder field markers driving generated CRUD filter + sort allowlists (Project D).", + "hasOwns": false, + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "field.base", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.boolean", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.currency", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.date", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.decimal", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.double", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.duration", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.enum", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.float", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.inet", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.int", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.long", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.map", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.object", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.string", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.time", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.timestamp", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.uri", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "field.uuid", + "attrs": "`@filterable`, `@formExclude`, `@sortable`, `@sortableDefaultOrder`" + }, + { + "typeSubType": "layout.dataGrid", + "attrs": "`@columns`, `@defaultSortField`, `@defaultSortOrder`, `@filter`, `@filterable`, `@pageSize`" + }, + { + "typeSubType": "view.currency", + "attrs": "`@locale`" + } + ] + }, + { + "id": "metaobjects-ui-web", + "hasDescription": true, + "description": "Web presentation view attrs — @rows (view.textarea) and the view.image control attrs. Every port applies this provider and loads them strictly; only TypeScript acts on them so far.", + "hasOwns": false, + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "view.image", + "attrs": "`@accept`, `@aspectRatio`, `@maxBytes`, `@maxEdge`, `@store`" + }, + { + "typeSubType": "view.textarea", + "attrs": "`@rows`" + } + ] + }, + { + "id": "metaobjects-view-expressions", + "hasDescription": true, + "description": "View expressions (rc.21): origin.function plus the projection @union / @unionAll / @grain / @grainOrdinal attributes.", + "hasOwns": true, + "owns": "`origin.function`", + "hasUniversal": false, + "hasContributes": true, + "contributes": [ + { + "typeSubType": "object.projection", + "attrs": "`@grain`, `@grainOrdinal`, `@union`, `@unionAll`" + }, + { + "typeSubType": "origin.function", + "attrs": "`@args`, `@function`, `@params`, `@returns`, `@schema`" + } + ] + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/api.md.json b/fixtures/metamodel-docs/data/types/api.md.json new file mode 100644 index 0000000000..dd610e18c3 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/api.md.json @@ -0,0 +1,39 @@ +{ + "family": "api", + "sections": [ + { + "typeSubType": "api.base", + "description": "Registry anchor for the declared API surface (ADR-0030, ADR-0054): not authorable. The `api` subtype axis is the interaction model, never the protocol; protocol lives in `binding.*` on each operation.", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "api.operational", + "description": "A named, packaged request/response surface whose children are operations (ADR-0030). It is a wire contract: two of them (`v1`, `v2`) may declare the same operation side by side. The code behind it is one service per metadata package, whose surface is the package's operations (ADR-0067). Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": true, + "rules": "Children are `operation.command` and `operation.query`. Lives at the document root. Declares no fields, sources or identities: shapes are referenced, never defined, by the surface. Operation names are compared without case, are unique across every API of one package, except one operation declared identically in two APIs, such as a versioned API beside its successor (one operation declared twice in one API merges), and may not be create, get, list, update or delete in any case (ERR_TRANSITION_NAME_COLLISION). Two declared bindings of one API may not share a method and path (ERR_BINDING_PATH_MISMATCH).", + "hasWhenToUse": true, + "whenToUse": "The application does something beyond derived CRUD: a named command (approve, cancel, import) or a named query (my open requests). Declare it here so its input, output, permission and business errors are part of the model. A plain lifecycle needs no api.operational at all: a transition nobody claims is held to derive its own command once a shell is generated, and no shell is generated yet.", + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": true, + "children": [ + "`operation.*` — 0..*" + ], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/attr.md.json b/fixtures/metamodel-docs/data/types/attr.md.json new file mode 100644 index 0000000000..f6d030f58e --- /dev/null +++ b/fixtures/metamodel-docs/data/types/attr.md.json @@ -0,0 +1,170 @@ +{ + "family": "attr", + "sections": [ + { + "typeSubType": "attr.base", + "description": "Abstract base attribute — the polymorphic/unconstrained value-type marker. Stores its value type-preserved (never stringified), accepting any type; used for an untyped attr (e.g. a field's @default, whose value-type follows the owning field's subtype). Not authored directly: a `attr.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.boolean", + "description": "A boolean-valued metadata attribute. Coerces to and validates as true/false.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.class", + "description": "A class-/type-reference-valued metadata attribute. String-backed (a fully-qualified class or type name) used by binding facets.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.double", + "description": "A double-precision floating-point-valued metadata attribute. Coerces to and validates as a number.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.expression", + "description": "A structured expression tree (closed node grammar: field/value refs, comparisons sharing the filter op vocabulary, isNull/isNotNull, and/or/not, coalesce, case, now). Backs origin.computed; a filter object embeds canonically. A { field } ref names one of the projection's own fields (a passthrough, joined or not, an origin.first or another origin.computed — never an aggregate, never itself), else a field of the base entity (rc.19 computed-over-joined). { case: [ { when, then }, ... ], else? } is a searched CASE (each when boolean); with operand: it is a simple CASE (each when a value compared with operand by equality); every then/else shares one type. { now: \"\", startOf? } is the current instant shifted by the duration (rc.19 now), its kind (date, local or instant timestamp) taken from the field it is compared with. rc.21: a { field } ref may also name a scalar origin.aggregate of the projection (read on the grouped row; such a value is not filterable) or, on a projection, a PATH of to-one hops from the base and a field of the entity reached ('customerId.regionId'), joined but not output. { fn } takes a closed, typed set: coalesce, greatest, least, nullif (arguments of one type), lower, upper, btrim (string[, chars]), splitPart (string, delimiter, int), concat (scalars; NULL reads as empty), concatWs (separator, scalars), substring (string, start[, length]), replace (string, from, to), left and right (string, int), length (string to int). { cast: , as: , dbColumnType? } converts to string, int, long, double, float, decimal, boolean, date, timestamp or uuid, optionally with a text @dbColumnType spelling for a string; an enum casts to an integer only when stored as one (@intValueMap). A cross-field validator's @condition (a CHECK) takes only fields, literals, comparisons, null tests, and/or/not and coalesce. Arithmetic is #159.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.filter", + "description": "A filter-expression-valued metadata attribute. Object-shaped value that desugars a preset filter to the canonical { field: { op: value } } form (scalar→eq, array→in, null→isNull; or/and recurse).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.int", + "description": "A 32-bit-integer-valued metadata attribute. Coerces to and validates as a number.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.intMap", + "description": "An object-shaped attribute whose values are all integers (e.g. field.enum's @intValueMap: {memberSymbol: int}). Generic shape check only; a consumer field type layers its own semantic rules (key-set membership, uniqueness) in its own content-rule validation.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.long", + "description": "A 64-bit-integer-valued metadata attribute. Coerces to and validates as a number.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.properties", + "description": "A key/value map attribute (a bag of arbitrary author-supplied properties). Object-shaped value; the registered escape hatch for author-supplied properties (exempt from the strict-attr check, ADR-0023).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "attr.string", + "description": "A string-valued metadata attribute. Coerces to and validates as text; the default value-type for inline @-syntax attrs (array-of-string is the same subtype with isArray).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/binding.md.json b/fixtures/metamodel-docs/data/types/binding.md.json new file mode 100644 index 0000000000..7d62409c4e --- /dev/null +++ b/fixtures/metamodel-docs/data/types/binding.md.json @@ -0,0 +1,55 @@ +{ + "family": "binding", + "sections": [ + { + "typeSubType": "binding.base", + "description": "Registry anchor for protocol bindings (ADR-0030, ADR-0054): not authorable.", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "binding.rest", + "description": "The HTTP method and path of an operation, declared only to override the derived ones. A query is `GET`, a command `POST`; the path is `//{id}/` for an operation with a target key and `//` without one. Most models never write it. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "An operation must keep a method or path the derived one would not give it, such as an existing public URL.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "method", + "type": "string", + "required": "no", + "default": "", + "allowed": "`GET`, `POST`, `PUT`, `PATCH`, `DELETE`", + "provider": "metaobjects-rules", + "description": "The HTTP method. Absent: GET for a query, POST for a command." + }, + { + "name": "path", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "A path template. Its `{name}` placeholders must be exactly the target's primary key fields when the operation is keyed, and there must be none when it is not; two declared bindings of one API may not share the method and path (ERR_BINDING_PATH_MISMATCH)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/dimension.md.json b/fixtures/metamodel-docs/data/types/dimension.md.json new file mode 100644 index 0000000000..8fefe1d073 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/dimension.md.json @@ -0,0 +1,84 @@ +{ + "family": "dimension", + "sections": [ + { + "typeSubType": "dimension.attribute", + "description": "A named group-by attribute of the entity that declares it (FR-044). Groups report rows by a column value as-is. @of names Entity.field: the owning entity, or the @via terminal. @via may follow only to-one hops, so grouping by a related row's column can never multiply the measured rows.", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A column a dashboard groups by: product, status, region. Declare it once on the fact entity and reference it by name from reports.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "of", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Dotted Entity.field reference naming the grouped column (e.g. 'Purchase.programId', or 'Program.title' with @via). Entity.field.member names a member of a value object stored with @storage: flattened (e.g. 'Payment.amount.currency'), which has a column of its own." + }, + { + "name": "via", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional dotted to-one relationship path from the owning entity to the entity @of names (e.g. 'Purchase.program'). Every hop must be @cardinality: one or an identity.reference." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "dimension.time", + "description": "A named time dimension (FR-044): groups report rows by a date or timestamp column truncated to a grain. @of names a field.date or field.timestamp. Weeks start on Monday (ISO-8601) in every lowering. A report names it as 'dimension:grain' and the derived report field is (e.g. purchasedAtDay).", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Per-day, per-week or per-month series on a dashboard.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "grains", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "`hour`, `day`, `week`, `month`, `quarter`, `year`", + "provider": "metaobjects-reporting", + "description": "The grains this dimension supports. Weeks start Monday (ISO-8601). 'hour' is refused on a field.date." + }, + { + "name": "of", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Dotted Entity.field reference naming the date or timestamp column, or Entity.field.member for a member of a flattened value object." + }, + { + "name": "via", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional dotted to-one relationship path, as on dimension.attribute." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/field.md.json b/fixtures/metamodel-docs/data/types/field.md.json new file mode 100644 index 0000000000..7d14f9854a --- /dev/null +++ b/fixtures/metamodel-docs/data/types/field.md.json @@ -0,0 +1,3044 @@ +{ + "family": "field", + "sections": [ + { + "typeSubType": "field.base", + "description": "Abstract base field — the shared root subtype that concrete field subtypes specialize. Carries the attrs common to every field but binds no concrete data type of its own (falls back to string). Not authored directly: a `field.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.boolean", + "description": "True/false flag. Binds to the native boolean type; DB column is BOOLEAN.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A true/false flag.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.currency", + "description": "Stores money as integer minor units (cents). Binds to long; the client formats via @currency/@locale. Float arithmetic for money is forbidden.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "Storage is integer minor units (cents for USD, yen for JPY) — the wire form is unchanged from long. The server never formats currency; all formatting is client-side via Intl.NumberFormat using @currency (ISO 4217) and @locale (BCP 47). Float arithmetic for money is forbidden.", + "hasWhenToUse": true, + "whenToUse": "A column holds money. Use currency so it stores integer minor-units and the client formats it — never floats or hand-rolled cents math.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "currency", + "type": "string", + "required": "no", + "default": "`USD`", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "ISO 4217 currency code for a currency-subtype field. Storage is integer minor units; defaults to 'USD' when omitted." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.date", + "description": "Calendar date (no time-of-day). Binds to the native date/temporal type; DB column is DATE.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A column is a calendar date with no time-of-day. Use date instead of a string.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "autoSet", + "type": "string", + "required": "no", + "default": "", + "allowed": "`onCreate`, `onUpdate`", + "provider": "metaobjects-db", + "description": "Auto-set semantics for timestamp-like fields: 'onCreate' stamps on insert, 'onUpdate' stamps on every write." + }, + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.decimal", + "description": "Precision-exact decimal (use @precision/@scale). Native TS binding is string (lossless); DB column is NUMERIC(p,s); the wire form is a string. Classified DATA_TYPE_STRING so an exact decimal is never silently rounded through a double.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "The wire and native-TS form is a STRING to stay precision-exact end-to-end (Drizzle pg numeric infers as string; SP-H/ADR-0019). Set @precision (total significant digits) and @scale (digits right of the point) to drive NUMERIC(p,s).", + "hasWhenToUse": true, + "whenToUse": "A value needs exact precision (money amounts, rates, quantities). Use decimal with @precision/@scale — never double, which loses precision.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "precision", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Total number of significant digits for decimal-typed fields." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "scale", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Number of digits to the right of the decimal point for decimal-typed fields." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.double", + "description": "Double-precision (64-bit) IEEE-754 floating point. Binds to the native double/number type; DB column is DOUBLE PRECISION. Not for money — use field.currency or field.decimal.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "An approximate floating-point number where exactness is not required. For money/precision use decimal.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.duration", + "description": "A fixed-length span of time: days, hours, minutes and seconds (ADR-0036/0037 — a concept with a native type + behavior). Binds to TS string (TS has no native duration type); other ports bind to their native type (C# System.TimeSpan, Java and Kotlin java.time.Duration, Python datetime.timedelta). DB column is the Postgres-native interval type; SQLite, D1 and MySQL store a 64-bit integer count of microseconds, which orders and compares as the span does. The wire form is an ISO-8601 duration: every port writes [-]PT[nH][nM][n[.f]S] (hours never folded into days, as many fractional digits as its native type holds, zero is PT0S) and reads that form plus leading week and day counts (nW, exactly 7 days; nD, exactly 24 hours) and a fraction of any length, truncated toward zero. Years and months are refused: a calendar span is not a fixed length. Justified in ADR-0023 Amendment 1.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A field holds an elapsed time, a timeout or a delay. Use it for a native Postgres interval column and a native duration type instead of a string or a number of seconds. A calendar span (\"every 3 months\") is not a duration: model it as an int and a unit.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.enum", + "description": "String-backed enumeration constrained to a closed set of member symbols (@values). Each member is its own stored string, unless @stringValueMap gives it another (or @intValueMap an integer).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "Required @values is a non-empty, duplicate-free set; each member must match ^[A-Za-z_][A-Za-z0-9_]*$ so it is a legal identifier in every target language, and is its own stored string unless @stringValueMap (string) or @intValueMap (integer) maps it. Optional FR-010/FR-011 overlays add tolerant-extract aliasing (@enumAlias), per-member docs (@enumDoc), an uncoercible-value fallback (@coerceDefault, must be one of @values), and ASCII normalization mode (@normalize).", + "hasWhenToUse": true, + "whenToUse": "A field is a fixed, closed set of string values. Set @values so the union type, DB CHECK, and validation are generated — don't hand-roll constants + checks.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "coerceDefault", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "Fallback enum member used by tolerant extract when a present value cannot be coerced; must be one of the field's @values." + }, + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this enum's member list generates. Absent: __chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "false: this enum's member list generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validation still holds every write to the members. Absent: true. For a column whose legacy rows hold values outside the members, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "enumAlias", + "type": "properties", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "Map of alternate/off-vocabulary tokens to canonical enum members; feeds the FR-010 tolerant extract alias-fold." + }, + { + "name": "enumDoc", + "type": "properties", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "Map of enum member to a human-readable description; shown per-member in the FR-010 'guide'-style prompt fragment." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "intValueMap", + "type": "intMap", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional per-member int values ({member: int}) switching this enum field's DB persistence from string+CHECK to integer+CHECK. Keys must exactly match @values; values must be unique integers. The generated native type and wire format are unchanged in every language." + }, + { + "name": "maxLength", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Column length of a string-stored enum (drives VARCHAR(n)); every member must fit. Overrides the project's enums.maxLength. Refused with @intValueMap, whose column is an integer. Justified in ADR-0023 Amendment 1." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "normalize", + "type": "string", + "required": "no", + "default": "`strip`", + "allowed": "`none`, `collapse`, `strip`", + "provider": "metaobjects-prompt", + "description": "ASCII normalization mode for tolerant enum extract (none\\|collapse\\|strip, default strip). On field.enum it is per-field; on object.value it is the default for the object's enum fields." + }, + { + "name": "provided", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "FR-019: marks an abstract package-level field.enum as externally provided — codegen references the type (resolved via per-port codegen config) instead of materializing it. Default false. Not a field attr — it lives on the type declaration." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "stringValueMap", + "type": "properties", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional per-member stored strings ({member: string}) for a string-stored enum whose database spelling differs from its member symbols (a legacy column holding lowercase 'draft', or 'LEGACY_A'). The column, its CHECK, its length, a @default and a @condition literal hold the stored strings; the generated native type and wire format keep the members. Keys must exactly match @values; values must be unique non-empty strings. The string twin of @intValueMap, refused with it and on an array enum (ERR_BAD_ATTR_VALUE)." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "values", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Member symbols of an enum-subtype field. Declaration order is significant; each is a legal identifier and its own stored string unless @stringValueMap or @intValueMap maps it." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`transition.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.float", + "description": "Single-precision floating point. Binds to the native double/number type (TS has no distinct float); DB column is REAL. Not for money.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.inet", + "description": "An IP-address string (IPv4 or IPv6) (ADR-0036/0037 — a concept with a native type + behavior, so a subtype not a @stringFormat). Binds to TS string (TS has no native IP type, same as field.uuid); other ports bind to their native IP type (Java java.net.InetAddress, C# System.Net.IPAddress, Python ipaddress, Kotlin java.net.InetAddress). DB column is the Postgres-native inet type. Codegen emits an IPv4-or-IPv6 literal validator (a Zod regex union in TS — z.string().ip() was removed in Zod 4 — native IP-type parsing in the other ports); add @lenient to bind a plain string with no validator. v1 ships WITHOUT @kind — the native type subsumes ipv4/ipv6; @kind is reserved for a later ipv4|ipv6 value-constraint.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A field holds an IPv4 or IPv6 address. Use it for a native Postgres inet column + IP validation instead of a plain string.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "lenient", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "#234: opt this field out of strict well-formedness enforcement. When true, codegen binds a plain string (no URL/IP validator, no native URI/InetAddress type; field.inet uses a text column, not the native inet type) so a not-strictly-valid value round-trips unchanged. Default (absent/false) is strict: an absolute-scheme URI / an IPv4-or-IPv6 literal." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.int", + "description": "32-bit signed integer. Binds to the native int type; DB column is INTEGER.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A whole number within +/-2^31. Use long instead if values can exceed that.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.long", + "description": "64-bit signed integer. Binds to the native long/bigint type; DB column is BIGINT.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A whole number that may exceed 32 bits (ids, counters, epoch millis).", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.map", + "description": "An open-keyed map (Record / dict[str,V]) stored in a single jsonb column. Keys are always strings (the JSON object constraint); the value type is set by @valueType (a scalar field subtype) or @objectRef (a value-object).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "Keys are always strings. Set exactly one of @valueType (a scalar value subtype: string/int/long/double/float/decimal/boolean/date/time/timestamp/uuid) or @objectRef (a value-object name or FQN). Stored as a single jsonb column holding the JSON object — never a native array; isArray does not apply.", + "hasWhenToUse": true, + "whenToUse": "A field is an open-keyed map of values (Record). Use it for dynamic keys instead of an untyped jsonb string.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name (or FQN) of the value-object for a value-object-valued map. Mutually exclusive with @valueType; exactly one of the two must be set." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "valueType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Scalar value subtype for a scalar-valued map (string/int/long/double/float/decimal/boolean/date/time/timestamp/uuid). Mutually exclusive with @objectRef; exactly one of the two must be set." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.object", + "description": "A nested structured value (set @objectRef to the target object). Storage is governed by @storage: flattened (prefixed columns), jsonb (single jsonb column, supports isArray), or subdocument (document-store hint).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "Set @objectRef to the nested object's name (or FQN). @storage selects physical layout — flattened expands into prefixed parent columns (isArray must be false), jsonb stores the structured value (or array when isArray=true) in one jsonb column, subdocument emits no Postgres column. Defaults to single-jsonb-column when @storage is absent.", + "hasWhenToUse": true, + "whenToUse": "A field holds a nested structured value (or an array of them). Set @objectRef + @storage so the shape is typed and persisted (flattened/jsonb) instead of an untyped blob.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "flattenedColumnPrefix", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a field.object with @storage \"flattened\": the text put before each member's column, verbatim (\"\" allowed, so the members keep their own column names). Absent: this field's resolved column name and \"_\" (with @column \"bill\", the members are bill_). A fact about the owning table, so it lives on the embedding field, never on the value object. Refused on any other storage (ERR_FLATTENED_COLUMN_PREFIX_WITHOUT_FLATTENED_STORAGE). Justified in ADR-0023 Amendment 1." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name (or FQN) of the target object an object-typed field nests — drives nested-object (de)serialization." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "storage", + "type": "string", + "required": "no", + "default": "", + "allowed": "`flattened`, `jsonb`, `subdocument`", + "provider": "metaobjects-db", + "description": "Storage strategy for an object-typed field (set with @objectRef). \"flattened\" expands the nested value into prefixed columns on the parent table. \"jsonb\" stores the structured value in a single jsonb column (supports isArray=true for arrays of values). \"subdocument\" is a hint for document-store codegen targets and emits no Postgres column." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.string", + "description": "Variable-length text. Binds to the native string type; DB column is VARCHAR/TEXT (use @maxLength for VARCHAR(n)).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Plain variable-length text. Set @maxLength to size the column. The default for textual data.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "maxLength", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Maximum character length for string-typed fields (drives VARCHAR(n))." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "stringFormat", + "type": "string", + "required": "no", + "default": "", + "allowed": "`email`, `hostname`", + "provider": "metaobjects-core-types", + "description": "ADR-0036/0037: a closed validation format for a plain string field that has NO native type or behavior of its own — email \\| hostname. The field stays a plain string (native binding + DB column unchanged); codegen emits the matching validator (Zod z.email() / a hostname check; PG CHECK where appropriate). The canonical matcher per format lives in each port's codegen, NOT author validator.regex (cross-language regex engines diverge). Named @stringFormat (not @format) to avoid colliding with template.* @format (output format). Concepts WITH a native type or behavior are subtypes instead (uuid → field.uuid, url/uri → field.uri, ip → field.inet)." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.time", + "description": "Time-of-day (no calendar date). Binds to the native date/temporal type; DB column is TIME.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "autoSet", + "type": "string", + "required": "no", + "default": "", + "allowed": "`onCreate`, `onUpdate`", + "provider": "metaobjects-db", + "description": "Auto-set semantics for timestamp-like fields: 'onCreate' stamps on insert, 'onUpdate' stamps on every write." + }, + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.timestamp", + "description": "Date + time-of-day instant (optionally with timezone). Binds to the native date/temporal type; DB column is TIMESTAMP(TZ). Pair with @autoSet for created/updated stamping.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A column records an instant (created/updated at). Use timestamp so it serializes ISO-8601 with timezone consistently.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "autoSet", + "type": "string", + "required": "no", + "default": "", + "allowed": "`onCreate`, `onUpdate`", + "provider": "metaobjects-db", + "description": "Auto-set semantics for timestamp-like fields: 'onCreate' stamps on insert, 'onUpdate' stamps on every write." + }, + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "localTime", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, the timestamp is a naive wall-clock value with no timezone (Postgres `timestamp without time zone`); absent/false (the default) = an absolute instant (`timestamptz`). ADR-0036 Wave 2 — replaces the retired @dbColumnType: timestamp_with_tz escape hatch." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.uri", + "description": "A URI/URL string (ADR-0036/0037 — a concept with a native type + behavior, so a subtype not a @stringFormat). Binds to TS string (TS has no native URI type, same as field.uuid); other ports bind to their native URI type (Java java.net.URI, C# System.Uri, Python urllib.parse, Kotlin java.net.URI) and parse scheme/authority/path. DB column is text (Postgres has no uri type). Codegen emits a URL/URI validator (TS Zod z.string().url()). v1 ships WITHOUT @kind — the native type subsumes url/urn; @kind is reserved for a later url|urn value-constraint.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A field holds a URL or URI. Use it for a typed URI column + URL validation instead of a plain string.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "lenient", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "#234: opt this field out of strict well-formedness enforcement. When true, codegen binds a plain string (no URL/IP validator, no native URI/InetAddress type; field.inet uses a text column, not the native inet type) so a not-strictly-valid value round-trips unchanged. Default (absent/false) is strict: an absolute-scheme URI / an IPv4-or-IPv6 literal." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "field.uuid", + "description": "Logical UUID identity scalar. A bare scalar (no required attrs, no loader value-validation) — binds to TS string (no native UUID type); DB column is Postgres-native uuid.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A key or external identifier is a UUID. Use it for a typed UUID column instead of a plain string.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "column", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical column name for this field on an rdb source. Defaults to the field name under the project's naming.columns rule (the \"naming\" setting in .metaobjects/config.json)." + }, + { + "name": "db.indexed", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "When true, suppress the @filterable-without-index Loader warning (the field is indexed by other means)." + }, + { + "name": "dbColumnType", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical DB column-type override (ADR-0013 escape hatch). Legal values, all on field.string: uuid (a native Postgres uuid column over a string-typed field), jsonb (a genuinely-open JSON column), and the text spellings text, varchar / character varying (unbounded), varchar(n) / character varying(n) and character(n) (rc.21: Postgres's own names, lowercase; a @maxLength over n is refused). The view cast and the column use the spelling; meta migrate treats an unbounded varchar and text as one type. The logical field type and its native binding are unchanged. Native SQL arrays (uuid[]/text[]) are NOT declared here — they are derived from a field subtype + isArray (ADR-0036 Wave 1). The retired timestamp_with_tz value is gone — timezone-awareness lives in field.timestamp (instant by default) + @localTime (the naive opt-out), per ADR-0036 Wave 2." + }, + { + "name": "default", + "type": "any", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Default value applied to the column when no value is supplied. Its type follows the field's own subtype (string / boolean / number / ...). Converted at consumption time via MetaField.defaultValue()." + }, + { + "name": "example", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: an example value for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD filter allowlists (Project D filter layer)." + }, + { + "name": "formExclude", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is omitted from generated forms, and the generated create, PATCH and PUT routes ignore a value sent for it (reads of it are unchanged); inert on fields for which no form is generated (e.g. projection/derived fields)." + }, + { + "name": "instruction", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "FR-010: a short instruction for this field, shown in the generated output-format prompt fragment." + }, + { + "name": "mutability", + "type": "string", + "required": "no", + "default": "", + "allowed": "`readWrite`, `writeOnce`, `readOnly`", + "provider": "metaobjects-core-types", + "description": "FR-037 R1: who may write this field, and when. 'readWrite' (the default when absent) — the caller may set it on create and change it on update. 'writeOnce' — the caller sets it on create; it is excluded from the update shape thereafter, so a value presented on PATCH is ignored rather than rejected. 'readOnly' — nobody writes it: codegen emits no setter / writable property, the persistence layer skips the column on INSERT/UPDATE, and Zod/Pydantic/class-validator schemas omit it from input variants; the value is populated by the database (computed column, default expression, trigger), by replication, or by another external owner. The three are mutually exclusive modes of ONE axis — who may write, and when — so the illegal pair is unrepresentable and inheritance has a total order: a subtype may TIGHTEN an inherited mode (readWrite < writeOnce < readOnly) and never loosen it (ERR_MUTABILITY_DOWNGRADE). Pairing a non-readWrite mode with @autoSet is ERR_MUTABILITY_AUTOSET_CONFLICT: @autoSet already says the SERVER supplies the value, which is a different axis from who may write it." + }, + { + "name": "required", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field is NOT NULL. Equivalent to attaching a validator.required child. On a non-array string, generated wire-tier input validation (create/patch) additionally rejects the empty string by default — whitespace is accepted — unless an explicit validator.length @min: 0 opts back to presence-only. In-process read models never enforce this at construction." + }, + { + "name": "sortable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the field is exposed in generated CRUD sort allowlists. Inherits from @filterable by default; set false to opt out." + }, + { + "name": "sortableDefaultOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Direction a sort takes when it names this field but omits the order: a ?sort= with no :order, and a layout.dataGrid whose @defaultSortField names it with no @defaultSortOrder. Defaults to 'asc'." + }, + { + "name": "unique", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true, the field gets a column-level UNIQUE constraint." + }, + { + "name": "xmlText", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-prompt", + "description": "When true, this field receives its element's XML TEXT CONTENT during tolerant extract (JAXB @XmlValue / Jackson @JacksonXmlText / .NET [XmlText]) instead of a same-named child. No effect when the eliciting prompt's @responseFormat is json." + } + ], + "hasChildren": true, + "children": [ + "`origin.*` — 0..*", + "`validator.*` — 0..*", + "`view.*` — 0..*" + ], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/identity.md.json b/fixtures/metamodel-docs/data/types/identity.md.json new file mode 100644 index 0000000000..4bfcef3d35 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/identity.md.json @@ -0,0 +1,191 @@ +{ + "family": "identity", + "sections": [ + { + "typeSubType": "identity.primary", + "description": "The primary key — one per entity; @fields names its column(s), @generation the value strategy.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Every entity needs exactly one — names the primary-key field(s) and how the value is generated. Always declare it.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "fields", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The field name(s) composing this identity. Single-element for a simple PK/index, multiple for a composite." + }, + { + "name": "generation", + "type": "string", + "required": "no", + "default": "", + "allowed": "`increment`, `uuid`, `assigned`", + "provider": "metaobjects-core-types", + "description": "Primary-key value generation strategy: 'increment' (auto-increment), 'uuid', or 'assigned' (caller-supplied)." + }, + { + "name": "sequenceName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The physical name of an @generation \"increment\" key's sequence (Postgres: GENERATED BY DEFAULT AS IDENTITY (SEQUENCE NAME ...)). Absent: the database's own default,
__seq on Postgres. Lets a model adopt a sequence that kept its name across a table rename. Refused without @generation \"increment\" (ERR_SEQUENCE_WITHOUT_INCREMENT). RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "sequenceStart", + "type": "long", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The first value an @generation \"increment\" key's sequence hands out (Postgres: GENERATED BY DEFAULT AS IDENTITY (START WITH n)). Absent: 1. Lets a model reproduce a table that keeps a low id range for seeded rows. Refused without @generation \"increment\" (ERR_SEQUENCE_WITHOUT_INCREMENT). RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "identity.reference", + "description": "A foreign-key reference to another entity (@references target; @enforce toggles a physical FK).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "This entity holds a foreign key to another. Declare it to generate the FK constraint + typed navigation, instead of a loose id field you join on by hand.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical foreign-key constraint name override. Absent → the backend's auto-derived default (e.g. `
__fk`). Lets a model adopt an existing database whose FK constraints follow a different naming convention without a destructive rename. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "enforce", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "When true (default), the backend physically enforces the reference (SQL FK constraint, document validation rule, graph edge guarantee). Set false to declare a logical reference for navigation/typing/codegen only — the value may dangle at the backend level." + }, + { + "name": "fields", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The field name(s) composing this identity. Single-element for a simple PK/index, multiple for a composite." + }, + { + "name": "onDelete", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-db", + "description": "Referential action on parent delete, declared directly on the FK-defining reference — the explicit per-FK override (ADR-0047). Precedence: this attr → a correlated relationship's @onDelete (declared on either side of the FK) → the relationship's subtype default. Use for a reference-only FK (no relationship), an M:N junction's FK sides, or a per-FK override; prefer declaring the action on the relationship otherwise. RDB-physical — contributed by the db provider." + }, + { + "name": "onUpdate", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-db", + "description": "Referential action on key update, declared directly on the FK-defining reference — the explicit per-FK override (ADR-0047). Same precedence as @onDelete; when only a correlated relationship is present, @onUpdate defaults to cascade. RDB-physical — contributed by the db provider." + }, + { + "name": "references", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Target of the reference. Bare entity name (e.g. 'Program') resolves to that entity's primary identity. Dotted forms ('Program.id' or 'Program.fieldA,fieldB') target an explicit field set on the entity." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "identity.secondary", + "description": "A secondary unique index on one or more fields. Always enforces uniqueness — use index.lookup for non-unique query-performance indexes.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A column or set of columns must be unique (e.g. email, slug, composite business key). For a plain non-unique index, use index.lookup instead.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "expr", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Raw key EXPRESSION for a functional/expression index (e.g. \"lower(email)\"). Used INSTEAD of @fields — the index key is the expression rather than plain columns. RDB-physical — contributed by the db provider." + }, + { + "name": "fields", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The field name(s) composing this identity. Single-element for a simple unique index, multiple for a composite unique constraint. Required UNLESS @expr is present — a unique index keys off plain columns (@fields) or a key expression (@expr), never both; declaring both is ERR_INVALID_INDEX." + }, + { + "name": "orders", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-db", + "description": "Physical index-key sort direction, positional to @fields ('asc' \\| 'desc'). Omit for all-ascending (the default); a shorter array leaves trailing keys ascending. Drives DESC-ordered index keys (e.g. a recency index on a timestamp). RDB-physical — contributed by the db provider, not core identity." + }, + { + "name": "using", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Index access method (e.g. \"gin\", \"gist\", \"hash\"); default \"btree\" (not rendered). Pair with @expr for e.g. a GIN index over an array/jsonb expression. RDB-physical — contributed by the db provider." + }, + { + "name": "where", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Partial-index predicate (raw SQL, e.g. \"delivered_at IS NULL\"). When set, the index covers only rows matching the predicate — smaller and cheaper for queries that always filter on it. Absent = a full index over every row. RDB-physical — contributed by the db provider." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/index.md.json b/fixtures/metamodel-docs/data/types/index.md.json new file mode 100644 index 0000000000..4a6fbb6fd3 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/index.md.json @@ -0,0 +1,67 @@ +{ + "family": "index", + "sections": [ + { + "typeSubType": "index.lookup", + "description": "A non-unique lookup index on one or more fields. Use for query-performance indexes that do NOT enforce uniqueness — declare identity.secondary for unique constraints instead.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "You need a DB index for query performance (fast lookups/sorts) but NOT uniqueness enforcement. @fields names the indexed columns; the db provider adds @orders / @expr / @where / @using for physical tuning.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "expr", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Raw key EXPRESSION for a functional/expression index (e.g. \"lower(email)\"). Used INSTEAD of @fields — the index key is the expression rather than plain columns. RDB-physical — contributed by the db provider." + }, + { + "name": "fields", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The field name(s) this index covers. Required UNLESS @expr is present — an index keys off plain columns (@fields) or a key expression (@expr), never both; declaring both is ERR_INVALID_INDEX." + }, + { + "name": "orders", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-db", + "description": "Physical index-key sort direction, positional to @fields ('asc' \\| 'desc'). Omit for all-ascending (the default); a shorter array leaves trailing keys ascending. Drives DESC-ordered index keys (e.g. a recency index on a timestamp). RDB-physical — contributed by the db provider." + }, + { + "name": "using", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Index access method (e.g. \"gin\", \"gist\", \"hash\"); default \"btree\" (not rendered). Pair with @expr for e.g. a GIN index over an array/jsonb expression. RDB-physical — contributed by the db provider." + }, + { + "name": "where", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Partial-index predicate (raw SQL, e.g. \"delivered_at IS NULL\"). When set, the index covers only rows matching the predicate — smaller and cheaper for queries that always filter on it. Absent = a full index over every row. RDB-physical — contributed by the db provider." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/layout.md.json b/fixtures/metamodel-docs/data/types/layout.md.json new file mode 100644 index 0000000000..dfc992ec82 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/layout.md.json @@ -0,0 +1,90 @@ +{ + "family": "layout", + "sections": [ + { + "typeSubType": "layout.base", + "description": "Abstract base layout — the shared root subtype for object-level UI surfaces. A layout attaches a presentation concern (grids, forms, tabs, cards) to an object. The base carries no attrs of its own; concrete subtypes add their presentation attrs. Not authored directly: a `layout.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "layout.dataGrid", + "description": "A metadata-driven data grid attached to an object: declares the displayed columns, page size, default sort, and an optional preset filter the generated grid renders.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "columns", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "Flat ordered list of field names to display as grid columns." + }, + { + "name": "defaultSortField", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "Field name the grid is sorted by on initial render. Must reference an actual field on the entity." + }, + { + "name": "defaultSortOrder", + "type": "string", + "required": "no", + "default": "", + "allowed": "`asc`, `desc`", + "provider": "metaobjects-ui", + "description": "Initial sort direction for the default sort field: 'asc' or 'desc'. When omitted, the named field's @sortableDefaultOrder applies." + }, + { + "name": "filter", + "type": "filter", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "Structured preset filter object applied to the grid at the metadata level. Desugared to canonical { field: { op: value } } form at parse time." + }, + { + "name": "filterable", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "When true, the generated grid exposes column filtering UI." + }, + { + "name": "pageSize", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui", + "description": "Number of rows per page in the generated data grid." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/measure.md.json b/fixtures/metamodel-docs/data/types/measure.md.json new file mode 100644 index 0000000000..da05ba02a9 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/measure.md.json @@ -0,0 +1,146 @@ +{ + "family": "measure", + "sections": [ + { + "typeSubType": "measure.aggregate", + "description": "A named aggregate over the declaring entity's own rows (FR-044). @agg count without @distinct counts rows; with @distinct it counts distinct values of @of (a list in @of is a distinct count of the tuple). Unlike origin.aggregate, count is NOT distinct by default: a measure aggregates its own rows and dimensions reach only to-one paths, so no join inflates it.", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A number a dashboard shows: revenue, purchases, distinct buyers, last activity.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "agg", + "type": "string", + "required": "yes", + "default": "", + "allowed": "`count`, `sum`, `avg`, `min`, `max`, `any`, `all`", + "provider": "metaobjects-reporting", + "description": "The aggregate function. sum/avg need a numeric field; min/max refuse boolean, object and map fields; any/all (boolean OR / AND, Postgres bool_or / bool_and) type the measure boolean and take either a field.boolean in @of or no @of, when they ask whether some row (any) or every row (all) passes the measure's @filter / @segment." + }, + { + "name": "default", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional integer the measure reads when it would otherwise be null: nothing matched, every matched value is null, or (a ratio) the denominator is zero or null. The derived report field is then never null. Refused on @agg: count (a count is never null), on min/max over a field that is not numeric, and on @agg any/all unless it is 0 (false) or 1 (true). A ratio's operand carries its own @default into the ratio." + }, + { + "name": "distinct", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Count distinct values. Legal only with @agg: count." + }, + { + "name": "filter", + "type": "filter", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional row scope (a portable attr.filter over the declaring entity's fields). May use relative-date values ({ now: \"-P7D\" }). Combines with @segment by AND." + }, + { + "name": "of", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Dotted Entity.field reference(s) on the declaring entity, or Entity.field.member for a member of a value object stored with @storage: flattened (e.g. 'Payment.amount.amount'). A report that takes sum, avg, min or max of a numeric member must group by every non-numeric member of the same value object (its currency), so amounts in different units are never combined. A bare string is one column; more than one requires @agg: count and @distinct: true. Required for every @agg except any/all, which may omit it to quantify their @filter / @segment over the rows." + }, + { + "name": "segment", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional name of a segment declared on the same entity. Combines with @filter by AND." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "measure.derived", + "description": "A named arithmetic expression (FR-044 R13) over measures of the same entity and the report's numeric attribute dimensions, typed decimal. @expr is FR-037 R5's first arithmetic wave: add, subtract, multiply and divide, each of two operands. divide lowers as a ratio does, so a zero divisor yields null. A report listing a derived measure that reads a dimension must list that dimension.", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A number computed from other measures or from a grouped value: utilization percent (billable hours x 100 / capacity), budget burn (cost / budget), net revenue (revenue - refunds).", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "expr", + "type": "expression", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "The arithmetic: { field: name } names a numeric measure.aggregate or measure.ratio of the same entity, or one of its numeric attribute dimensions (never another measure.derived); { value: n } is a number; { fn: add \\| subtract \\| multiply \\| divide, args: [a, b] } combines two operands." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "measure.ratio", + "description": "A named quotient of two numeric measure.aggregate siblings (FR-044), lowered as numerator / NULLIF(denominator, 0) and typed decimal. A zero denominator yields null.", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Averages per unit that are not a plain avg: average days engaged per starter.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "default", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional integer the measure reads when it would otherwise be null: nothing matched, every matched value is null, or (a ratio) the denominator is zero or null. The derived report field is then never null. Refused on @agg: count (a count is never null) and on min/max over a field that is not numeric. A ratio's operand carries its own @default into the ratio." + }, + { + "name": "denominator", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Name of a measure.aggregate on the same entity whose result is numeric: a count, a sum, an avg, or a min or max of a numeric field." + }, + { + "name": "numerator", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Name of a measure.aggregate on the same entity whose result is numeric: a count, a sum, an avg, or a min or max of a numeric field." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/metadata.md.json b/fixtures/metamodel-docs/data/types/metadata.md.json new file mode 100644 index 0000000000..c3c83a0dd1 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/metadata.md.json @@ -0,0 +1,26 @@ +{ + "family": "metadata", + "sections": [ + { + "typeSubType": "metadata.root", + "description": "Root metadata document", + "hasOwner": false, + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": true, + "children": [ + "`api.*` — 0..*", + "`field.*` — 0..*", + "`object.*` — 0..*", + "`requirement.*` — 0..*", + "`template.*` — 0..*", + "`validator.*` — 0..*" + ], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/object.md.json b/fixtures/metamodel-docs/data/types/object.md.json new file mode 100644 index 0000000000..98c450f552 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/object.md.json @@ -0,0 +1,376 @@ +{ + "family": "object", + "sections": [ + { + "typeSubType": "object.base", + "description": "Abstract object base — the shared root subtype that concrete object subtypes (entity/value/projection) specialize. Declares the structural children common to EVERY object subtype (the intersection: field/identity/validator/layout/source); subtype-specific children (relationship, template) and attrs (discriminator) ride their own subtypes. Has no runtime semantics of its own; not authored directly. A `object.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED): this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "object", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The native class an object binds to (ADR-0001), in place of its default runtime class: on the JVM, a fully-qualified class name. Cross-port vocabulary only Java implements so far; every port loads and type-checks it, and the others do not act on it yet." + }, + { + "name": "objectAdapter", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "JVM-only (ADR-0005): the fully-qualified name of an ObjectAdapter that takes over value access for this object's instances. Every port loads and type-checks it; only Java and Kotlin act on it." + } + ], + "hasChildren": true, + "children": [ + "`field.*` — 0..*", + "`identity.*` — 0..*", + "`index.*` — 0..*", + "`layout.*` — 0..*", + "`source.*` — 0..*", + "`validator.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "object.entity", + "description": "An object that owns its data: own identity, writable sources, and lifecycle. The default object subtype — a bare `object:` key resolves to entity. May co-locate templates (template.prompt and friends) with the owning entity.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "object.entity owns data — it declares its own identity, its primary source must be a writable @kind (read-only kinds may appear only in a read role), and it carries lifecycle. A field carrying origin.* is derived ⇒ read-only wherever it lives, including on an entity. Templates (template.*) may be nested so a prompt can be co-located with its owning entity. See ADR-0028 (object taxonomy).", + "hasWhenToUse": true, + "whenToUse": "The thing owns its own data and lifecycle — a table you create/read/update/delete. The default for any persisted resource.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "collectionName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The name of this object's collection, in the object's own casing (e.g. 'CaseHistory', 'Queues'): the REST collection segment (snake_cased) in every port, the reverse-finder names in C#, TypeScript and Python, the C# DbSet property, and the TypeScript list function, list hook and Drizzle table variable. It need not be a grammatical plural. Absent, the project's pluralizer derives it from the object's name (naming.collections in .metaobjects/config.json; built in: standard, none; an application may register its own)." + }, + { + "name": "discriminator", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "FR-014: names the field on this entity (resolvable via extends:) that holds the subtype-discriminator value. Subtypes of this entity declare @discriminatorValue to bind their rows to a discriminator value. The discriminator field itself is an ordinary field declaration (typically field.enum or field.int / field.string)." + }, + { + "name": "discriminatorValue", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "FR-014: on a subtype of an entity with @discriminator — the value that identifies rows of this subtype in the shared discriminator field. Wire form is always a string; the underlying field's subtype (enum / int / string) controls codegen + storage coercion. Required on every concrete subtype of a discriminated entity." + }, + { + "name": "object", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The native class an object binds to (ADR-0001), in place of its default runtime class: on the JVM, a fully-qualified class name. Cross-port vocabulary only Java implements so far; every port loads and type-checks it, and the others do not act on it yet." + }, + { + "name": "objectAdapter", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "JVM-only (ADR-0005): the fully-qualified name of an ObjectAdapter that takes over value access for this object's instances. Every port loads and type-checks it; only Java and Kotlin act on it." + } + ], + "hasChildren": true, + "children": [ + "`dimension.*` — 0..*", + "`field.*` — 0..*", + "`identity.*` — 0..*", + "`index.*` — 0..*", + "`layout.*` — 0..*", + "`measure.*` — 0..*", + "`relationship.*` — 0..*", + "`segment.*` — 0..*", + "`source.*` — 0..*", + "`template.*` — 0..*", + "`validator.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "object.projection", + "description": "A derived read-only representation of entities. Its fields are extends-bound / origin-derived / self-declared-under-external-assembly, all read-only at the subtype level. Identity is optional and MUST extend an entity identity; sources are restricted to read-only @kinds. The declared field set IS the exposure (inclusive, fail-closed).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "object.projection is a derived read-only representation: every field is extends-bound, origin-derived, or self-declared-under-external-assembly, and all are read-only at the subtype level. Identity is optional and, when present, MUST extend an entity identity. Sources are restricted to read-only @kinds. The declared field set IS the exposure — an inclusive list, fail-closed. A projection NEVER declares relationships (derivation is expressed via @via, not a relationship child) and NEVER co-locates templates — hence its child set omits both relationship and template. The assembly origins (origin.aggregate / origin.computed / origin.first) live HERE, not on object.value; a SOURCELESS projection is the legal shape for a wire-assembled read model, and a template-level @payloadRef/@responseRef may target one (#210). See ADR-0028 (object taxonomy, projection).", + "hasWhenToUse": true, + "whenToUse": "You need a derived, read-only view over entities — a report, summary, or joined/aggregated read model. Declare it (with origin.* children) instead of hand-writing the SELECT/joins; it stays read-only and regenerates.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "collectionName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The name of this object's collection, in the object's own casing (e.g. 'CaseHistory', 'Queues'): the REST collection segment (snake_cased) in every port, the reverse-finder names in C#, TypeScript and Python, the C# DbSet property, and the TypeScript list function, list hook and Drizzle table variable. It need not be a grammatical plural. Absent, the project's pluralizer derives it from the object's name (naming.collections in .metaobjects/config.json; built in: standard, none; an application may register its own)." + }, + { + "name": "filter", + "type": "filter", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional row-scope predicate (a portable attr.filter object: eq/ne/gt/gte/lt/lte/like/in/isNull with and/or, desugared to { field: { op: value } } at parse time) selecting which rows the view returns — lowered to an outer SQL WHERE. A key names one of the projection's own fields, else a field of its base entity the view need not output, else a PATH of to-one hops (identity.reference or @cardinality one relationship names) from the base then a field of the entity reached ('orderId.customerId.hasActiveMembership'), joined but not output. A reached entity field may itself be derived (entity-derived: an origin.computed or origin.first declared on the entity, inlined where the filter reaches it). An aggregate-derived field is not addressable (fail-closed); a to-many hop is refused. A value may be a relative date ({ now: \"\", startOf? }) on a date or timestamp field (rc.19)." + }, + { + "name": "grain", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "rc.21: the view has one row per element of this base-entity field, a field.object array stored as jsonb; a base row with no element has no row. A field whose origin.passthrough @from names the field's @objectRef value object (Address.city) reads that member of the element; the base's own fields read the parent row as usual. An origin.aggregate is refused on such a projection." + }, + { + "name": "grainOrdinal", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "rc.21: with @grain, the name of a field.int or field.long of this projection (with no origin) that holds the element's 1-based position in the array." + }, + { + "name": "object", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The native class an object binds to (ADR-0001), in place of its default runtime class: on the JVM, a fully-qualified class name. Cross-port vocabulary only Java implements so far; every port loads and type-checks it, and the others do not act on it yet." + }, + { + "name": "objectAdapter", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "JVM-only (ADR-0005): the fully-qualified name of an ObjectAdapter that takes over value access for this object's instances. Every port loads and type-checks it; only Java and Kotlin act on it." + }, + { + "name": "union", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "rc.21: the view is this projection's rows UNIONed with each named projection's rows. Each named projection has the same effective fields as this one, in order: names, subtypes, array-ness and physical column names (ERR_BAD_ATTR_VALUE otherwise); its own @filter, joins and base apply to its rows. Usually this projection extends one branch and names the others. A named projection may be abstract and sourceless." + }, + { + "name": "unionAll", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "rc.21: with @union, keep duplicate rows (UNION ALL). Absent or false: duplicates are removed (UNION), SQL's own default." + } + ], + "hasChildren": true, + "children": [ + "`field.*` — 0..*", + "`identity.*` — 0..*", + "`index.*` — 0..*", + "`layout.*` — 0..*", + "`source.*` — 0..*", + "`validator.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "object.report", + "description": "A declared report (FR-044): a fixed combination of dimensions and measures of ONE entity (@from), compiled to a read-only view. One row per distinct dimension tuple; no dimensions means exactly one row. Fields are DERIVED, not declared: one per dimension (a time dimension's field is , e.g. purchasedAtDay) and one per measure. Every measure must belong to @from (two fact tables are two reports). @filter and @segment scope rows before grouping and combine by AND. Read-only: no writes, no get-by-id.", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Dashboard totals, per-day series and per-group summaries that would otherwise be hand-written GROUP BY queries.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "collectionName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "The name of this object's collection, in the object's own casing (e.g. 'CaseHistory', 'Queues'): the REST collection segment (snake_cased) in every port, the reverse-finder names in C#, TypeScript and Python, the C# DbSet property, and the TypeScript list function, list hook and Drizzle table variable. It need not be a grammatical plural. Absent, the project's pluralizer derives it from the object's name (naming.collections in .metaobjects/config.json; built in: standard, none; an application may register its own)." + }, + { + "name": "dimensions", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Dimension names of @from; a time dimension is written 'name:grain'. Absent means one global row." + }, + { + "name": "filter", + "type": "filter", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional row scope over @from's fields; may use relative-date values." + }, + { + "name": "from", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "The object.entity whose rows the report aggregates." + }, + { + "name": "measures", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Measure names of @from." + }, + { + "name": "object", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The native class an object binds to (ADR-0001), in place of its default runtime class: on the JVM, a fully-qualified class name. Cross-port vocabulary only Java implements so far; every port loads and type-checks it, and the others do not act on it yet." + }, + { + "name": "objectAdapter", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "JVM-only (ADR-0005): the fully-qualified name of an ObjectAdapter that takes over value access for this object's instances. Every port loads and type-checks it; only Java and Kotlin act on it." + }, + { + "name": "segment", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional segment of @from scoping the rows." + }, + { + "name": "spine", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional to-one path from @from to the entity whose rows supply the report's rows (e.g. 'Purchase.program'), written like a dimension's @via. With it the report has one row per distinct dimension tuple among THAT entity's rows, including the ones no row of @from refers to: a count there is 0 and any other measure is null unless it declares @default. Every listed dimension must be reached through this path. @segment and @filter still scope the rows of @from and never remove a row. A row of @from whose reference is null or matches nothing is in no row of the report." + } + ], + "hasChildren": true, + "children": [ + "`field.*` — 0..*", + "`identity.*` — 0..*", + "`index.*` — 0..*", + "`layout.*` — 0..*", + "`source.*` — 0..*", + "`validator.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "object.value", + "description": "A value object — pure shape with NO identity and NO source, ever. Constructed (by caller / embedding), never populated from a store. May `extends` an entity's fields to reuse shape. Equality is by content.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "object.value is pure shape: it NEVER declares an identity and NEVER declares a source, in any role. It is constructed — by a caller or by embedding — and is never populated from a backing store. A value-hosted field may carry origin.passthrough (FR-015 parameter lineage) but NEVER an assembly origin (origin.aggregate / origin.computed / origin.first) — passthrough on a value is lineage; assembly origins live on object.projection (#210). It may `extends` an entity's fields to reuse their shape. @normalize is the object-level default ASCII normalization mode applied to this value's enum fields' tolerant extract (each field may still override per-field). See ADR-0028 (object taxonomy, value purity).", + "hasWhenToUse": true, + "whenToUse": "You need a reusable typed shape with NO identity and NO table — an embedded value, a DTO, a prompt/response payload. Constructed in memory, never persisted on its own.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "normalize", + "type": "string", + "required": "no", + "default": "`strip`", + "allowed": "`none`, `collapse`, `strip`", + "provider": "metaobjects-prompt", + "description": "ASCII normalization mode for tolerant enum extract (none\\|collapse\\|strip, default strip). On field.enum it is per-field; on object.value it is the default for the object's enum fields." + }, + { + "name": "object", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The native class an object binds to (ADR-0001), in place of its default runtime class: on the JVM, a fully-qualified class name. Cross-port vocabulary only Java implements so far; every port loads and type-checks it, and the others do not act on it yet." + }, + { + "name": "objectAdapter", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "JVM-only (ADR-0005): the fully-qualified name of an ObjectAdapter that takes over value access for this object's instances. Every port loads and type-checks it; only Java and Kotlin act on it." + } + ], + "hasChildren": true, + "children": [ + "`field.*` — 0..*", + "`identity.*` — 0..*", + "`index.*` — 0..*", + "`layout.*` — 0..*", + "`relationship.*` — 0..*", + "`source.*` — 0..*", + "`validator.*` — 0..*" + ], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/operation.md.json b/fixtures/metamodel-docs/data/types/operation.md.json new file mode 100644 index 0000000000..2a5c4f4045 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/operation.md.json @@ -0,0 +1,223 @@ +{ + "family": "operation", + "sections": [ + { + "typeSubType": "operation.base", + "description": "Registry anchor for the attributes every operation shares (ADR-0054): not authorable.", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "inputRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The `object.value` this operation takes as its input (ADR-0030). Absent on an operation whose only parameter is the target's borrowed key. Anything other than an `object.value` is ERR_OPERATION_SHAPE." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The entity this operation acts on, declared only when it cannot be derived. It is derived from the input value when its fields `extend` every primary key field of exactly one entity, each once, else from the output's base entity; an input that borrows part of a key, one key field twice, or the keys of two entities derives nothing, so declare it. Declared and derivable, the two must agree (ERR_OPERATION_TARGET_MISMATCH). It must name an `object.entity` (ERR_OPERATION_TARGET_UNRESOLVED)." + }, + { + "name": "outputRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The object this operation returns: an `object.projection`, `object.entity` or `object.value`. Which projection a query returns is the author's choice among several over one entity, so it cannot be computed. Anything else is ERR_OPERATION_SHAPE." + }, + { + "name": "permission", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The permission name the generated shell will ask the project's policy about before anything is written (no shell is generated yet). A key into grant data (who holds it is data, what the policy decides is code), so an explicit name is stable: a derived name moves when the operation is renamed. A dotted identifier path such as `purchasing.approve`; a package prefix may use `::` (ERR_BAD_ATTR_VALUE otherwise). Absent and not @public: the shell will use the derived name `.`, with the package of the operation's API, and `verify` advises or requires an explicit one (setting `rules.permissions.names`). Several operations may share one." + }, + { + "name": "public", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The shell will call no permission check (no shell is generated yet). Authentication is the transport's job and is unaffected. Absent means checked. Declaring it with @permission is ERR_PERMISSION_PUBLIC_CONFLICT." + } + ], + "hasChildren": true, + "children": [ + "`binding.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "operation.command", + "description": "A named operation that changes state. Takes an `object.value` (ADR-0030). Its body is hand-written. The contract (ADR-0066) is that a generated shell around it loads the row, checks the permission and the current state, runs the body, and makes the guarded update in one transaction. No shell is generated yet: this vocabulary is registered, loaded and checked, and nothing is generated from it. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A business action with its own name, input and rules: approve, cancel, transfer. A command that moves a lifecycle names the transitions it may make in @transitions; its body decides which one applies.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "errors", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The business failures the hand-written body may return, each a lower snake case code (`insufficient_funds`). They name the wire error, the OpenAPI document and the typed result; the shell will refuse an undeclared one (no shell is generated yet). A code that is not lower snake case, appears twice, or is one the route answers itself (not_found, forbidden, invalid_transition, transition_condition_failed, state_managed, validation, invalid_json, invalid_id, method_not_allowed, constraint_violation, internal) is ERR_BAD_ATTR_VALUE." + }, + { + "name": "inputRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The `object.value` this operation takes as its input (ADR-0030). Absent on an operation whose only parameter is the target's borrowed key. Anything other than an `object.value` is ERR_OPERATION_SHAPE." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The entity this operation acts on, declared only when it cannot be derived. It is derived from the input value when its fields `extend` every primary key field of exactly one entity, each once, else from the output's base entity; an input that borrows part of a key, one key field twice, or the keys of two entities derives nothing, so declare it. Declared and derivable, the two must agree (ERR_OPERATION_TARGET_MISMATCH). It must name an `object.entity` (ERR_OPERATION_TARGET_UNRESOLVED)." + }, + { + "name": "outputRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The object this operation returns: an `object.projection`, `object.entity` or `object.value`. Which projection a query returns is the author's choice among several over one entity, so it cannot be computed. Anything else is ERR_OPERATION_SHAPE." + }, + { + "name": "permission", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The permission name the generated shell will ask the project's policy about before anything is written (no shell is generated yet). A key into grant data (who holds it is data, what the policy decides is code), so an explicit name is stable: a derived name moves when the operation is renamed. A dotted identifier path such as `purchasing.approve`; a package prefix may use `::` (ERR_BAD_ATTR_VALUE otherwise). Absent and not @public: the shell will use the derived name `.`, with the package of the operation's API, and `verify` advises or requires an explicit one (setting `rules.permissions.names`). Several operations may share one." + }, + { + "name": "public", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The shell will call no permission check (no shell is generated yet). Authentication is the transport's job and is unaffected. Absent means checked. Declaring it with @permission is ERR_PERMISSION_PUBLIC_CONFLICT." + }, + { + "name": "transitions", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The lifecycle moves this command may make: names of `transition.action` nodes on its target entity (ERR_OPERATION_UNKNOWN_TRANSITION otherwise). A fact of the business the model cannot compute. A transition a command lists gets no derived command of its own. Listing any requires a target (ERR_OPERATION_TARGET_UNRESOLVED)." + } + ], + "hasChildren": true, + "children": [ + "`binding.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "operation.query", + "description": "A named operation that reads. Returns an `object.projection` (or an entity or value). It changes nothing. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A read with its own name and shape beyond derived get and list: my open requests, the dashboard summary.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "inputRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The `object.value` this operation takes as its input (ADR-0030). Absent on an operation whose only parameter is the target's borrowed key. Anything other than an `object.value` is ERR_OPERATION_SHAPE." + }, + { + "name": "many", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The query returns a list and takes the filter, sort and paging contract. Not implied by the projection, so declared. Absent means one row. Legal on a query only." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The entity this operation acts on, declared only when it cannot be derived. It is derived from the input value when its fields `extend` every primary key field of exactly one entity, each once, else from the output's base entity; an input that borrows part of a key, one key field twice, or the keys of two entities derives nothing, so declare it. Declared and derivable, the two must agree (ERR_OPERATION_TARGET_MISMATCH). It must name an `object.entity` (ERR_OPERATION_TARGET_UNRESOLVED)." + }, + { + "name": "outputRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The object this operation returns: an `object.projection`, `object.entity` or `object.value`. Which projection a query returns is the author's choice among several over one entity, so it cannot be computed. Anything else is ERR_OPERATION_SHAPE." + }, + { + "name": "permission", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The permission name the generated shell will ask the project's policy about before anything is written (no shell is generated yet). A key into grant data (who holds it is data, what the policy decides is code), so an explicit name is stable: a derived name moves when the operation is renamed. A dotted identifier path such as `purchasing.approve`; a package prefix may use `::` (ERR_BAD_ATTR_VALUE otherwise). Absent and not @public: the shell will use the derived name `.`, with the package of the operation's API, and `verify` advises or requires an explicit one (setting `rules.permissions.names`). Several operations may share one." + }, + { + "name": "public", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The shell will call no permission check (no shell is generated yet). Authentication is the transport's job and is unaffected. Absent means checked. Declaring it with @permission is ERR_PERMISSION_PUBLIC_CONFLICT." + } + ], + "hasChildren": true, + "children": [ + "`binding.*` — 0..*" + ], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/origin.md.json b/fixtures/metamodel-docs/data/types/origin.md.json new file mode 100644 index 0000000000..c9a94a31eb --- /dev/null +++ b/fixtures/metamodel-docs/data/types/origin.md.json @@ -0,0 +1,297 @@ +{ + "family": "origin", + "sections": [ + { + "typeSubType": "origin.aggregate", + "description": "A value reduced from the related row-set reached along a relationship path (@via) from the base entity: count/sum/avg/min/max over a column (@of); any/all predicate quantifiers over a @filter; or collect (an array rollup — of the @of column, or of the carrying field.object's declared @objectRef value object when @of is omitted).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@via may be omitted only when exactly one single-hop relationship leads from the base entity to the @of entity (single-hop-unique inference; FR-024, ADR-0029). Multi-hop paths must always be stated explicitly. @of is required for count/sum/avg/min/max and forbidden for any/all (which quantify over rows via @filter, not a column). @filter is required for any/all. The field must be isArray:true for collect and isArray:false for every other @agg. @distinct and @orderBy are collect-only. On @agg:collect @of is OPTIONAL: omitting it declares a WHOLE-OBJECT rollup, which collects each related row as the carrying field's declared @objectRef value object instead of one scalar column. A whole-object rollup requires a field.object carrying @objectRef, requires that @objectRef to name an object.value, requires an explicit @via (there is no @of entity to infer the path from), and refuses @distinct. Its @orderBy keys resolve against the @via TERMINAL entity, not the head or a middle hop. Its value-object members bind to the terminal entity's fields BY NAME — member name == terminal field name, deliberately NOT extends, so one value object stays collectable from two different entities — and every member must match a terminal field agreeing on BOTH field. and array-ness.", + "hasWhenToUse": true, + "whenToUse": "A projection needs a value derived by reducing related rows — a count/sum/avg/min/max, a 'did any/every related row match' flag, or an array of collected values. Declare it instead of hand-writing the aggregate query — it stays consistent and regenerates.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "agg", + "type": "string", + "required": "yes", + "default": "", + "allowed": "`count`, `sum`, `avg`, `min`, `max`, `any`, `all`, `collect`", + "provider": "metaobjects-core-types", + "description": "The reducing function applied over the related row-set: count/sum/avg/min/max (numeric/ordinal reduces over @of); any/all (predicate quantifiers over @filter — @of forbidden; empty set → any=false, all=true); collect (array rollup — of the @of column, or of the carrying field.object's declared @objectRef value object when @of is omitted; the field must be isArray)." + }, + { + "name": "distinct", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Set (collect-only) to dedupe collected values (set semantics). Not supported on a whole-object collect (@of omitted): it is a guaranteed no-op whenever the value object carries the primary key, and a silent no-op is worse than a refusal." + }, + { + "name": "filter", + "type": "filter", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional structured predicate scoping which related rows the aggregate spans (required for any/all, where it is the quantified predicate). A portable attr.filter object (eq/ne/in/isNull with and/or), desugared to canonical { field: { op: value } } at parse time; codegen renders it per target (e.g. SQL FILTER (WHERE ...) or SQLite CASE WHEN for a relational view). A clause value may also be a relative date ({ now: \"\", startOf? }) on a date or timestamp field, or — correlated-filter — { field: \"\" }, the base row's field, compared with eq/ne/gt/gte/lt/lte or the null-safe isDistinctFrom / isNotDistinctFrom (rc.19)." + }, + { + "name": "of", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Dotted Entity.field reference identifying the column being aggregated (e.g. 'Week.durationMinutes'). Required for count/sum/avg/min/max; OPTIONAL for collect, where absent means a whole-object rollup of the field's declared @objectRef value object; forbidden for any/all (which quantify over rows via @filter, not a column)." + }, + { + "name": "orderBy", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Ordering keys as 'field[:asc\\|desc]' (default asc) over the related entity's fields; nulls sort last. On @agg:collect sets element order (non-distinct only); on origin.first (required) selects the row. Semantic — carries no SQL syntax." + }, + { + "name": "segment", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional name of a segment.filter declared on the related entity (the @of entity, else the @via terminal) — rc.19 origin-segment. Its predicate scopes the related rows, ANDed with @filter, exactly as measure.aggregate @segment does; it may use relative dates." + }, + { + "name": "via", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Dotted relationship path from the base entity to the aggregated rows (e.g. 'Program.weeks' or 'Program.weeks.workouts'). May be omitted only when exactly one single-hop relationship leads from the base entity to the @of entity (FR-024, ADR-0029)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "origin.base", + "description": "Abstract base origin — the shared root subtype for field-level provenance. A field carrying any origin.* is derived ⇒ read-only wherever it lives. The base carries no attrs of its own; concrete subtypes add their provenance attrs. Not authored directly: a `origin.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "origin.computed", + "description": "A row-level value computed from the base entity's own fields via a structured expression tree (@expr). No related rows, no @via. Read-only; the expression's inferred type must equal the field's declared subType.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A projection field is a cheap derived value over the base row itself (e.g. 'payload IS NOT NULL' to avoid shipping a heavy column). Declare the expression tree instead of hand-writing the derived SELECT column.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "expr", + "type": "expression", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The structured expression tree computing this field's value from the base entity's own fields (closed node grammar; shares the filter op vocabulary). Its inferred root type must equal the field's declared subType (ERR_COMPUTED_TYPE_MISMATCH)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "origin.first", + "description": "The single related row selected by @orderBy along @via, projecting its @of column (argmax then project). Latest = @orderBy desc. Read-only; empty related set (after @filter) → null, so the field must not be @required.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@via may be omitted only when exactly one single-hop relationship leads from the base entity to the @of entity (FR-024, ADR-0029). The related entity's primary key ascending is always appended as the final ordering tie-breaker so the selection is deterministic.", + "hasWhenToUse": true, + "whenToUse": "A projection needs one related row's column chosen by an ordering — 'the latest child's status', 'the earliest event's timestamp'. Declare @via + @of + @orderBy instead of hand-writing the correlated ORDER BY … LIMIT 1 subquery.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "filter", + "type": "filter", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional structured predicate scoping which related rows are eligible for selection. A portable attr.filter object (eq/ne/in/isNull with and/or), desugared to canonical { field: { op: value } } at parse time. A clause value may also be a relative date ({ now: \"\", startOf? }) on a date or timestamp field, or — correlated-filter — { field: \"\" }, the base row's field, compared with eq/ne/gt/gte/lt/lte or the null-safe isDistinctFrom / isNotDistinctFrom (rc.19)." + }, + { + "name": "of", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Dotted Entity.field reference identifying the column projected from the selected row (e.g. 'ChildA.label'). Type-preserving: the field's declared subType must equal this column's subType (#185 doctrine)." + }, + { + "name": "orderBy", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Ordering keys as 'field[:asc\\|desc]' (default asc) over the related entity's fields; nulls sort last. Selects the single row (the first after ordering). The related PK ascending is appended as the deterministic tie-breaker. Semantic — carries no SQL syntax." + }, + { + "name": "segment", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "Optional name of a segment.filter declared on the related entity (the @of entity) — rc.19 origin-segment. Its predicate scopes the related rows, ANDed with @filter, exactly as measure.aggregate @segment does; it may use relative dates." + }, + { + "name": "via", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Dotted relationship path from the base entity to the related rows (e.g. 'Parent.childAs'). May be omitted only when exactly one single-hop relationship leads from the base entity to the @of entity (FR-024, ADR-0029)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "origin.function", + "description": "A value computed by a database function the project owns (rc.21): @function names it, @schema its schema (absent: public), and @args the fields passed to it, in order. On an entity an argument is one of its fields; on a projection, one of its own fields (not an aggregate) or a field of its base entity. @params declares each argument's type and @returns the result's: an argument must have its parameter's type (cast it through an origin.computed field otherwise), @returns must be the carrying field's subtype, and the view casts the call to the field's full column type (the one its table column would have: length or @dbColumnType spelling, precision and scale, a local or zoned timestamp), so the call is checked, never free SQL. The signature is a declaration: meta verify --db reads the function from pg_proc and fails on a parameter or return type that differs. MetaObjects never creates the function: it is owned SQL, created before the view. Declared on an entity, it is entity-derived: a projection reaching the entity reads it like any derived field. Postgres only; the SQLite view emitter refuses it.", + "hasOwner": true, + "owner": "metaobjects-view-expressions", + "hasImplementedIn": true, + "implementedIn": "csharp, typescript", + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A view column is the result of a function the database already holds (a PL/pgSQL state machine, a legacy computation) and cannot be expressed in @expr. Declare the call instead of hand-writing the view's @sql.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "args", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "The fields passed to the function, in parameter order: field names of the host entity, or (on a projection) of the projection or its base entity. Each must be a scalar field whose subtype is the declared parameter type in @params; to pass another type, pass an origin.computed field that casts it ({ cast: { field: x }, as: }). Absent or empty: a function of no arguments." + }, + { + "name": "function", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "The function's name as the database names it: a plain identifier ([A-Za-z_][A-Za-z0-9_]*), quoted when it is not lowercase." + }, + { + "name": "params", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "The function's declared parameter types, one field subtype per @args entry, in order (string, int, long, double, float, decimal, boolean, date, timestamp, uuid). Required when @args is not empty; an argument of another type is refused (ERR_INVALID_ORIGIN)." + }, + { + "name": "returns", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "The function's declared return type, a field subtype; it must be the carrying field's subtype (ERR_INVALID_ORIGIN). The view casts the call to the field's full column type, which would hide a wrong declaration, so meta verify --db checks it against the function's real return type (pg_proc)." + }, + { + "name": "schema", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-view-expressions", + "description": "The schema the function lives in, a plain identifier. Absent: public." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "origin.passthrough", + "description": "A cross-entity field reference: this projection field passes a source entity's value straight through (@from), optionally reached via a relationship path (@via).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A projection field just surfaces a field from a related entity. Declare the cross-entity passthrough instead of re-joining and re-selecting it by hand.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "convert", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Acknowledges that this field's declared type deliberately differs from its @from source field's type (#185). Absent/false (the default), a passthrough is type-preserving — a differing field. or array-ness fails with ERR_PASSTHROUGH_TYPE_MISMATCH. Set true to opt out. This is an acknowledgement only: it does NOT generate a cast — the value flows through unchanged and the consumer owns any coercion. Real type-converting projections are origin.expression's job (#159)." + }, + { + "name": "from", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Dotted Entity.field reference identifying the source value this projection field passes through (e.g. 'Program.title')." + }, + { + "name": "via", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional dotted relationship path used to reach the source entity (e.g. 'Program.weeks')." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/relationship.md.json b/fixtures/metamodel-docs/data/types/relationship.md.json new file mode 100644 index 0000000000..9af023698d --- /dev/null +++ b/fixtures/metamodel-docs/data/types/relationship.md.json @@ -0,0 +1,328 @@ +{ + "family": "relationship", + "sections": [ + { + "typeSubType": "relationship.aggregation", + "description": "A shared/independent containment — the parent groups the target but does not own its lifecycle (default @onDelete set-null).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction, or on a @cardinality:'one' relationship names which of several identity.reference nodes onto the same target it navigates when name-pairing does not resolve it uniquely; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. Aggregation is shared/independent — the target outlives the parent (default @onDelete set-null).", + "hasWhenToUse": true, + "whenToUse": "One entity groups others it does NOT own (children outlive the parent; delete sets the FK null). Use instead of composition when there is no ownership.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "cardinality", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')." + }, + { + "name": "onDelete", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)." + }, + { + "name": "onUpdate", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on key update. Default cascade." + }, + { + "name": "sourceRefField", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Disambiguates which reference/FK field a relationship uses when more than one candidate exists: on a directed self-join M:N it names the junction's source-side reference (mutually exclusive with @symmetric), and on a @cardinality:'one' relationship it names which of several identity.reference nodes onto the same target the relationship navigates when name-pairing does not resolve it uniquely." + }, + { + "name": "symmetric", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField." + }, + { + "name": "through", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "relationship.association", + "description": "A plain reference to another entity — no ownership; the target has an independent lifecycle (default @onDelete restrict).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction, or on a @cardinality:'one' relationship names which of several identity.reference nodes onto the same target it navigates when name-pairing does not resolve it uniquely; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. Association is a plain reference — the target's lifecycle is independent (default @onDelete restrict).", + "hasWhenToUse": true, + "whenToUse": "A plain directed reference to another entity, no ownership or cascade. The lightest link — when you just need to point at another entity.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "cardinality", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')." + }, + { + "name": "onDelete", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)." + }, + { + "name": "onUpdate", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on key update. Default cascade." + }, + { + "name": "sourceRefField", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Disambiguates which reference/FK field a relationship uses when more than one candidate exists: on a directed self-join M:N it names the junction's source-side reference (mutually exclusive with @symmetric), and on a @cardinality:'one' relationship it names which of several identity.reference nodes onto the same target the relationship navigates when name-pairing does not resolve it uniquely." + }, + { + "name": "symmetric", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField." + }, + { + "name": "through", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "relationship.base", + "description": "Abstract relationship base — shared shape for the concrete association/aggregation/composition subtypes; not authored directly. A `relationship.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED): this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@cardinality is an open string at the metamodel level ('one'/'many', and Java-canonical composite forms such as 'many-to-one'); @objectRef names the target entity. M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction, or on a @cardinality:'one' relationship names which of several identity.reference nodes onto the same target it navigates when name-pairing does not resolve it uniquely; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. @onDelete/@onUpdate carry referential actions (cascade/set-null/restrict/no-action).", + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "cardinality", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')." + }, + { + "name": "onDelete", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)." + }, + { + "name": "onUpdate", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on key update. Default cascade." + }, + { + "name": "sourceRefField", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Disambiguates which reference/FK field a relationship uses when more than one candidate exists: on a directed self-join M:N it names the junction's source-side reference (mutually exclusive with @symmetric), and on a @cardinality:'one' relationship it names which of several identity.reference nodes onto the same target the relationship navigates when name-pairing does not resolve it uniquely." + }, + { + "name": "symmetric", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField." + }, + { + "name": "through", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "relationship.composition", + "description": "An owned containment — the parent owns the target's lifecycle; deleting the parent deletes the children (default @onDelete cascade).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "M:N is expressed by @cardinality:'many' + @objectRef + @through: @through names a junction entity that MUST declare two identity.reference children (one per FK side), and the relationship's FK fields are DERIVED from those references — never restated. @sourceRefField disambiguates a DIRECTED self-join by naming the source-side FK field on the junction, or on a @cardinality:'one' relationship names which of several identity.reference nodes onto the same target it navigates when name-pairing does not resolve it uniquely; @symmetric marks an UNDIRECTED self-join (union-on-read) valid only when @objectRef == the declaring entity; the two are mutually exclusive. Composition is owned lifecycle — the children do not outlive the parent (default @onDelete cascade).", + "hasWhenToUse": true, + "whenToUse": "You need a parent that OWNS a child collection (one-to-many, cascade on delete). Declare it to generate the FK + typed navigation instead of a bare FK field + hand-written joins.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "cardinality", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Cardinality of the relationship target (e.g. 'one', 'many', 'many-to-one')." + }, + { + "name": "objectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')." + }, + { + "name": "onDelete", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on parent delete. Default derives from subtype (composition→cascade, aggregation→set-null, association→restrict)." + }, + { + "name": "onUpdate", + "type": "string", + "required": "no", + "default": "", + "allowed": "`cascade`, `set-null`, `restrict`, `no-action`", + "provider": "metaobjects-core-types", + "description": "Referential action on key update. Default cascade." + }, + { + "name": "sourceRefField", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Disambiguates which reference/FK field a relationship uses when more than one candidate exists: on a directed self-join M:N it names the junction's source-side reference (mutually exclusive with @symmetric), and on a @cardinality:'one' relationship it names which of several identity.reference nodes onto the same target the relationship navigates when name-pairing does not resolve it uniquely." + }, + { + "name": "symmetric", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Undirected self-join flag (union-on-read). Valid only when @objectRef == the declaring entity. Mutually exclusive with @sourceRefField." + }, + { + "name": "through", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Junction (through) entity name for M:N relationships — a third entity declaring two identity.reference children, one per FK side. The relationship's FK fields are derived from those references." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/requirement.md.json b/fixtures/metamodel-docs/data/types/requirement.md.json new file mode 100644 index 0000000000..f4dc3774db --- /dev/null +++ b/fixtures/metamodel-docs/data/types/requirement.md.json @@ -0,0 +1,187 @@ +{ + "family": "requirement", + "sections": [ + { + "typeSubType": "requirement.architectural", + "description": "How the system is built, applied uniformly across the model. Its check is UNIVERSALITY, the opposite polarity to a functional requirement. What `meta verify` enforces is that a live or partial policy is applied at all — one claiming nothing is an error — not that each node it claims complies. Flat by default and object-independent; it may optionally sit in a levelled tree when a quality taxonomy is being used to organise non-functional requirements.", + "hasOwner": true, + "owner": "metaobjects-requirements", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Something exists because every entity here looks like this — a uuid primary key, an @autoSet createdAt, a change-attribution column, tenant scoping. The discriminator is mechanical: did this exist because someone asked for something, or because it is the architecture? For a non-functional tree, an established quality taxonomy makes a good fixed upper structure (e.g. an ISO/IEC 25010 characteristic at L1, its sub-characteristic or a control-catalogue category at L2), with the model-binding claims at L4 and L5 as usual.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "counterexample", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "What breaking it looks like — the node that would contradict it. A STATIC falsifiability test, not a state. This is what makes universality checkable. Renamed from @violation in 0.24.0, which read as a status." + }, + { + "name": "disposition", + "type": "string", + "required": "no", + "default": "", + "allowed": "`accepted`, `deferred`", + "provider": "metaobjects-requirements", + "description": "As on requirement.functional. On an architectural requirement, accepted is the common and important case: a policy that is genuinely not universal, where the exceptions are known and tolerated, is more honest as partial+accepted than as a live claim nobody audits." + }, + { + "name": "implementedBy", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "FQN references to the nodes applying this policy. High fan-out is normal and expected: one uuid-primary-key requirement is claimed by every entity." + }, + { + "name": "level", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "OPTIONAL here, unlike on a functional requirement where it is required. ABSENT means a flat, object-independent policy that may reference the model directly — the original and still the default form. PRESENT means this node sits in a levelled tree, and then the same rules as functional apply: nesting must agree with the level, and only L4/L5 may carry @implementedBy. Levelling is opt-in so that adding a taxonomy on top of existing flat policies does not invalidate them." + }, + { + "name": "statement", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "The policy, in one sentence." + }, + { + "name": "status", + "type": "string", + "required": "yes", + "default": "", + "allowed": "`planned`, `live`, `partial`, `retired`", + "provider": "metaobjects-requirements", + "description": "As on requirement.functional. A live or partial architectural requirement claimed by NOTHING is an error: a policy declared and applied to nothing. planned is exempt from that check — it is not applied yet by definition — and retired is exempt because a withdrawn policy governs nothing." + }, + { + "name": "supersededBy", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "The requirement that REPLACED this one. Legal on @status: retired only (ERR_REQUIREMENT_SUPERSEDED_BY_NOT_RETIRED otherwise), and RESOLVED like any other reference, so a dangling one is ERR_REQUIREMENT_DANGLING_REF and a supersession chain stays walkable: A names B, and when B is retired in turn it names C. That resolution is the whole point — 0.24.0 deregistered an unresolved string, and the 2026-08-10 ruling had asked for the resolving form (point 4) which was never built. A prose note in @notes points one hop and goes stale; this does not." + }, + { + "name": "trackedBy", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "As on requirement.functional. Issue or ticket references for outstanding work; free-form, not resolved." + } + ], + "hasChildren": true, + "children": [ + "`requirement.*` — 0..*" + ], + "hasParents": false + }, + { + "typeSubType": "requirement.functional", + "description": "What the product does for a user, stated as one violable claim. Its check is EXISTENCE, run by `meta verify`: a live or partial claim with no implementing node anywhere in its subtree is a warning, and a named node that no longer exists is an error. Hierarchy is nesting — an L1 solution contains its L2 segments, which contain L3 services, and so on down to the levels that reference the model.", + "hasOwner": true, + "owner": "metaobjects-requirements", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Something exists because someone asked for it. L1-L3 are levels of ABSTRACTION AND OWNERSHIP in the problem domain — whose need is this, and at what altitude — and are never a directory, package, deployable or module. Binding to technical constructs happens only at L4 (an object) and L5 (a member), which is the allocation step. Test every node: if a refactor that changes no behaviour would force it to move, its level is wrong.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "counterexample", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "What breaking it looks like, in one sentence — a STATIC falsifiability test, authored once, never a state. A requirement MUST be violable: 'every entity has a uuid primary key' is (point at one with a composite string key); 'things are persisted' is not, and is a description rather than a requirement. Renamed from @violation in 0.24.0, which read as a status." + }, + { + "name": "disposition", + "type": "string", + "required": "no", + "default": "", + "allowed": "`accepted`, `deferred`", + "provider": "metaobjects-requirements", + "description": "What has been DECIDED about outstanding work — a different question from whether the work is done, which is what @status answers. accepted: the gap is understood and deliberately not being closed. deferred: it will be closed, but not now. ABSENT MEANS UNDECIDED, which is a real and useful state — it is what an unreviewed gap looks like, and it is the one a review should be able to find. Meaningful on planned and partial only; on a status with no outstanding work it is a WARNING. Deliberately NOT a workflow vocabulary: which sprint, who owns it and whether it is in progress belong in the tracker named by @trackedBy, because two systems holding that answer will drift and only one of them is refreshed daily." + }, + { + "name": "implementedBy", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "FQN references to the model nodes realising this requirement. Legal on level 4 (an object) and level 5 (a field, view or identity) only; an organisational level carrying it is ERR_REQUIREMENT_LINK_ABOVE_FLOOR. Many-to-many by construction — several requirements may name the same node." + }, + { + "name": "level", + "type": "int", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "1 solution, 2 segment, 3 service, 4 object, 5 member. L1-L3 are levels of abstraction and ownership in the problem domain, NOT of code structure. Nesting depth must agree with it; skipping a level is legal, going back up is not." + }, + { + "name": "statement", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "What the capability is, in one sentence." + }, + { + "name": "status", + "type": "string", + "required": "yes", + "default": "", + "allowed": "`planned`, `live`, `partial`, `retired`", + "provider": "metaobjects-requirements", + "description": "planned intended but not built yet; live implemented and in use; partial implemented with known gaps; retired BUILT THEN DELIBERATELY REMOVED — it must not be rebuilt. A requirement is PRESCRIPTIVE: it states what SHOULD be true and never journals what happened, and retired satisfies that because it states a prohibition in force, falsifiable by the capability reappearing. On retired, @implementedBy is REFUSED at load (ERR_REQUIREMENT_RETIRED_HAS_IMPLEMENTORS) — a retired capability has no implementation by definition, so its references cannot dangle because they cannot exist; @supersededBy names the requirement that replaced it. A dangling @implementedBy is an ERROR on live/partial (the model moved, the requirement is stale) and ALLOWED on planned, where the nodes do not exist YET. Neither planned nor retired contributes to object coverage: planning a capability must not silence the warning that nothing implements it, and neither must retiring one." + }, + { + "name": "supersededBy", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "The requirement that REPLACED this one. Legal on @status: retired only (ERR_REQUIREMENT_SUPERSEDED_BY_NOT_RETIRED otherwise), and RESOLVED like any other reference, so a dangling one is ERR_REQUIREMENT_DANGLING_REF and a supersession chain stays walkable: A names B, and when B is retired in turn it names C. That resolution is the whole point — 0.24.0 deregistered an unresolved string, and the 2026-08-10 ruling had asked for the resolving form (point 4) which was never built. A prose note in @notes points one hop and goes stale; this does not." + }, + { + "name": "trackedBy", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-requirements", + "description": "Issue or ticket references for outstanding work — a URL, an owner/repo#123 shorthand, or a tracker key. Free-form and NOT resolved by verify, which does not reach the network; nothing here is checked to exist. Its job is to stop a deferred gap becoming invisible, so verify warns when a deferred requirement names no ticket. Also the right place to link the ticket that a planned requirement will be built under." + } + ], + "hasChildren": true, + "children": [ + "`requirement.*` — 0..*" + ], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/segment.md.json b/fixtures/metamodel-docs/data/types/segment.md.json new file mode 100644 index 0000000000..d699b31c7d --- /dev/null +++ b/fixtures/metamodel-docs/data/types/segment.md.json @@ -0,0 +1,31 @@ +{ + "family": "segment", + "sections": [ + { + "typeSubType": "segment.filter", + "description": "A named, reusable row filter on the declaring entity (FR-044). Measures and reports reference it by name; exporters emit it as a named segment.", + "hasOwner": true, + "owner": "metaobjects-reporting", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "The same filter (e.g. 'active purchase') would otherwise be repeated in several measures or reports.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "filter", + "type": "filter", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-reporting", + "description": "The row scope: a portable attr.filter over the declaring entity's fields. May use relative-date values." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/source.md.json b/fixtures/metamodel-docs/data/types/source.md.json new file mode 100644 index 0000000000..911d343b0c --- /dev/null +++ b/fixtures/metamodel-docs/data/types/source.md.json @@ -0,0 +1,137 @@ +{ + "family": "source", + "sections": [ + { + "typeSubType": "source.base", + "description": "Abstract base source — the shared root subtype for declaring where an object's data lives (Project E). The base carries no attrs of its own; the concrete paradigm subtype (rdb) carries the physical-storage attrs, which are contributed by the db domain provider. Not authored directly: a `source.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "source.rdb", + "description": "The relational-database paradigm source (ADR-0007): binds an object to a physical relational object. Its physical name is the @table attr (not the structural `name`), and read-only-ness is DERIVED from @kind — table is writable; view, materializedView, storedProc, and tableFunction are read-only. The @table/@kind/@role/@schema/@parameterRef attrs are contributed by the db domain provider, not by core-types.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "ADR-0007: source declares where an object's data lives; rdb is the relational paradigm subtype. An object may declare multiple sources, distinguished by @role, with exactly ONE @role: \"primary\" per object (write-through CQRS: a writable table for writes plus a read-only view for reads). The physical name is the @table attr (or the @kind-matching alias), never the structural `name`. Read-only-ness is derived from @kind (table → writable; view / materializedView / storedProc / tableFunction → read-only). The pre-v2 dbTable / dbView subtypes are retired.", + "hasWhenToUse": true, + "whenToUse": "The entity is backed by a relational table or view. Set @table/@kind — the default persistence source for any entity.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "function", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical SQL table-function name for source.rdb @kind: \"tableFunction\". Same internal slot as @table." + }, + { + "name": "kind", + "type": "string", + "required": "no", + "default": "", + "allowed": "`table`, `view`, `materializedView`, `storedProc`, `tableFunction`", + "provider": "metaobjects-db", + "description": "The kind of database object this source represents: table (default, writable), view, materializedView, storedProc, or tableFunction. Non-table kinds are read-only." + }, + { + "name": "materializedView", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical SQL materialized-view name for source.rdb @kind: \"materializedView\". Same internal slot as @table." + }, + { + "name": "parameterRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "FR-015: name or FQN of an object.value describing the input shape of this source's callable interface. Permitted on @kind: \"storedProc\" / \"tableFunction\"; rejected on non-callable kinds (table / view / materializedView). Field children of the referenced object.value become the call-site parameter list in declaration order. Symmetric with template.@payloadRef in FR-004 — the typed-input pattern reuses object.value rather than minting a new parameter.* node type." + }, + { + "name": "proc", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical SQL stored-procedure name for source.rdb @kind: \"storedProc\". Same internal slot as @table." + }, + { + "name": "role", + "type": "string", + "required": "no", + "default": "", + "allowed": "`primary`, `replica`", + "provider": "metaobjects-db", + "description": "Role this source plays when an object has multiple sources: primary (default, system of record) or replica. The former members index, cache, publish and mirror are reserved-not-registered (ADR-0007 Amendment 2): a role member enters the registry only when a shipping consumer dispatches on it." + }, + { + "name": "schema", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Optional database schema name (e.g. 'catalog', 'public'). Postgres defaults to 'public'; SQLite rejects any non-default value." + }, + { + "name": "sql", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "FR-024/#208 escape valve — a hand-written SQL body the tool REGISTERS + fingerprints + drift-checks but never authors or parses. The body goes INSIDE `CREATE AS …` (never the CREATE wrapper, never the object name). Legal only on a read-only kind (not @kind: table); migrate lowers it on @kind: view (matview/proc/tableFunction: registered but not yet migrate-managed). Mutually exclusive with @unmanaged; forbids origin.* children (two sources of truth)." + }, + { + "name": "table", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical SQL table name for source.rdb @kind: \"table\" (default). FR-016: Defaults from the source's bare structural `name` under the project's naming.tables rule (the \"naming\" setting in .metaobjects/config.json) when omitted, then from the owning entity's name. Pre-1.0 legacy spelling for view/materializedView/storedProc/tableFunction kinds during the transition; canonical-serializer rewrites to the kind-matching alias." + }, + { + "name": "unmanaged", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "FR-024/#208 escape valve — this DB object is managed elsewhere (Flyway / a hand-migration owns its DDL). meta migrate does NOT create, drop, or drift-check it; verify --db reports it as external (declared). Legal on any @kind including table (the externally-managed-entity case). Mutually exclusive with @sql." + }, + { + "name": "view", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "Physical SQL view name for source.rdb @kind: \"view\". Same internal slot as @table." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/template.md.json b/fixtures/metamodel-docs/data/types/template.md.json new file mode 100644 index 0000000000..12bc221e50 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/template.md.json @@ -0,0 +1,335 @@ +{ + "family": "template", + "sections": [ + { + "typeSubType": "template.base", + "description": "Abstract base template — the shared root subtype for the fourth pillar (FR-004, ADR-0011). A template is a typed payload bound to either a rendered text artifact (prompt/output) or a tool-call envelope. The base carries no attrs of its own; concrete subtypes add their reference + governance attrs. Not authored directly: a `template.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "A single MetaTemplate node class backs every template subtype (no subType→class dispatch); the subtype selects which reserved-attr set applies. @format (a closed-enum ATTRIBUTE, never a subtype) drives the render engine's escaper/whitespace behavior, so a new format costs one escaper + one enum value rather than a new subtype + cross-language port.", + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "template.output", + "description": "An output / serialization template (FR-004): every rendered artifact other than an LLM prompt — a document (email, export, docs, config) or an email. Carries the generic reference + governance attrs and the @kind + email part-refs. OUTBOUND ONLY (ADR-0052) — it renders, and generates no parser.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "output is either a document (@kind=\"document\" or absent → renders @textRef in @format to one string) or an email (@kind=\"email\" → renders subject + html + optional text to a structured EmailDocument). The cross-field presence rule is enforced in the loader's validateTemplatePayloadRefs pass: document requires @textRef; email requires @subjectRef AND @htmlBodyRef (with @textBodyRef optional) and carries NO @textRef. @format is a closed enum keyed by the render engine's escaper. template.output is OUTBOUND ONLY (ADR-0052): it emits a render helper and nothing that reads a model's reply — the parser-on-receipt, the tolerant extract and the FR-010 response-format fragment all belong to template.prompt @responseRef.", + "hasWhenToUse": true, + "whenToUse": "You render a document/email/serialized output from typed data. Declare an output template so the {{fields}} are drift-checked against the payload VO at build time. To parse a model's reply instead, declare @responseRef on the template.prompt that elicits it — never a template.output.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "format", + "type": "string", + "required": "no", + "default": "`text`", + "allowed": "`text`, `html`, `xml`, `csv`, `json`, `markdown`, `spreadsheet`", + "provider": "metaobjects-core-types", + "description": "Output format; drives the render engine's escaping/whitespace behavior." + }, + { + "name": "htmlBodyRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Email only: 2-layer logical reference (group/source) to the HTML body text. Required when @kind=\"email\"." + }, + { + "name": "kind", + "type": "string", + "required": "no", + "default": "`document`", + "allowed": "`document`, `email`", + "provider": "metaobjects-core-types", + "description": "Output shape: 'document' (renders @textRef in @format → one string) or 'email' (renders subject + html + optional text → a structured EmailDocument)." + }, + { + "name": "maxChars", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Size budget for the rendered output, in characters." + }, + { + "name": "owner", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Governance: the owner of this template." + }, + { + "name": "payloadRef", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Reference to the payload (a view-object / projection) this template renders against." + }, + { + "name": "requiredTags", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Output tags the rendered text must contain (drives the verify output-tag check)." + }, + { + "name": "since", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Governance: the version this template was introduced in." + }, + { + "name": "subjectRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Email only: 2-layer logical reference (group/source) to the subject-line text. Required when @kind=\"email\"." + }, + { + "name": "textBodyRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Email only: 2-layer logical reference (group/source) to the optional plain-text alternative body." + }, + { + "name": "textRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "2-layer logical reference (group/source) to the body text, resolved by a provider at render time." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "template.prompt", + "description": "An LLM-targeted renderable prompt template (FR-004). Carries the generic reference + governance attrs plus the LLM overlay (@maxTokens / @requiredSlots / @model / @responseRef). Its renderable body is required via @textRef. A prompt declaring @responseRef also owns the INBOUND half (ADR-0052): the parser-on-receipt, the FR-010 response-format fragment (@promptStyle), and the reply syntax (@responseFormat).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "prompt requires @payloadRef (the typed payload it renders against) AND @textRef (the body text, provider-resolved at render time — enforced in the loader's validateTemplatePayloadRefs pass, not at the attr layer where @textRef is relaxed to optional so template.output email can omit it). @format is the syntax of the rendered PROMPT body, a closed enum keyed by the render engine's escaper; @responseFormat (ADR-0053) is the syntax of the model's REPLY. @responseRef (optional) names the response value-object the prompt expects, drives typed LLM-call trace derivation, and is the sole gate on the inbound codegen tier — which keys on its presence, never on a format value.", + "hasWhenToUse": true, + "whenToUse": "You are sending text to an LLM. Declare a prompt template with a typed payload so the prompt is versioned, drift-checked against its fields, and cache-stable — instead of string-building it in code. Add @responseRef when you also want the reply parsed into a typed shape.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "format", + "type": "string", + "required": "no", + "default": "`text`", + "allowed": "`text`, `html`, `xml`, `csv`, `json`, `markdown`, `spreadsheet`", + "provider": "metaobjects-core-types", + "description": "Output format; drives the render engine's escaping/whitespace behavior." + }, + { + "name": "maxChars", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Size budget for the rendered output, in characters." + }, + { + "name": "maxTokens", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Token budget for the rendered prompt (LLM-specific)." + }, + { + "name": "model", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Target model id (LLM-specific)." + }, + { + "name": "owner", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Governance: the owner of this template." + }, + { + "name": "payloadRef", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Reference to the payload (a view-object / projection) this template renders against." + }, + { + "name": "promptStyle", + "type": "string", + "required": "no", + "default": "`guide`", + "allowed": "`guide`, `inline`, `exampleOnly`", + "provider": "metaobjects-core-types", + "description": "FR-010 response-format fragment presentation: 'guide' (prose list + example), 'inline' (inline placeholders / enum choices), or 'exampleOnly' (filled skeleton). Guidance is never emitted as comments." + }, + { + "name": "requiredSlots", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Slots that must resolve at render time (drives the verify check)." + }, + { + "name": "requiredTags", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Output tags the rendered text must contain (drives the verify output-tag check)." + }, + { + "name": "responseFormat", + "type": "string", + "required": "no", + "default": "`json`", + "allowed": "`json`, `xml`", + "provider": "metaobjects-core-types", + "description": "ADR-0053: the syntax of the model's REPLY, read by the parser-on-receipt and the FR-010 response-format fragment. Distinct from @format, which is the syntax of the rendered PROMPT body. Two members because two is what every shipping consumer dispatches on; the other @format members are reserved-not-registered." + }, + { + "name": "responseRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Optional ref to the response value-object this prompt expects (peer of @payloadRef; drives typed LLM-call trace derivation). Its presence is the sole gate on the inbound codegen tier (ADR-0052): parser-on-receipt, tolerant extract, and the FR-010 response-format fragment." + }, + { + "name": "since", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Governance: the version this template was introduced in." + }, + { + "name": "textRef", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "2-layer logical reference (group/source) to the body text, resolved by a provider at render time." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "template.toolcall", + "description": "A vendor-agnostic LLM tool-call envelope (ADR-0011). Unlike prompt/output it has NO renderable text body — the body IS the structured output schema resolved via @payloadRef. This is why toolcall is its own subtype rather than template.output + @toolName. Does NOT inherit the generic attrs.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "toolcall requires @toolName (the wire tool name surfaced to the LLM) AND @payloadRef (the output value-object the tool produces). @textRef is intentionally absent — a tool-call has no renderable text. Core keeps toolcall vendor-agnostic; vendor wire details (retry semantics, fallback shapes, parallel invocation, cache hints) are added by consumer providers via registry.extend(TYPE_TEMPLATE, \"toolcall\", { attributes: [...] }). The LLM-facing tool description reuses the @description documentation common attr (added to every type by docProvider), so it is not redeclared here.", + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "maxTokens", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Per-call token budget for the tool-call's structured response (LLM-specific). Vendor-agnostic config; peer of @maxTokens on template.prompt (#237)." + }, + { + "name": "owner", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Governance: the owner of this toolcall." + }, + { + "name": "payloadRef", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Output value-object the tool produces (resolved against the metamodel)." + }, + { + "name": "since", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Governance: the version this toolcall was introduced in." + }, + { + "name": "toolName", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Wire tool name surfaced to the LLM (vendor-specific format)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/transition.md.json b/fixtures/metamodel-docs/data/types/transition.md.json new file mode 100644 index 0000000000..b77aa54eba --- /dev/null +++ b/fixtures/metamodel-docs/data/types/transition.md.json @@ -0,0 +1,102 @@ +{ + "family": "transition", + "sections": [ + { + "typeSubType": "transition.action", + "description": "An allowed move between two values of a `field.enum`, made by an operation (ADR-0066). A `field.enum` with at least one is a lifecycle, named after the field. Its states are the enum's @values, its initial state the enum's @default, its terminal states the members no transition leaves; none of them has vocabulary of its own. Each transition is held to become a guarded update (`... WHERE id = ? AND IN (@from) [AND @condition]`), its own command when no declared operation claims it, its own permission point and its own wire error. No shell is generated yet: nothing is generated from this vocabulary, and the loader and `verify` only check it. Experimental since 1.3.0: the shape may change in a MINOR, including removals and renames (docs/compatibility-policy.md).", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": true, + "rules": "Legal only under a `field.enum` of an `object.entity` (ERR_TRANSITION_NOT_ON_ENTITY). A concrete entity with a lifecycle and a source needs a writable one (ERR_TRANSITION_NOT_ON_ENTITY); on an entity with no source the lifecycle loads and is inert, deriving no command until a source is added. The field must declare @default (ERR_LIFECYCLE_NO_INITIAL). The field is not an array, and @from names at least one state (ERR_BAD_ATTR_VALUE). Names are unique across every lifecycle of the entity, compared without case, and may not be create, get, list, update or delete in any case (ERR_TRANSITION_NAME_COLLISION). A transition belongs to the entity that declares its field and to every entity extending it, never to an entity whose field merely `extends` that field; an inheritor that redeclares the field without extending it is ERR_LIFECYCLE_REDECLARED.", + "hasWhenToUse": true, + "whenToUse": "A status field whose values may only change in certain ways: a request is submitted from draft, approved or rejected from submitted. Declare each allowed move here; once a shell is generated, the generic update path will no longer write the field. A move that leaves the state where it was (from submitted to submitted) records an action that changes nothing but still happened, such as a first approval of two.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "condition", + "type": "expression", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "A guard over the entity's own fields, in the attr.expression grammar: the same name, grammar and meaning as on the cross-field validators. The shell will evaluate it against the loaded row and also put it into the guarded update's WHERE (no shell is generated yet). It cannot read the actor; that is the policy's job. A field the entity does not have, or an expression that is not boolean, is ERR_BAD_ATTR_VALUE." + }, + { + "name": "from", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The states this move may start from: members of the parent enum's @values (ERR_TRANSITION_UNKNOWN_STATE otherwise), at least one (ERR_BAD_ATTR_VALUE when empty). The allowed moves are the business rule itself, so they cannot be computed." + }, + { + "name": "permission", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "As on an operation: the permission name the derived command for this transition will ask the policy about (no command is derived yet). A dotted identifier path, as on an operation. Absent and not @public: the derived name `..`, naming the concrete entity, so two entities' transitions of one name ask about different permissions. Read only when the transition derives its own command; a declared operation that claims it uses its own, and verify warns that this one is never read (WARN_TRANSITION_PERMISSION_SHADOWED)." + }, + { + "name": "public", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "As on an operation: the derived command will call no permission check (no command is derived yet). Declaring it with @permission is ERR_PERMISSION_PUBLIC_CONFLICT." + }, + { + "name": "to", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "The state this move ends in: one member of the parent enum's @values (ERR_TRANSITION_UNKNOWN_STATE otherwise). May equal a member of @from, which records an action that leaves the state where it was." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "transition.base", + "description": "Registry anchor for the attributes every lifecycle move shares (ADR-0054): not authorable.", + "hasOwner": true, + "owner": "metaobjects-rules", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "permission", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "As on an operation: the permission name the derived command for this transition will ask the policy about (no command is derived yet). A dotted identifier path, as on an operation. Absent and not @public: the derived name `..`, naming the concrete entity, so two entities' transitions of one name ask about different permissions. Read only when the transition derives its own command; a declared operation that claims it uses its own, and verify warns that this one is never read (WARN_TRANSITION_PERMISSION_SHADOWED)." + }, + { + "name": "public", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-rules", + "description": "As on an operation: the derived command will call no permission check (no command is derived yet). Declaring it with @permission is ERR_PERMISSION_PUBLIC_CONFLICT." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/validator.md.json b/fixtures/metamodel-docs/data/types/validator.md.json new file mode 100644 index 0000000000..c5f62ff119 --- /dev/null +++ b/fixtures/metamodel-docs/data/types/validator.md.json @@ -0,0 +1,582 @@ +{ + "family": "validator", + "sections": [ + { + "typeSubType": "validator.array", + "description": "Bounds the element count of an array-valued field via @min/@max.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Bound the element count of an array field. Use @min/@max instead of a hand-written length check.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "max", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)." + }, + { + "name": "min", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.atLeastOne", + "description": "Cardinality of presence: at least one of the named fields (@fields) must be present (NOT NULL). Entity-scoped; references fields by name (same @fields-by-name pattern as identity.*).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@fields names two or more fields of the owning entity. Satisfied when any one of them is non-null.", + "hasWhenToUse": true, + "whenToUse": "At least one of several fields must be present (email or phone). Declare it instead of hand-written OR-presence checks.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "condition", + "type": "expression", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The case this rule applies in: an expression over the owning entity's fields (the attr.expression grammar). Absent: always. The database CHECK is NOT (condition) OR (rule), so a row the condition does not hold for, or holds NULL for, is not checked. Enforced like the rule itself: by the database CHECK and, on create, by the generated record model in every port. Justified in ADR-0023 Amendment 1." + }, + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "fields", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Names of the candidate fields; at least one must be present." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.base", + "description": "Abstract base validator — the shared root subtype concrete validators specialize. Carries the @min/@max bounds attrs but enforces no rule of its own. Not authored directly: a `validator.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "max", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)." + }, + { + "name": "min", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.comparison", + "description": "Cross-field ordering: requires two sibling fields of the owning entity stand in a relational order (@left @op @right), e.g. current_hp <= max_hp or expires_at > created_at. Entity-scoped; references fields by name. Backends derive the rule (CHECK constraint, cross-field assertion) — no raw expression is stored.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@left and @right must name fields of the owning entity. @op is one of gt/gte/lt/lte/ne/eq. The comparison is null-tolerant where the backend's relational operator is (SQL: a NULL operand yields no violation).", + "hasWhenToUse": true, + "whenToUse": "Two sibling fields must stand in an order (start <= end, currentHp <= maxHp). Declare it instead of hand-writing the cross-field assertion.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "condition", + "type": "expression", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The case this rule applies in: an expression over the owning entity's fields (the attr.expression grammar). Absent: always. The database CHECK is NOT (condition) OR (rule), so a row the condition does not hold for, or holds NULL for, is not checked. Enforced like the rule itself: by the database CHECK and, on create, by the generated record model in every port. Justified in ADR-0023 Amendment 1." + }, + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "left", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name of the left-hand field of the owning entity." + }, + { + "name": "op", + "type": "string", + "required": "yes", + "default": "", + "allowed": "`gt`, `gte`, `lt`, `lte`, `ne`, `eq`", + "provider": "metaobjects-core-types", + "description": "Relational operator: gt (>), gte (>=), lt (<), lte (<=), ne (<>), eq (=)." + }, + { + "name": "right", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name of the right-hand field of the owning entity." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.exactlyOne", + "description": "Cardinality of presence: exactly one of the named fields (@fields) is present (NOT NULL), and the others are null. Entity-scoped; references fields by name (same @fields-by-name pattern as identity.*). Justified in ADR-0023 Amendment 1.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@fields names two or more fields of the owning entity (ERR_BAD_ATTR_VALUE): one field would just be a required field. Satisfied when exactly one of them is non-null.", + "hasWhenToUse": true, + "whenToUse": "A row belongs to exactly one of several alternatives (a store or a kiosk, never both, never neither). Declare it instead of hand-written count-of-non-nulls checks.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "condition", + "type": "expression", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The case this rule applies in: an expression over the owning entity's fields (the attr.expression grammar). Absent: always. The database CHECK is NOT (condition) OR (rule), so a row the condition does not hold for, or holds NULL for, is not checked. Enforced like the rule itself: by the database CHECK and, on create, by the generated record model in every port. Justified in ADR-0023 Amendment 1." + }, + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "fields", + "type": "string[]", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Names of the alternative fields; exactly one must be present." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.length", + "description": "Bounds string length / collection size via @min/@max.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Bound a string's length or a collection's size. Use @min/@max instead of hand-written guards.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "max", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)." + }, + { + "name": "min", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.numeric", + "description": "Bounds a numeric value's magnitude via @min/@max.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "Bound a number's magnitude. Use @min/@max instead of hand-written range checks.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "max", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)." + }, + { + "name": "min", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.presentIff", + "description": "Biconditional presence: the target field (@field) is present (NOT NULL) if and only if the gating field (@when) equals @equals. Models paired flag/companion-column invariants, e.g. used_at present iff is_used=true. Entity-scoped; references fields by name.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@field and @when must name fields of the owning entity. @equals is rendered per @when's field subtype. Stricter than requiredWhen — also forbids @field when the condition is false.", + "hasWhenToUse": true, + "whenToUse": "A field must be present exactly when a condition holds, absent otherwise (biconditional). Declare it instead of hand-written presence logic.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "condition", + "type": "expression", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The case this rule applies in: an expression over the owning entity's fields (the attr.expression grammar). Absent: always. The database CHECK is NOT (condition) OR (rule), so a row the condition does not hold for, or holds NULL for, is not checked. Enforced like the rule itself: by the database CHECK and, on create, by the generated record model in every port. Justified in ADR-0023 Amendment 1." + }, + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "equals", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The gating value; @field is present exactly when @when equals this." + }, + { + "name": "field", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name of the field whose presence is governed by the condition." + }, + { + "name": "when", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name of the gating field." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.regex", + "description": "Requires the value match a regular expression (@pattern).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A string must match a pattern (email, slug, code). Set @pattern instead of hand-writing the regex test.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "max", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Maximum allowed value (length, numeric value, or array element count depending on the validator subtype)." + }, + { + "name": "min", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Minimum allowed value (length, numeric value, or array element count depending on the validator subtype)." + }, + { + "name": "pattern", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Regular expression the value must match." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.required", + "description": "Fails when the value is null (NOT NULL). Equivalent to @required on the owning field: on a non-array string, generated wire-tier input validation also rejects the empty string by default unless an explicit validator.length @min: 0 opts back to presence-only.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": true, + "whenToUse": "A field must be present (NOT NULL). Declare it instead of hand-writing a presence check.", + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "validator.requiredWhen", + "description": "One-directional conditional presence: when the gating field (@when) equals @equals, the target field (@field) must be present (NOT NULL); otherwise @field is unconstrained. Mirrors JSON Schema dependentRequired / Rails validates_presence_of :x, if:. Entity-scoped; references fields by name.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": true, + "rules": "@field and @when must name fields of the owning entity. @equals is the gating value, compared against @when's value (rendered per @when's field subtype — boolean true/false, enum/string literal, numeric literal).", + "hasWhenToUse": true, + "whenToUse": "A field becomes required only when another field has a given value. Declare it instead of conditional validation code.", + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "condition", + "type": "expression", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The case this rule applies in: an expression over the owning entity's fields (the attr.expression grammar). Absent: always. The database CHECK is NOT (condition) OR (rule), so a row the condition does not hold for, or holds NULL for, is not checked. Enforced like the rule itself: by the database CHECK and, on create, by the generated record model in every port. Justified in ADR-0023 Amendment 1." + }, + { + "name": "constraintName", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "The database name of the CHECK constraint this validator generates (numeric, length, regex and the cross-field validators; the others generate no CHECK). Absent: the derived
___chk. Lets a model adopt a database whose CHECKs were named by hand. RDB-physical — contributed by the db provider. Justified in ADR-0023 Amendment 1." + }, + { + "name": "dbCheck", + "type": "boolean", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-db", + "description": "On a numeric, length or regex validator, false generates no database CHECK (meta migrate and a generated EF model leave it out); the generated app-level validators still enforce it on every write. On a cross-field validator (comparison, requiredWhen, presentIff, atLeastOne), which only its CHECK enforces, false is refused (ERR_CROSS_FIELD_WITHOUT_CHECK). Absent: true. For a column whose legacy rows break the rule, which a CHECK would refuse on their next UPDATE even NOT VALID. Refused with @constraintName (ERR_CONSTRAINT_NAME_WITHOUT_CHECK). RDB-physical — contributed by the db provider." + }, + { + "name": "equals", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "The gating value; when @when equals this, @field must be present." + }, + { + "name": "field", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name of the field that becomes required when the condition holds." + }, + { + "name": "when", + "type": "string", + "required": "yes", + "default": "", + "allowed": "", + "provider": "metaobjects-core-types", + "description": "Name of the gating field whose value triggers the requirement." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + } + ] +} diff --git a/fixtures/metamodel-docs/data/types/view.md.json b/fixtures/metamodel-docs/data/types/view.md.json new file mode 100644 index 0000000000..f3d7835b0d --- /dev/null +++ b/fixtures/metamodel-docs/data/types/view.md.json @@ -0,0 +1,309 @@ +{ + "family": "view", + "sections": [ + { + "typeSubType": "view.base", + "description": "Abstract view base — the shared root subtype for field-level UI/render hints. A view declares how a field's value is rendered or edited; the base carries no attrs of its own. Not authored directly: a `view.base` node fails to load (ERR_ABSTRACT_SUBTYPE_AUTHORED) — this subtype is a registry anchor concrete subtypes inherit from, never a node in a document.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.checkbox", + "description": "Checkbox selection control.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.currency", + "description": "Currency display formatting (locale-aware via @locale).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": false, + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "locale", + "type": "string", + "required": "no", + "default": "`en-US`", + "allowed": "", + "provider": "metaobjects-ui", + "description": "BCP 47 locale code controlling currency display formatting. Defaults to 'en-US' when omitted." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.date", + "description": "Date picker / date display.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.dropdown", + "description": "Single-select dropdown control.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.hidden", + "description": "Not rendered; carried but not shown.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.hotlink", + "description": "Renders the value as a clickable link.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.image", + "description": "Image upload/display control; the field stores an opaque storage key (field.string).", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "accept", + "type": "string[]", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui-web", + "description": "Accepted MIME types (client guard; the server re-enforces)." + }, + { + "name": "aspectRatio", + "type": "double", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui-web", + "description": "Crop aspect ratio (width / height). Omit for freeform." + }, + { + "name": "maxBytes", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui-web", + "description": "Client-side size ceiling in bytes." + }, + { + "name": "maxEdge", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui-web", + "description": "Longest-edge bound in px for the re-encoded output." + }, + { + "name": "store", + "type": "string", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui-web", + "description": "Opaque storage-namespace hint passed to the upload adapter (not infrastructure)." + } + ], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.month", + "description": "Month picker / month display.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.number", + "description": "Numeric input control.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.password", + "description": "Masked input for sensitive values.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.radio", + "description": "Radio-button selection control.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.text", + "description": "Single-line text input/display.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": false, + "attrs": [], + "hasChildren": false, + "children": [], + "hasParents": false + }, + { + "typeSubType": "view.textarea", + "description": "Multi-line text area.", + "hasOwner": true, + "owner": "metaobjects-core-types", + "hasImplementedIn": true, + "implementedIn": "typescript", + "hasRules": false, + "hasWhenToUse": false, + "hasExample": false, + "hasAttrs": true, + "attrs": [ + { + "name": "rows", + "type": "int", + "required": "no", + "default": "", + "allowed": "", + "provider": "metaobjects-ui-web", + "description": "Visible row count for the generated