Skip to content

Commit 9ffbde5

Browse files
committed
docs(spec): regenerate the api/rest-server reference; keep the contributor rule off the published page
Claude-Session: https://claude.ai/code/session_016N6xmWt5hYm94ffVEwGH8x Co-authored-by: Claude <noreply@anthropic.com>
1 parent c9f3633 commit 9ffbde5

2 files changed

Lines changed: 35 additions & 9 deletions

File tree

content/docs/references/api/rest-server.mdx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@ Architecture alignment:
2222
- Microsoft Dynamics: Web API with entity operations
2323
- Strapi: Auto-generated REST endpoints
2424

25+
WHO CAN WRITE THIS CONFIG (#15543) — read this before planning a deployment
26+
around any key below. A `RestServerConfig` is the ARGUMENT a host passes when
27+
it constructs the server: never a stack collection member, never a stored
28+
metadata row, never a file the CLI reads. Both doors are programmatic —
29+
`createRestApiPlugin({ api })` (`packages/rest/src/rest-api-plugin.ts`) and
30+
`createHonoServerPlugin({ restConfig })`
31+
(`packages/plugins/plugin-hono-server/src/hono-plugin.ts`).
32+
33+
No shipped boot path opens either door with a config of its own. `os serve`
34+
(`packages/cli/src/commands/serve.ts`) constructs the plugin with a fixed
35+
argument carrying exactly two CLI-derived keys — `api.enableProjectScoping`
36+
and `api.projectResolution` — and the dev plugin
37+
(`packages/plugins/plugin-dev/src/dev-plugin.ts`) calls
38+
`createRestApiPlugin()` with no config at all. So on a CLI-started deployment
39+
every OTHER key here is EMBEDDER-ONLY: the whole of `crud`, `metadata` and
40+
`batch`, and the rest of `api`. Its value is whatever the `.default()` below
41+
says, and no flag, env var or config file moves it. That is the recorded
42+
posture, not a gap awaiting a fix: the keys keep their runtime reads and
43+
their embedder consumer, and the reachability answer ADR-0049 asks for is
44+
written per key in the liveness ledger
45+
(`packages/spec/liveness/crud_endpoints.json`, `metadata_endpoints.json`,
46+
`batch_endpoints.json`).
47+
2548
<Callout type="info">
2649
**Source:** `packages/spec/src/api/rest-server.zod.ts`
2750
</Callout>
@@ -205,7 +228,7 @@ const result = BatchEndpointsConfigSchema.parse(data);
205228
| **enableBatch** | `boolean` | optional (default: `true`) | Enable batch operation endpoints |
206229
| **enableDiscovery** | `boolean` | optional (default: `true`) | Enable API discovery endpoint |
207230
| **enableOpenApi** | `boolean` | optional (default: `true`) | Enable OpenAPI 3.1 spec & docs viewer endpoints |
208-
| **enableSearch** | `boolean` | optional (default: `true`) | Enable structured search endpoints (deployment-wide search opt-out) |
231+
| **enableSearch** | `boolean` | optional (default: `true`) | Enable structured search endpoints (server-wide search opt-out; embedder-only, not settable from `os serve`) |
209232
| **enableProjectScoping** | `boolean` | optional (default: `false`) | Enable project-scoped routing for data/meta/AI APIs |
210233
| **projectResolution** | `Enum<'required' \| 'optional' \| 'auto'>` | optional (default: `"auto"`) | Project ID resolution strategy |
211234
| **requireAuth** | `never` | optional | [REMOVED] `api.requireAuth` was removed in @objectstack/spec 17. Anonymous access to object data is now always denied — auth is a kernel concern, not a deployment posture. Delete the key. To publish something publicly, declare it: a public form view (`sharing.allowAnonymous`), a share link, or `book.audience: 'public'` — each derives its own narrow authorization instead of opening the whole data plane. Run `os migrate meta --from 16` to list the mechanical edits for existing sources; apply them by hand. |
@@ -242,9 +265,9 @@ const result = BatchEndpointsConfigSchema.parse(data);
242265
| Property | Type | Required | Description |
243266
| :--- | :--- | :--- | :--- |
244267
| **api** | `{ version: string; basePath: string; apiPath?: string; enableCrud: boolean; … }` | optional | REST API configuration |
245-
| **crud** | `{ operations?: object; dataPrefix: string }` | optional | CRUD endpoints configuration |
246-
| **metadata** | `{ prefix: string; enableCache: boolean; maskObjectFields: boolean; endpoints?: object }` | optional | Metadata endpoints configuration |
247-
| **batch** | `{ maxBatchSize: integer; enableBatchEndpoint: boolean; operations?: object }` | optional | Batch endpoints configuration |
268+
| **crud** | `{ operations?: object; dataPrefix: string }` | optional | CRUD endpoints configuration (embedder-only: written by a host that constructs this config, never by `os serve` or the dev plugin) |
269+
| **metadata** | `{ prefix: string; enableCache: boolean; maskObjectFields: boolean; endpoints?: object }` | optional | Metadata endpoints configuration (embedder-only: written by a host that constructs this config, never by `os serve` or the dev plugin) |
270+
| **batch** | `{ maxBatchSize: integer; enableBatchEndpoint: boolean; operations?: object }` | optional | Batch endpoints configuration (embedder-only: written by a host that constructs this config, never by `os serve` or the dev plugin) |
248271
| **routes** | `{ }` | optional | Route generation configuration |
249272
| **openApi31** | `never` | optional | [REMOVED] `RestServerConfig.openApi31` was removed in @objectstack/spec 17 (ADR-0049) — no runtime ever read it: the REST server forwards only `api`/`crud`/`metadata`/`batch`/`routes`, and the served /openapi.json is the pre-generated contract enriched with the live server URL and the registered objects, so webhook/callback definitions declared here never appeared in it. Delete the key. Config-driven OpenAPI 3.1 webhooks/callbacks documentation is a new capability and must arrive via the enforce route of ADR-0049 (a new ADR), not by re-declaring the key; for a real outbound webhook use `Webhook` from `@objectstack/spec/automation`. |
250273

@@ -261,7 +284,7 @@ const result = BatchEndpointsConfigSchema.parse(data);
261284
| **enableBatch** | `boolean` | optional (default: `true`) | Enable batch operation endpoints |
262285
| **enableDiscovery** | `boolean` | optional (default: `true`) | Enable API discovery endpoint |
263286
| **enableOpenApi** | `boolean` | optional (default: `true`) | Enable OpenAPI 3.1 spec & docs viewer endpoints |
264-
| **enableSearch** | `boolean` | optional (default: `true`) | Enable structured search endpoints (deployment-wide search opt-out) |
287+
| **enableSearch** | `boolean` | optional (default: `true`) | Enable structured search endpoints (server-wide search opt-out; embedder-only, not settable from `os serve`) |
265288
| **enableProjectScoping** | `boolean` | optional (default: `false`) | Enable project-scoped routing for data/meta/AI APIs |
266289
| **projectResolution** | `Enum<'required' \| 'optional' \| 'auto'>` | optional (default: `"auto"`) | Project ID resolution strategy |
267290
| **requireAuth** | `never` | optional | [REMOVED] `api.requireAuth` was removed in @objectstack/spec 17. Anonymous access to object data is now always denied — auth is a kernel concern, not a deployment posture. Delete the key. To publish something publicly, declare it: a public form view (`sharing.allowAnonymous`), a share link, or `book.audience: 'public'` — each derives its own narrow authorization instead of opening the whole data plane. Run `os migrate meta --from 16` to list the mechanical edits for existing sources; apply them by hand. |

packages/spec/src/api/rest-server.zod.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,15 @@ import { retiredKey } from '../shared/retired-key';
4444
* written per key in the liveness ledger
4545
* (`packages/spec/liveness/crud_endpoints.json`, `metadata_endpoints.json`,
4646
* `batch_endpoints.json`).
47-
*
48-
* ⛔ So a docblock here must never describe a key as a deployment posture
49-
* without saying who can actually set it. An operator reading this page is
50-
* entitled to learn from it that they cannot set these.
5147
*/
5248

49+
// ⛔ CONTRIBUTOR RULE, deliberately a line comment and not part of the docblock
50+
// above: `build-docs.ts` renders the module docblock verbatim onto the public
51+
// reference page, and this sentence is addressed to whoever edits this file, not
52+
// to the operator reading that page. No docblock here may describe a key as a
53+
// deployment posture without saying who can actually set it — an operator
54+
// reading the schema is entitled to learn from it that they cannot set these.
55+
5356
// ==========================================
5457
// REST API Configuration
5558
// ==========================================

0 commit comments

Comments
 (0)