Skip to content

Commit fc58a99

Browse files
docs(spec): describe() for SpecialOperator $null and $exists (#14048) (#15054)
SpecialOperatorSchema declared both members as bare z.boolean().optional() with a JSDoc comment and no .describe(), so the reference page's Description column -- filled from prop.description, the JSON-Schema projection of a Zod .describe() -- rendered both cells empty. The published page therefore said nothing about the operator pair whose meaning was the subject of a six-site correction campaign. Each member gains a .describe(); the JSDoc stays. Regenerating with check:generated --fix touched exactly two rows of content/docs/references/data/filter.mdx and nothing else. Prose only: no accept/reject or shape change, the JSON-Schema delta is a description string on two properties. Wording written against scripts/check-corpus-claim-drift.mjs rather than into it: its exists-key-presence row reads 4 sites before this diff and 4 after the page was regenerated. Claude-Session: https://claude.ai/code/session_0174WZTU6XcFcS7g2kykC53i Co-authored-by: Claude <noreply@anthropic.com>
1 parent 89eb997 commit fc58a99

3 files changed

Lines changed: 43 additions & 4 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
docs(spec): `SpecialOperator` gains the `.describe()` that puts `$null` / `$exists` on the reference page (#14048)
6+
7+
`SpecialOperatorSchema` declared both members as bare `z.boolean().optional()` with a
8+
JSDoc comment and no `.describe()`. `content/docs/references/data/filter.mdx` fills its
9+
Description column from `prop.description` — the JSON-Schema projection of a Zod
10+
`.describe()` — so both cells rendered **empty**, and the published reference page said
11+
nothing whatsoever about the two operators whose meaning was the subject of a six-site
12+
correction campaign (#13539, #13709). A reader could not learn from that page that
13+
`$exists` asks whether the field HAS A VALUE.
14+
15+
Each member now carries a `.describe()`; the JSDoc stays as the source of truth it
16+
already was and the describe restates it. The regenerated page gains exactly two
17+
Description cells (`filter.mdx:138-139`) and nothing else.
18+
19+
Prose only. No accept/reject or shape change: both members were and stay
20+
`z.boolean().optional()`, so the only JSON-Schema delta is a `description` string on two
21+
properties. Verified on a freshly built `dist`: `check:generated` reported
22+
`content/docs/references/**` as the single stale artifact and `--fix` regenerated only
23+
`filter.mdx`; `check:api-surface`, `check:export-origins` and `check:authorable-surface`
24+
stayed green with no new export.
25+
26+
The wording was written against `scripts/check-corpus-claim-drift.mjs` rather than into
27+
it: that shrink-only ratchet watches `content/docs/**` for `$exists` prose, its
28+
`exists-key-presence` row reads `exists-key-presence 4` both before this diff and after
29+
the page was regenerated, so the new prose adds zero claim sites.

content/docs/references/data/filter.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ Type: `[FilterArray](#filterarray)[]`
135135

136136
| Property | Type | Required | Description |
137137
| :--- | :--- | :--- | :--- |
138-
| **$null** | `boolean` | optional | |
139-
| **$exists** | `boolean` | optional | |
138+
| **$null** | `boolean` | optional | Is-null check. `true` matches rows where the field is null, `false` matches rows where it is not null. Lowered to `IS NULL` (true) / `IS NOT NULL` (false) on the SQL family and to `{ field: null }` (true) / `{ $ne: null }` (false) on MongoDB. |
139+
| **$exists** | `boolean` | optional | Has-a-value check — the exact inverse of `$null`. `true` matches rows where the field holds a value (`!= null`), `false` matches rows where it holds none. Portable across every backend the platform ships: lowered to `IS NOT NULL` (true) / `IS NULL` (false) on the SQL family and to `{ $ne: null }` (true) / `{ $eq: null }` (false) on MongoDB. |
140140

141141

142142
---

packages/spec/src/data/filter.zod.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,14 +1025,24 @@ export function likePatternToGlobPattern(pattern: string): string {
10251025
*/
10261026
export const SpecialOperatorSchema = lazySchema(() => z.object({
10271027
/** Is null check - SQL: IS NULL (true) / IS NOT NULL (false) | MongoDB: field: null */
1028-
$null: z.boolean().optional(),
1028+
$null: z.boolean().optional().describe(
1029+
'Is-null check. `true` matches rows where the field is null, `false` matches rows '
1030+
+ 'where it is not null. Lowered to `IS NULL` (true) / `IS NOT NULL` (false) on the '
1031+
+ 'SQL family and to `{ field: null }` (true) / `{ $ne: null }` (false) on MongoDB.'
1032+
),
10291033

10301034
/**
10311035
* Field HAS A VALUE (`!= null`) — the inverse of `$null`, never key presence.
10321036
* Lowered to `IS NOT NULL` (true) / `IS NULL` (false) on SQL and to
10331037
* `{$ne: null}` / `{$eq: null}` on MongoDB.
10341038
*/
1035-
$exists: z.boolean().optional(),
1039+
$exists: z.boolean().optional().describe(
1040+
'Has-a-value check — the exact inverse of `$null`. `true` matches rows where the '
1041+
+ 'field holds a value (`!= null`), `false` matches rows where it holds none. '
1042+
+ 'Portable across every backend the platform ships: lowered to `IS NOT NULL` (true) / '
1043+
+ '`IS NULL` (false) on the SQL family and to `{ $ne: null }` (true) / '
1044+
+ '`{ $eq: null }` (false) on MongoDB.'
1045+
),
10361046
}));
10371047

10381048
// ============================================================================

0 commit comments

Comments
 (0)