Repository navigation
fix(connector-openapi): path-item parameters reach every operation's input schema - #27981
Conversation
…input schema An OpenAPI 3.x Path Item's `parameters` apply to every operation under the path, but collectOperations built each operation from `record[method]` only, so a parameter declared on the path (the usual vendor shape for an id shared by GET / PATCH / DELETE) never reached the action's inputSchema. collectOperations now merges the path item's parameters into each operation's, an operation entry with the same `name` + `in` replacing the path-level one whole, as OpenAPI defines. A `$ref` entry carries no key to match on and is kept as is (buildInputSchema skips an unresolved one, as before). Pins, one per shape, through createOpenApiProviderFactory: path-level only, operation override, same name with different `in`, and the operation-only control. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1Np3hU7RQnA13YZcL
📓 Docs Drift Check3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 2 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 998974e407cdac7ed111fab904bbcddbc37e92ae && git checkout 998974e407cdac7ed111fab904bbcddbc37e92ae
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5f6dc96c396104350cfe71556ed724df5412bf54 86f7bf403a977c7c80b1c45067e17dbfd2f442e0 && git checkout -B drift-repro 5f6dc96c396104350cfe71556ed724df5412bf54 && git merge --no-ff 86f7bf403a977c7c80b1c45067e17dbfd2f442e0
node scripts/docs-audit/affected-docs.mjs --json 5f6dc96c396104350cfe71556ed724df5412bf54 |
|
domain:server#4 · os-elon-musk · session_016WV4d1Np3hU7RQnA13YZcL 维护者速读
席位意见:ACCEPT。 席位核对Head-sha:
|
domain:server#4 · os-elon-musk · session_016WV4d1Np3hU7RQnA13YZcL
Fixes #27463
维护者速读
connector-openapi的collectOperations现在把 OpenAPI 3.x Path Item 上的parameters合并进该路径下每个操作的参数;操作里name+in相同的条目整条覆盖路径级条目。另加四个固定测试和一个 patch changeset。inputSchema里,作者和流程设计器看到的输入定义缺了必填项。inputSchema;运行时不会用它校验调用输入,实测缺petId的调用修复前后一样被派发,没有原本被接受、现在被拒绝的调用。回滚就是 revert 这一个提交。packages/connectors/connector-openapi/src/openapi-connector.ts的collectOperations/mergeParameters。pnpm --filter @objectstack/connector-openapi test -t "path-item-level",四个测试都绿;把openapi-connector.ts还原到 base 后,其中三个变红。normalize-openapi转换的 Swagger 2.0 文档也会受益:实测升级器把路径级参数留在 path item 上,并没有下沉到操作里,与卡片描述不同。Clause-②: no — only the generated action's
inputSchemagains the path-level parameters the document already declares; nothing validates a call's input against it, so every call accepted before is still dispatched as before (measured end to end).Metadata-protocol: none
What changes
collectOperationsmerges each path item'sparametersinto every operation under that path: path-level entries first, then the operation's own. An operation entry with the samename+inreplaces the path-level one whole (its schema and itsrequired), as OpenAPI 3.x defines. A path-level and an operation-level parameter that share a name but notinare both kept.parametersleaves the operation's array exactly as it was. A$refentry has noname/into match on, so it is kept as is;buildInputSchemaskips an unresolved one, as before.OpenApiPathItemdeclares the optionalparameterskey.Why
The generator built each operation from
record[method]only, so a parameter declared once on the path never reached the action'sinputSchema. Measured at bacb3e6 throughcreateOpenApiProviderFactory: an OpenAPI 3.0.3 document with'/pets/{petId}': { parameters: [{ name: 'petId', in: 'path', required: true }], get: … }materializedgetPetwithinputSchema: null. Agents and flows built from that schema call the action wrong.Swagger 2.0 documents converted by
normalize-openapihave the same shape: measured, the upgrader keeps path-level parameters on the path item (in 3.x form) and does not copy them into operations. They now get the same fix, and the normalizer's own tests are unchanged and green.Verification
openapi-provider.test.ts, one per shape, all through the provider factory: path-level only (GET and DELETE both getpetId, required), operation override (whole-entry replacement; a concatenation would keep the path-levelrequired), same name with a differentin(both kept), and the operation-only control.provider: 'openapi') runs aconnector_actionflow callinggetPetwithinput: {}. It succeeds and requests the same URL before and after the fix; nothing refuses it.pnpm --filter @objectstack/connector-openapi test(67/67),typecheck,pnpm lint: all exit 0.dispatch-gates --ran: 58 derived, 57 run green, 1 not measured (check:dual-build-cjs-loadsneeds a whole-tree build), 0 unrun.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4d1Np3hU7RQnA13YZcL