docs(protocol): http-protocol 的 API Discovery 拆成两段式 —— REST 形状与 dispatcher 形状分开 (#4817) - #4826
Merged
xuyushun441-sys merged 1 commit intoAug 3, 2026
Conversation
…tcher 形状分开 (#4817) 该页此前声称 `/.well-known/objectstack` 与 `/api/v1/discovery` 「都直接返回同一份 discovery 文档」,并给出一份混合示例(`name` / `version: "2.1.0"` / `environment` / `locale`)。这份示例其实是 dispatcher `getDiscoveryInfo()` 的形状,而挂了 `@objectstack/rest` 的常规组合下 `/api/v1/discovery` 返回的是 `{ version, apiName, routes, services, capabilities }` + rest-server 追加的 `scoping`,没有 `name` / `environment` / `locale`,`version` 还被 `api.version` 覆盖成 `"v1"`。 改为与 `content/docs/api/index.mdx`(#4816 已核实)一致的两段式: - `GET /api/v1`(与 `/api/v1/discovery`)一节给 REST 形状; - `GET /.well-known/objectstack` 一节给 dispatcher 形状(`{ "data": ... }` 包裹, 含 `name` / `environment` / `features` / `locale`); - 「两条路径同文档」限定为 REST-less 组合,并点名 ADR-0076 D11 单一 owner 规则。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018iARDqtrhQgz6fVHDeDkbQ
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This was referenced Aug 3, 2026
xuyushun441-sys
marked this pull request as ready for review
August 3, 2026 09:13
xuyushun441-sys
deleted the
claude/issue-4817-http-protocol-discovery-shapes
branch
August 3, 2026 09:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4817
问题
content/docs/protocol/kernel/http-protocol.mdx的 API Discovery 一节此前写着「/.well-known/objectstack和版本化的/api/v1/discovery路由都直接返回 discovery 文档 —— 两者之间没有 HTTP 重定向」,随后给出一份响应示例。那份示例其实是 dispatcher 的形状(
name/environment/locale),却被标注成两条路径共同的返回体。在挂了@objectstack/rest的常规组合里,两条路径返回的不是同一形状。locale更是读者会直接拿去初始化 i18n 的字段 —— 从/api/v1/discovery读它永远读不到。改动
按 issue 的建议处置,改成与
content/docs/api/index.mdx(#4816 刚核实过)一致的两段式,用的是同一套措辞而不是第二种说法:GET /api/v1(与GET /api/v1/discovery) —— REST 形状:version/apiName/routes/services/capabilities,外加 rest-server 追加的scoping。并明写三条易错点:version是api.version覆盖后的路径段("v1",不是2.1.0这类语义版本);这里没有name/environment/locale;scoping由 REST 层追加。GET /.well-known/objectstack—— dispatcher 形状:{ "data": ... }包裹,含name/environment/features/locale,并说明它没有capabilities、routes另有endpoints兼容别名。${prefix}/discovery);裸/api/v1只有 REST 会注册。不再有混合示例。
每个字段的来源(逐一读过实现后写的)
version/apiName/routes/services/capabilitiesObjectStackProtocolImplementation.getDiscovery()的 return(packages/metadata-protocol/src/protocol.ts)version被覆盖成"v1"registerDiscoveryEndpoints里discovery.version = this.config.api.version(packages/rest/src/rest-server.ts)capabilities.transactionalBatch的descriptionscoping.{enabled,resolution,scoped,environmentId}false/'auto'取自RestServerConfig的 zod defaultname: "ObjectOS"/version: "1.0.0"/environment/features/locale/endpointsHttpDispatcher.getDiscoveryInfo()的 return(packages/runtime/src/http-dispatcher.ts){ "data": ... }包裹res.json({ data: await dispatcher.getDiscoveryInfo(prefix) })(packages/runtime/src/dispatcher-plugin.ts)services.*.message文案serviceUnavailableMessage()/REMEDY_DETAIL(packages/spec/src/system/core-services.zod.ts)routes的键集合ApiRoutesSchema(packages/spec/src/api/discovery.zod.ts)git grep graphql -- packages/spec/src/api/为空 —— 两份示例都没有"graphql"或任何无 schema/handler 支撑的字段。验证
node scripts/check-doc-authoring.mjs→215 files cleannode scripts/check-role-word.mjs→OK (43 baselined file(s), no new occurrences)pnpm --filter @objectstack/spec check:docs→246 generated files in sync with packages/specpnpm check:release-notes/pnpm check:nul-bytes→ OK@mdx-js/mdxcompile)Docs-only,changeset 用空 frontmatter 形式(releases nothing),沿用
.changeset/retire-runtime-capabilities-doc-page.md的先例。content/docs/releases/未触碰。范围
只改这一节。issue 末尾「顺带」提到的
.claude/workflows/docs-accuracy-audit.js路径失效(仍指向改名前的protocol/objectos/*)按派发要求未并入,另行分诊。🤖 Generated with Claude Code
https://claude.ai/code/session_018iARDqtrhQgz6fVHDeDkbQ
Generated by Claude Code