Skip to content

Commit ab50c8f

Browse files
huangyiireneclaude
andauthored
docs(spec): record DeleteDataRequestSchema's consumer and why the DELETE data door carries no requestSchema (#16191)
The docblock above `DeleteDataRequestSchema` in `packages/spec/src/api/protocol.zod.ts` was bare. It now records three verified facts for the next reader who greps the name and sees "exported, documented, zero safeParse call sites": the schema is the request contract of `DataProtocol.deleteData()` (consumed statically via the `DeleteDataRequest` alias); it deliberately carries no REST-door `requestSchema` under #3899, which the catalog entry states in place of the key and `plugin-rest-api.schema-refs.test.ts` pins ("requestSchema appears only on body-carrying methods"); and drift between the schema and that door is caught at compile time by the typed request literal `ServerScopedDataRequest` in `packages/rest/src/rest-server.ts` (#15866), not by a runtime parse. Comment and changeset only — no shape, `.describe()`, or export change; no other `*RequestSchema` docblock is touched. Claude-Session: https://claude.ai/code/session_01T6HeZvT9wdSJD1ZxJb5Eno Co-authored-by: Claude <noreply@anthropic.com>
1 parent 00e6413 commit ab50c8f

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
Record, on `DeleteDataRequestSchema` itself, what it is for and why the DELETE data door carries no `requestSchema` for it.
6+
7+
The schema is the request contract of `DataProtocol.deleteData()`, consumed statically through the `DeleteDataRequest` type alias and parsed at runtime nowhere — a grep that finds "exported, documented, zero `safeParse` call sites" is reading the wrong surface, and had already filed it once as a gap. Its docblock now says so; records that the absence of a `requestSchema` on `DELETE /api/v1/data/:object/:id` is a pinned decision (#3899 — the catalog entry states it in place of the key, and `plugin-rest-api.schema-refs.test.ts` goes red if one is added, because the route reads no body); and points at the compile-time check (#15866) under which a field added to the schema as required reddens the door at build instead of being silently unsent.
8+
9+
Documentation only: no shape, `.describe()` text, or export changes. `@objectstack/spec` ships the new text in its published type declarations and in the source file it publishes directly via its `src/**/*.zod.ts` entry.

packages/spec/src/api/protocol.zod.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,30 @@ export const UpdateDataResponseSchema = lazySchema(() => z.object({
21252125

21262126
/**
21272127
* Delete Data Request
2128+
*
2129+
* [#13852] The request contract of {@link DataProtocol.deleteData} — its
2130+
* declared parameter type is the `DeleteDataRequest` alias below. That
2131+
* protocol boundary is this schema's whole job: it is consumed statically, by
2132+
* the compiler, and parsed at runtime nowhere in the tree. A grep that finds
2133+
* "exported, documented, zero `safeParse` call sites" is reading the wrong
2134+
* surface — #13852 is that grep, filed once already.
2135+
*
2136+
* It deliberately carries no REST-door `requestSchema` (#3899):
2137+
* `DELETE /api/v1/data/:object/:id` reads no body — `object` and `id` are
2138+
* path-bound, `expectedVersion` rides `?expectedVersion` / `If-Match` — so a
2139+
* schema on that door would promise a validation nothing can violate. The
2140+
* catalog entry in `plugin-rest-api.zod.ts` says so in place of the key, and
2141+
* the pin in `plugin-rest-api.schema-refs.test.ts` ("requestSchema appears
2142+
* only on body-carrying methods") goes red if one is added. ⛔ Do not wire
2143+
* one, and do not retire this schema either — it types a shipped interface
2144+
* method.
2145+
*
2146+
* Drift between this schema and that door is caught at COMPILE time, not by a
2147+
* runtime parse: the door's request literal is typed against
2148+
* `DeleteDataRequest` (`ServerScopedDataRequest` in
2149+
* `packages/rest/src/rest-server.ts`, #15866 / PR #16071), so a field added
2150+
* here as REQUIRED reddens that file at build, naming the route that would
2151+
* otherwise have gone on not sending it.
21282152
*/
21292153
export const DeleteDataRequestSchema = lazySchema(() => z.object({
21302154
object: z.string().describe('Object name'),

0 commit comments

Comments
 (0)