Skip to content

Commit 245e161

Browse files
committed
docs(data-modeling): stop crediting field format with validation
The write-time record validator keys its email/url/phone shape checks on the field `type` and never reads a field's `format`. Six hand-written rows (plus the quick-summary `text` row) said otherwise, and three declared a `format` default that does not exist. - `text` rows now say what the key is: a display hint read by the UI's cell-renderer resolver for a small word set, with no server-side check. - The `phone` gallery row promised a pattern nothing implements; removed. - `email` / `url` / `phone` validation tables list the bounds the validator does enforce and say the shape check keys on `type`. Claude-Session: https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv Co-authored-by: Claude <noreply@anthropic.com>
1 parent 71ef221 commit 245e161

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎content/docs/data-modeling/field-types.mdx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Single-line plain text input.
2121
|:---|:---|:---|:---|
2222
| `maxLength` | `number` | — | Maximum character length |
2323
| `minLength` | `number` | — | Minimum character length |
24-
| `format` | `string` | — | Validation format pattern |
24+
| `format` | `string` | — | Display hint, **not validation** — the server runs no check from it. The UI's cell-renderer resolver reads a small set of words and renders the cell as the richer type: `phone` / `tel` / `telephone` (a `tel:` link), `email` (a `mailto:` link), `url` / `uri` / `link` (a clickable link), `currency` / `money`, `percent` / `percentage`; any other word renders as plain text. To reject a malformed email, URL or phone number, use that field `type` instead, or a [`format` validation rule](/docs/data-modeling/validation#format-validation) |
2525
| `valueDomain` | `'iana_time_zone' \| 'iso_4217_currency' \| 'iso_3166_alpha2'` | — | Standard the written value must be a member of (IANA time zone, ISO 4217 currency code, ISO 3166-1 alpha-2 country code); `text` only |
2626

2727
```typescript
@@ -68,7 +68,6 @@ Phone number field.
6868
| Property | Type | Default | Description |
6969
|:---|:---|:---|:---|
7070
| `maxLength` | `number` | — | Maximum character length |
71-
| `format` | `string` | — | Phone format pattern |
7271

7372
```typescript
7473
{ name: 'phone', label: 'Phone', type: 'phone' }

‎content/docs/data-modeling/validation-rules.mdx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ These properties apply to **all** field types and are validated by the base `Fie
4343
|:---|:---|:---|:---|
4444
| `maxLength` | `number` | — | Rejects values exceeding character count |
4545
| `minLength` | `number` | — | Rejects values below character count |
46-
| `format` | `string` | — | Validates against format pattern (e.g., regex) |
46+
| `format` | `string` | — | **Not validated.** No write-time check reads it — a regex here is accepted and ignored. On `text` it is a display hint only (a small set of words such as `phone`, `email` or `url` promote the cell to a richer renderer; see the [Field Type Gallery](/docs/data-modeling/field-types)). To constrain the value's shape, use the `email` / `url` / `phone` field type or a [`format` validation rule](/docs/data-modeling/validation#format-validation) |
4747
| `valueDomain` | `'iana_time_zone' \| 'iso_4217_currency' \| 'iso_3166_alpha2'` | — | Constrains the written value to a published standard — an IANA time zone (judged by the `Intl.DateTimeFormat` probe, so `UTC` and `Asia/Kolkata` are members and `Europe/Munich` is not), an ISO 4217 currency code or an ISO 3166-1 alpha-2 country code (both exact uppercase). Membership, not shape: a pattern such as `^[A-Z]{2}$` admits `ZZ`; the domain does not. The same closed vocabulary and the same membership test as a settings specifier's `valueDomain`; a non-member is refused on the write path with the field error code `value_domain`. `text` only — declaring it on any other type is refused at parse. |
4848

4949
**Default constraints:** None. Unbounded text unless `maxLength` is set.
@@ -61,25 +61,28 @@ These properties apply to **all** field types and are validated by the base `Fie
6161

6262
| Property | Type | Default | Validation Behavior |
6363
|:---|:---|:---|:---|
64-
| `format` | `string` | `email` | Validates a basic `local@domain` shape |
64+
| `maxLength` | `number` | — | Rejects values exceeding character count |
65+
| `minLength` | `number` | — | Rejects values below character count |
6566

66-
**Default constraints:** Must contain an `@` and a domain with a dot — a lightweight pattern check, not full RFC 5322 validation.
67+
**Default constraints:** Must contain an `@` and a domain with a dot — a lightweight pattern check, not full RFC 5322 validation. The check is keyed on `type: 'email'` itself and has nothing to configure; a field-level `format` key is not read.
6768

6869
### `url`
6970

7071
| Property | Type | Default | Validation Behavior |
7172
|:---|:---|:---|:---|
72-
| `format` | `string` | `url` | Validates URL format (protocol required) |
73+
| `maxLength` | `number` | — | Rejects values exceeding character count |
74+
| `minLength` | `number` | — | Rejects values below character count |
7375

74-
**Default constraints:** Must be a valid URL with protocol prefix.
76+
**Default constraints:** Must be a valid URL with protocol prefix. The check is keyed on `type: 'url'` itself and has nothing to configure; a field-level `format` key is not read.
7577

7678
### `phone`
7779

7880
| Property | Type | Default | Validation Behavior |
7981
|:---|:---|:---|:---|
80-
| `format` | `string` | `phone` | Validates a permissive phone-number character set |
82+
| `maxLength` | `number` | — | Rejects values exceeding character count |
83+
| `minLength` | `number` | — | Rejects values below character count |
8184

82-
**Default constraints:** Accepts digits, `+ ( ) - .` and spaces (minimum 5 characters) — a lenient character-set check, not strict E.164 structural validation.
85+
**Default constraints:** Accepts digits, `+ ( ) - .` and spaces (minimum 5 characters) — a lenient character-set check, not strict E.164 structural validation. The check is keyed on `type: 'phone'` itself and has nothing to configure; a field-level `format` key is not read. For a stricter shape, add a [`format` validation rule](/docs/data-modeling/validation#format-validation) with a `regex`.
8386

8487
### `password`
8588

@@ -515,7 +518,7 @@ section above). See the
515518

516519
| Field Type | Required Props | Key Constraints |
517520
|:---|:---|:---|
518-
| `text` | — | `maxLength`, `minLength`, `format`, `valueDomain` |
521+
| `text` | — | `maxLength`, `minLength`, `valueDomain` (`format` is a display hint, not a constraint) |
519522
| `textarea` | — | `maxLength`, `minLength` |
520523
| `email` | — | Basic `local@domain` shape (not full RFC 5322) |
521524
| `url` | — | Valid URL with protocol |

0 commit comments

Comments
 (0)