Skip to content

Commit f6bdfdb

Browse files
committed
fix(spec): render the reference section for a non-object root schema (#7658)
`build-docs.ts` picked the node it was documenting by enumerating shapes — `properties`, `enum`, `anyOf`, `oneOf` — and answered "none of those" with `return ''`. A JSON Schema root is routinely none of those: `z.string().describe(…)` compiles to a bare scalar, `z.record(…)` to an object with `additionalProperties` and no `properties`, `z.array(…)` to an array, `z.intersection(…)` to an `allOf`. Each lost its whole `## Name` section — heading included, and with it the `.describe()` prose written to be read — while the page's `## TypeScript Usage` block, spelled from the export surface rather than from this function, went on naming the export. Measured on today's tree: 45 published schemas were in that state, 33 carrying a description. The card counted 22 (`~23`), having scanned only the bare-scalar spelling. Regenerating adds 244 lines across 27 pages and removes none, so the 1533 sections that already rendered are byte-identical. Emitted files 230 → 230: an empty section never removed a page, so no category's `pages.length` moves and the #7303 `meta.json` guard is untouched. The renderer moves to `scripts/lib/schema-section.ts` so it can be pinned directly — the extraction `lib/format-type.ts` got at #4912, for the same reason. Its output here was the empty string, which is precisely what grepping emitted `.mdx` cannot see, and why `check:docs` stayed green over this for months. Reverse-verified: restoring the old fallback turns 7 of the 13 new cases red and leaves the other 6 green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RpBD5DrXb9gsPKkRHL8FHG
1 parent 098b629 commit f6bdfdb

31 files changed

Lines changed: 723 additions & 107 deletions
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
fix(spec): reference pages no longer drop the whole section for a non-object root schema (#7658)
6+
7+
`build-docs.ts` decided which node of a published document it was documenting by
8+
enumerating shapes — `properties`, `enum`, `anyOf`, `oneOf` — and answered "none
9+
of those" with `return ''`. A JSON Schema root is routinely none of those:
10+
`z.string().describe(…)` compiles to a bare scalar, `z.record(…)` to an object
11+
with `additionalProperties` and no `properties`, `z.array(…)` to an array,
12+
`z.intersection(…)` to an `allOf`. Every one of them lost its ENTIRE `## Name`
13+
section — heading included, and with it the `.describe()` prose an author wrote
14+
to be read — while the page's `## TypeScript Usage` block, which is spelled from
15+
the export surface rather than from this function, went on naming the export. The
16+
page read as if it had forgotten to finish rendering an entry it had just
17+
imported.
18+
19+
**Measured on today's tree: 45 published schemas were in that state, 33 of them
20+
carrying a description.** The filed issue counted 22 (`~23`), having scanned only
21+
the bare-scalar spelling; record maps, one array root and one `allOf` are the
22+
same defect through the same line. Regenerating restores all 45 sections — 244
23+
added lines, **zero removed**, so none of the 1533 sections that already rendered
24+
moves. Emitted file count is unchanged at 230: a section rendering as the empty
25+
string never removed a page, so no category's `pages.length` changes and the
26+
`meta.json` emit guard added in #7303 is untouched.
27+
28+
Nothing was failing, which is why this stood for months: `check:docs` compares
29+
generated output to committed output, so a section that never existed stays green
30+
forever, and there is no grep for what is missing.
31+
32+
The renderer moved to `scripts/lib/schema-section.ts` to be pinned directly —
33+
the same extraction, for the same reason, that `lib/format-type.ts` got at #4912.
34+
Its output was the empty string, the one thing grepping emitted `.mdx` cannot
35+
see.
36+
37+
Sections for these shapes now carry the schema's description plus a single
38+
`**Type:**` line, rendered by the same `formatType` that every property row on
39+
the page uses, so a schema's own section and a property typed with it cannot
40+
disagree. Constraints (`pattern`, `minLength`, `minimum`) are deliberately not
41+
spelled: this renderer prints none in any position, and `json-schema/` stays the
42+
authority on them.

content/docs/references/api/contract.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ const result = ApiErrorSchema.parse(data);
482482

483483
---
484484

485+
## RecordData
486+
487+
Key-value map of record data
488+
489+
**Type:** `Record<string, any>`
490+
485491

486492
---
487493

content/docs/references/api/websocket.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ const result = AckMessageSchema.parse(data);
178178

179179
---
180180

181+
## EventPattern
182+
183+
Event pattern (supports wildcards like "record.*" or "*.created")
184+
185+
**Type:** `string`
186+
181187

182188
---
183189

content/docs/references/cloud/environment-artifact.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ const result = Sha256DigestSchema.parse(data);
3434

3535
---
3636

37+
## Sha256Digest
38+
39+
SHA-256 digest (64 hex chars)
40+
41+
**Type:** `string`
42+
3743

3844
---
3945

content/docs/references/cloud/environment.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ Credential lifecycle status
107107

108108
---
109109

110+
## EnvironmentDriver
111+
112+
Data-plane driver key (e.g. `turso`, `libsql`, `sqlite`, `postgres`)
113+
114+
**Type:** `string`
115+
110116

111117
---
112118

content/docs/references/cloud/package.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,21 @@ Register a new package in the Control Plane
9191

9292
---
9393

94+
## PackageCategory
95+
96+
Package category for marketplace discovery (e.g. "crm", "hr", "finance", "devtools")
97+
98+
**Type:** `string`
99+
94100

95101
---
96102

103+
## PackageLocale
104+
105+
BCP-47 locale tag
106+
107+
**Type:** `string`
108+
97109

98110
---
99111

@@ -128,6 +140,12 @@ Per-locale overrides for a package listing
128140

129141
---
130142

143+
## PackageTranslations
144+
145+
Locale-keyed overrides; missing keys fall back to base columns
146+
147+
**Type:** `Record<string, { displayName?: string; description?: string; readme?: string; tagline?: string; … }>`
148+
131149

132150
---
133151

content/docs/references/cloud/tenant.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ const result = PackageInstallationSchema.parse(data);
158158

159159
---
160160

161+
## TenantPlan
162+
163+
Opaque plan/tier identifier. The vocabulary is control-plane config owned by the cloud distribution, not protocol — this schema accepts any string and does not enumerate valid values. Convention: an empty or unrecognized value is treated as the free tier by cloud-side readers (not enforced by this schema).
164+
165+
**Type:** `string`
166+
161167

162168
---
163169

content/docs/references/data/context-tokens.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,17 @@ const result = ContextTokenSchema.parse(data);
9292

9393
---
9494

95+
## ContextToken
96+
97+
**Type:** `string`
98+
9599

96100
---
97101

102+
## ContextTokenPlaceholder
103+
104+
**Type:** `string`
105+
98106

99107
---
100108

content/docs/references/data/datasource.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ const result = DatasourceSchema.parse(data);
6868

6969
---
7070

71+
## DriverType
72+
73+
Underlying driver identifier
74+
75+
**Type:** `string`
76+
7177

7278
---
7379

content/docs/references/data/date-macros.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,17 @@ const result = DateMacroPlaceholderSchema.parse(data);
9292

9393
---
9494

95+
## DateMacroPlaceholder
96+
97+
**Type:** `string`
98+
9599

96100
---
97101

102+
## DateMacroToken
103+
104+
**Type:** `string`
105+
98106

99107
---
100108

0 commit comments

Comments
 (0)