Fix shared schema comparison for Go codegen#1304
Conversation
Ignore documentation-only schema metadata when comparing shared API and session-event definitions so Go codegen references common wire types instead of emitting duplicate declarations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes Go codegen duplicate declarations by making shared-schema comparison ignore documentation-only fields (description, markdownDescription) so definitions with identical wire shapes but differing docs are still recognized as shared.
Changes:
- Skip
descriptionandmarkdownDescriptionkeys during normalization innormalizeDefinitionForComparison. - Update shared-codegen test fixtures to include intentionally divergent descriptions on a shared enum.
Show a summary per file
| File | Description |
|---|---|
| scripts/codegen/utils.ts | Ignore doc-only metadata when comparing shared schema definitions. |
| nodejs/test/shared-codegen.test.ts | Adds divergent descriptions to shared enum to cover the fix. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
Cross-SDK Consistency Review ✅This PR makes changes only to shared codegen tooling ( Summary of changes:
No consistency concerns. The fix is to shared infrastructure that benefits all language code generators equally — it prevents duplicate type declarations in Go's generated RPC code when the upstream schema has the same type documented differently in
|
Schema definitions shared between
api.schema.jsonandsession-events.schema.jsoncan have identical wire shapes but different documentation. With the 1.0.49-0 Copilot runtime schemas, that caused Go codegen to missReasoningSummaryas shared and emit duplicate declarations in the rpc package.This updates shared-definition comparison to ignore documentation-only metadata (
descriptionandmarkdownDescription) while preserving the existing structural comparison for refs, enum values, and object shapes. The regression test now covers a shared enum with intentionally different descriptions.