Skip to content

Commit d818060

Browse files
committed
docs(rest): openapi-endpoints 的 requestBody 注释改写为实测状态——服务出的文档里 $ref 为 0 (#6797)
那句「六个内置 $ref 可以解析」在 #5588(ruling C)/ #5744 之后已经失真:内置路由段 改由 buildBuiltinPaths 在服务期生成且一个 $ref 都不发,产物侧也不再发射 paths。 本次实测:服务出的文档 $ref 总数为 0(空载 67 条 path / 展开后 88 条),静态产物 内部同样为 0,九个契约 schema 是一座无入边的孤岛。 该句是承重散文——它为紧邻的自由形态 `type: object` 决策背书,失真会让下一个读者 以为文档里存在可解析的引用图。改写后按实测状态陈述,并说明它是结构性的(装配链路 上没有任何一步发射 $ref),紧邻的 requestBody 决定因此有了更站得住的理由。 仅注释改动,无代码变更。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZgRyPVwi1jLb1mNNuUQ9o
1 parent c32944d commit d818060

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

packages/rest/src/openapi-endpoints.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,25 @@ export function buildEndpointOperation(
256256
if (facts.readsBody && BODY_METHODS.has(endpoint.method)) {
257257
// Free-form object, deliberately: the executor forwards the body (through
258258
// `inputMapping`, when declared) to the same pipeline the built-in route
259-
// uses, and this document has no PER-OBJECT schemas to point at. Since
260-
// #5168 `components.schemas` is no longer empty — it carries the nine
261-
// contract schemas, and the six built-in `$ref`s resolve — but those are
262-
// the generic CRUD envelopes (`CreateRequest`, `ApiError`, …), not the
263-
// shape of `showcase_task`'s body. An empty `type: object` says "a JSON
264-
// object, shape not described here", which is true; naming fields we have
265-
// not derived would not be.
259+
// uses, and this document has no PER-OBJECT schemas to point at.
260+
//
261+
// Since #5168 `components.schemas` is no longer empty — it carries the
262+
// nine contract schemas — but they are an ISLAND: the served document
263+
// contains ZERO `$ref`s, so nothing in it points INTO them (#6797,
264+
// re-measured against the real `GET /openapi.json` handler and against
265+
// the static artifact, both 0). That is structural rather than an
266+
// oversight — no step of the assembly emits one. Since #5588 (ruling C)
267+
// the built-in section is produced at request time by `buildBuiltinPaths`,
268+
// which emits none DELIBERATELY: the artifact's old section pointed at
269+
// `CreateRequest`/`UpdateRequest` and was wrong about the wire shape those
270+
// routes accept (`openapi-builtin-paths.ts`, "What it will NOT say"). And
271+
// #5744 stopped the generator emitting `paths` at all.
272+
//
273+
// So there is no reference graph to hang a body schema on; and the nine
274+
// are generic CRUD envelopes (`ApiError`, …) rather than the shape of
275+
// `showcase_task`'s body in any case. An empty `type: object` says "a
276+
// JSON object, shape not described here", which is true; naming fields we
277+
// have not derived would not be.
266278
operation.requestBody = {
267279
required: true,
268280
content: { 'application/json': { schema: { type: 'object' } } },

0 commit comments

Comments
 (0)