Naming improvements via codegen changes#1043
Merged
SteveSandersonMS merged 18 commits intomainfrom Apr 14, 2026
Merged
Conversation
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.
Changes to RPC naming convention changes to fix #1035
This PR improves generated public type names across the SDKs by moving naming decisions into the shared schema/codegen pipeline instead of relying on language-specific quirks.
The goal is to make generated names:
Main naming rules
The naming is now mostly mechanical rather than hand-curated:
Derive names from the RPC method / event identity first
account.getQuotabecomes anAccountQuotaroot instead ofAccountGetQuotaResult.Drop generic namespace and filler words
session.get,read, andlistwhen they are only structuralSingularize list entities
models.listusesModelfor nested item types andModelListfor the top-level resultKeep top-level wrapper words only when they are actually useful
Request/Resultremain for top-level params/results...Request...Result...Value...ItemnoiseDrop purely structural wrapper property names in nested helpers
data,result,request,response,kind,value, etc. are removed when they are just containers, not meaningful domain termsNormalize overlapping words
requested+requestUse explicit schema-local names for true API surface decisions
Before / after examples
Previously too long
AccountGetQuotaResultQuotaSnapshotsValueAccountQuotaSnapshotSessionPermissionsHandlePendingPermissionRequestResultPermissionRequestResultSessionToolsHandlePendingToolCallResultHandleToolCallResultSessionUiElicitationRequestRequestedSchemaUiElicitationSchemaSessionUiHandlePendingElicitationRequestResultUiElicitationResponseSessionUiHandlePendingElicitationResultUiElicitationResultToolExecutionCompleteDataResultContentsItemResourceLinkIconsItemThemeToolExecutionCompleteContentResourceLinkIconThemeUserMessageDataAttachmentsItemSelectionSelectionEndUserMessageAttachmentSelectionDetailsEndPreviously too short / too generic
EntrySessionFsReaddirWithTypesEntry/SessionFSReaddirWithTypesEntryEndUserMessageAttachmentSelectionDetailsEndModeSessionModeSessionModeGetResultModeSessionModeA few especially notable cases
The worst "path explosion" example was the old icon theme helper name:
ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItemThemeToolExecutionCompleteContentResourceLinkIconThemeThe worst "too generic to understand in isolation" examples were names like:
EntryEndModeThose now carry enough domain context to be understandable in generated SDKs without needing to inspect the surrounding method/property path.
API-specific naming that is now explicit
A few names are intentionally chosen as API surface names rather than just synthesized mechanically, for example:
UiElicitationResponseUiElicitationResultHandlePendingElicitationRequestPermissionDecisionPermissionDecisionRequestPermissionRequestResultModeGetResultModeSetResultHandleToolCallResultThat keeps the generator logic generic while still letting the schema declare clear public names where needed.
TypeScript note
TypeScript still avoids exploding the surface area with every synthesized helper as a named export. Explicit public names are preserved where intended, while synthetic helper naming is mainly used to improve the non-TS SDKs and shared generation consistency.