@metaobjectsdev/sdk 0.19.0-rc.1 → 0.19.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -216,6 +216,31 @@ name), `@default`, `@filterable`, `@sortable`. On temporal fields
|
|
|
216
216
|
(`field.date`/`field.time`/`field.timestamp`) `@autoSet` stamps the value
|
|
217
217
|
automatically — see the `@autoSet` callout under Timestamps below.
|
|
218
218
|
|
|
219
|
+
#### What `@required` actually means
|
|
220
|
+
|
|
221
|
+
`@required: true` is **NOT NULL** (presence). Two consequences that are easy to
|
|
222
|
+
get wrong:
|
|
223
|
+
|
|
224
|
+
1. **On a non-array string it also rejects `""` — but only at the wire tier.**
|
|
225
|
+
Generated *input* validation (the create/patch models behind POST/PATCH)
|
|
226
|
+
rejects the empty string by default; whitespace-only IS accepted. Generated
|
|
227
|
+
in-process read models never enforce this at construction, so reading an
|
|
228
|
+
existing row containing `""` does not throw.
|
|
229
|
+
2. **To say "must be provided, but may be empty", author an explicit
|
|
230
|
+
`validator.length` with `@min: 0`.** An explicitly authored `@min` is always
|
|
231
|
+
authoritative over that implicit non-empty floor; the floor applies only when
|
|
232
|
+
no `@min` is authored at all. Dropping `@required` is NOT the way to express
|
|
233
|
+
this — that makes the field optional and loses presence typing.
|
|
234
|
+
|
|
235
|
+
```jsonc
|
|
236
|
+
// must be provided; empty string allowed
|
|
237
|
+
{ "field.string": { "name": "note", "@required": true, "children": [
|
|
238
|
+
{ "validator.length": { "name": "noteLen", "@min": 0 } }
|
|
239
|
+
]}}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Arrays are unaffected: `@required` on an array field is presence only.
|
|
243
|
+
|
|
219
244
|
### Choosing the right shape — the general decision procedure (ADR-0037)
|
|
220
245
|
|
|
221
246
|
This procedure decides the shape of **any** concept entering the metamodel — a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metaobjectsdev/sdk",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.1-rc.1",
|
|
4
4
|
"description": "Workspace helpers and agent-docs utilities for MetaObjects projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@metaobjectsdev/metadata": "0.19.
|
|
59
|
+
"@metaobjectsdev/metadata": "0.19.1-rc.1",
|
|
60
60
|
"zod": "^3.23.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|