Use schema descriptions in generated SDK docs#1291
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR updates the multi-language SDK code generators to consume method/parameter/result descriptions from the Copilot API schema and emit richer generated API documentation across TypeScript, C#, Python, Go, and Rust, then refreshes the generated outputs.
Changes:
- Extend the shared
RpcMethodshape to carry an optionaldescriptionfield sourced from the schema. - Update language generators (TS/C#/Py/Go/Rust) to emit method/param/return docs using schema descriptions (with fallbacks when absent).
- Regenerate the language-specific generated RPC surfaces to include the new documentation.
Show a summary per file
| File | Description |
|---|---|
| scripts/codegen/utils.ts | Adds description?: string to RpcMethod so generators can consume schema descriptions. |
| scripts/codegen/typescript.ts | Adds JSDoc helpers and emits method-level JSDoc (including returns/params) for generated RPC surfaces. |
| scripts/codegen/rust.ts | Adds rustdoc helpers and emits richer docs; adjusts param-type handling for session wire params vs public wrappers. |
| scripts/codegen/python.ts | Emits generated docstrings using schema descriptions for methods/handlers (plus deprecated/experimental/internal notes). |
| scripts/codegen/go.ts | Emits richer Go doc comments for generated RPC wrappers and handler interfaces. |
| scripts/codegen/csharp.ts | Emits XML doc summaries/<param>/<returns> using schema descriptions; standardizes CancellationToken docs. |
| rust/src/generated/rpc.rs | Regenerated Rust RPC wrappers with expanded rustdoc output. |
| python/copilot/generated/rpc.py | Regenerated Python RPC wrappers/handlers with new docstrings. |
| nodejs/src/generated/rpc.ts | Regenerated TS RPC wrappers/handlers with new JSDoc comments. |
| go/rpc/zrpc.go | Regenerated Go RPC wrappers/handlers with new doc comments. |
| dotnet/src/Generated/Rpc.cs | Regenerated .NET RPC wrappers/handlers with expanded XML documentation. |
Copilot's findings
Files not reviewed (1)
- go/rpc/zrpc.go: Language not supported
Comments suppressed due to low confidence (1)
scripts/codegen/python.ts:2656
- Protocol methods generated for client-session handlers represent request handlers, but their docstrings currently default to "Calls ." This is misleading for implementers; consider emitting "Handles …" (or passing a handler-specific summary into pushPyRpcMethodDocstring) for these handler methods.
lines.push(` async def ${toSnakeCase(name)}(self, params: ${paramsType}) -> ${resultType}:`);
pushPyRpcMethodDocstring(lines, " ", method, {
paramsName: "params",
paramsDescription: rpcParamsDescription(method, getMethodParamsSchema(method)),
resultDescription: rpcResultDescription(method, resultSchema),
deprecated: method.deprecated && !groupDeprecated,
experimental: method.stability === "experimental" && !groupExperimental,
});
- Files reviewed: 6/11 changed files
- Comments generated: 4
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Generate language-specific API documentation from schema method, parameter, and result descriptions across SDKs. Refresh generated outputs against the current schema. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Windows Rust SDK job failed while actions/setup-node was restoring the npm cache in the shared setup-copilot action. Skip setup-node's built-in npm cache on Windows so the job can proceed to npm ci and the Rust tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
69dc63a to
b297724
Compare
Cross-SDK Consistency Review ✅This PR updates all five SDK implementations simultaneously with the same feature — emitting schema-derived descriptions in generated documentation. The changes are consistent across languages:
All five SDKs share the same fallback pattern for missing descriptions ( No cross-SDK inconsistencies found. The generated output files for all five languages are also updated in the PR.
|
Copilot API schemas now carry method, parameter, and result descriptions. This updates the SDK generators so generated API docs use those schema descriptions instead of generic RPC wording across languages.
Summary
<returns>comments, and emit complete C#<param>docs with the standardCancellationTokenXML reference text.Validation
npm run typecheckdotnet build test\GitHub.Copilot.SDK.Test.csproj --no-restorepython -m py_compile python\copilot\generated\rpc.py python\copilot\generated\session_events.pygo test ./... -run '^$'cargo check --all-features