Skip to content

Commit 22a570e

Browse files
committed
更新元数据文档,添加新字段类型(如 email、phone、url、file、image、location)及其属性,增强字段验证功能
1 parent c0dc1ca commit 22a570e

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

docs/METADATA.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,56 @@ fields:
108108

109109
| Type | Description | Specific Properties |
110110
| :--- | :--- | :--- |
111-
| `text` | Single line text. | |
112-
| `textarea` | Multiline text. | |
113-
| `html` | Rich text content. | |
114-
| `number` | Numeric value (integer or float). | `precision` (total digits) |
115-
| `currency` | Monetary value. | `scale` (decimal places) |
116-
| `percent` | Percentage value (0-100 or 0-1). | `scale` (decimal places) |
111+
| **Basic Types** | | |
112+
| `text` | Single line text. | `min_length`, `max_length`, `regex` |
113+
| `textarea` | Multiline text. | `rows`, `min_length`, `max_length` |
114+
| `markdown` | Markdown formatted text. | |
115+
| `html` | Rich text content (HTML). | |
116+
| `number` | Numeric value (integer or float). | `precision`, `min`, `max` |
117+
| `currency` | Monetary value. | `scale`, `min`, `max` |
118+
| `percent` | Percentage value (0-1). | `scale`, `min`, `max` |
117119
| `boolean` | `true` or `false`. | |
120+
| **System/Format Types** | | |
121+
| `email` | Email address with validation. | |
122+
| `phone` | Phone number formatting. | |
123+
| `url` | Web URL validation. | |
124+
| `password` | Encrypted or masked string. | |
125+
| **Date & Time** | | |
118126
| `date` | Date only (YYYY-MM-DD). | |
119127
| `datetime` | Date and time (ISO string). | |
120-
| `password` | Encrypted or masked string. | |
128+
| `time` | Time only (HH:mm:ss). | |
129+
| **Complex/Media** | | |
130+
| `file` | File attachment (stored as JSON). | `multiple` |
131+
| `image` | Image attachment (stored as JSON). | `multiple` |
132+
| `avatar` | User avatar image. | |
133+
| `location` | Geolocation (lat/lng JSON). | |
134+
| **Relationships** | | |
121135
| `select` | Selection from a list. | `options`, `multiple` |
122136
| `lookup` | Reference to another object. | `reference_to`, `multiple` |
123137
| `master_detail` | Strong ownership relationship. | `reference_to` (Required) |
138+
| **Advanced** | | |
124139
| `formula` | Read-only calculated field. | `expression`, `data_type` |
125140
| `summary` | Roll-up summary of child records. | `summary_object`, `summary_type`, `summary_field`, `summary_filters` |
126141
| `auto_number` | Auto-incrementing unique identifier. | `auto_number_format` |
127142
| `object` | JSON object structure. | |
128143
| `grid` | Array of objects/rows. | |
129144

145+
### 4.6 Field Attributes
146+
147+
| Attribute | Type | Description |
148+
| :--- | :--- | :--- |
149+
| `required` | `boolean` | If true, database enforces NOT NULL. |
150+
| `unique` | `boolean` | If true, database enforces UNIQUE constraint. |
151+
| `readonly` | `boolean` | UI hint: Field should not be editable by users. |
152+
| `hidden` | `boolean` | UI/API hint: Field should be hidden by default. |
153+
| `defaultValue` | `any` | Default value on creation. |
154+
| `help_text` | `string` | Tooltip for end-users. |
155+
| `multiple` | `boolean` | Allows multiple values (stored as JSON array). |
156+
| `min`, `max` | `number` | Range validation for numeric types. |
157+
| `min_length`, `max_length` | `number` | Length validation for text types. |
158+
| `regex` | `string` | Custom regular expression validation. |
159+
160+
130161
### 4.3 Relationship Fields
131162

132163
Key properties for `lookup` or `master_detail`:

0 commit comments

Comments
 (0)