From 4b8f5f39110b59fe0667953dfb82bf171b1fc155 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Sep 2026 11:09:46 +0000 Subject: [PATCH] docs(field-types): give `unique` its real scope vocabulary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Universal Field Properties row typed `unique` as `boolean` with the one-line description "Enforce uniqueness". The contract has been `boolean | 'global' | 'organization'` since ADR-0120 D1, so the table hid two of the three spellings — a reader who trusted it could not express `'global'` at all, and was contradicted by this same page's own example at :50, which passes `unique: 'organization'`. The type cell now matches the generated reference (`content/docs/references/data/field.mdx`) spelling for spelling, and the description points at the `FieldSchema` doc block rather than restating a rule that regenerates elsewhere — the convention the sibling `multiple` row on this table already uses. The default cell is deliberately left at `false`. Measured against this tree: `FieldSchema.parse({ type: 'autonumber', ... })` with `unique` omitted resolves to `false`, exactly as `text` does. The card asked for a type-conditional default (`'organization'` on `autonumber`) predicated on #13894, which has not landed. Documenting it would assert a default the schema does not implement. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_012zGPuVVX3deAx9LdjK8jCk --- content/docs/data-modeling/field-types.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/data-modeling/field-types.mdx b/content/docs/data-modeling/field-types.mdx index a36909f1d2..826b8d69ba 100644 --- a/content/docs/data-modeling/field-types.mdx +++ b/content/docs/data-modeling/field-types.mdx @@ -652,7 +652,7 @@ These properties are available on **all** field types: | `description` | `string` | — | Field description / help text | | `type` | `FieldType` | **required** | One of the supported field types | | `required` | `boolean` | `false` | Whether the field is required | -| `unique` | `boolean` | `false` | Enforce uniqueness | +| `unique` | `boolean \| 'global' \| 'organization'` | `false` | Unique constraint **and its scope** (ADR-0120). `'organization'` = one holder per organization; `true` = that same per-organization scope (positional synonym — prefer the explicit spelling in new code); `'global'` = one holder across the whole installation; `false` = no constraint. `'tenant'`/`'org'` are rejected — the word is `'organization'`. Full rule in the `unique` doc block in [`FieldSchema`](/docs/references/data/field) | | `multiple` | `boolean` | `false` | Allow array of values (multi-record lookup, multi-select, multi-file). An emptied multi-value lookup reads back as `[]`, never `null` — the `multiple` doc block in [`FieldSchema`](/docs/references/data/field) | | `searchable` | `boolean` | `false` | Include in search index | | `sortable` | `boolean` | `true` | Allow sorting by this field |