Skip to content

Use schema descriptions in generated SDK docs#1291

Merged
stephentoub merged 3 commits into
mainfrom
stephentoub/schema-descriptions
May 14, 2026
Merged

Use schema descriptions in generated SDK docs#1291
stephentoub merged 3 commits into
mainfrom
stephentoub/schema-descriptions

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

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

  • Emit method, parameter, and return documentation for generated RPC wrappers and client-session handler surfaces in TypeScript, C#, Python, Go, and Rust.
  • Use result descriptions for return docs, including C# XML <returns> comments, and emit complete C# <param> docs with the standard CancellationToken XML reference text.
  • Preserve Rust session-only wire parameter structs while keeping public session RPC wrapper methods parameterless, then refresh generated outputs from the current schema.

Validation

  • npm run typecheck
  • dotnet build test\GitHub.Copilot.SDK.Test.csproj --no-restore
  • python -m py_compile python\copilot\generated\rpc.py python\copilot\generated\session_events.py
  • go test ./... -run '^$'
  • cargo check --all-features

@stephentoub stephentoub requested a review from a team as a code owner May 14, 2026 15:24
Copilot AI review requested due to automatic review settings May 14, 2026 15:24
Comment thread scripts/codegen/csharp.ts Fixed
Comment thread scripts/codegen/csharp.ts Fixed
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RpcMethod shape to carry an optional description field 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

Comment thread scripts/codegen/typescript.ts
Comment thread scripts/codegen/python.ts
Comment thread scripts/codegen/go.ts
Comment thread scripts/codegen/csharp.ts
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI added 3 commits May 14, 2026 13:20
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>
@stephentoub stephentoub force-pushed the stephentoub/schema-descriptions branch from 69dc63a to b297724 Compare May 14, 2026 17:29
@github-actions
Copy link
Copy Markdown
Contributor

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:

Language Doc Format Method Desc Param Desc Result Desc
TypeScript JSDoc (/** @param...@returns ... */)
Python Docstrings (Args: / Returns: sections)
Go GoDoc paragraphs (Parameters: / Returns:)
.NET XML docs (<summary>, <param>, <returns>)
Rust Rustdoc (# Parameters / # Returns sections)

All five SDKs share the same fallback pattern for missing descriptions (method.description ?? "<fallback>"), consistent param/result resolution logic, and idiomatic doc formats for each language. The Rust and Go generators also include the underlying wire method name in comments (Wire method: ... / RPC method: ...) — a deliberate language-specific addition that helps low-level consumers and requires no equivalent change in the other SDKs.

No cross-SDK inconsistencies found. The generated output files for all five languages are also updated in the PR.

Generated by SDK Consistency Review Agent for issue #1291 · ● 513.7K ·

@stephentoub stephentoub merged commit 32e932c into main May 14, 2026
44 checks passed
@stephentoub stephentoub deleted the stephentoub/schema-descriptions branch May 14, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants