Skip to content

Review all codegenerated type names; provide better names in many cases #1035

@SteveSandersonMS

Description

@SteveSandersonMS

Currently we have different naming strategies for the type names that we codegen:

  • In some cases we qualify by the chain of parent types, and end up with very verbose type names like SessionWorkspaceListFilesResult
  • In some cases we don't qualify at all, and end up with dangerously clash-risking names like Entry

Neither of these extremes are ideal. The underlying issue is that we're starting from TypeScript, a language where names don't matter so much - types often don't have names at all, and may exist only within the context of some method parameter or return type. We are mapping these into names for languages like C#, Go, and Python, but the autogenerated names aren't always ideal.

Proposal

In a recent runtime change, we now have the ability to declare recommended names for types in the JSON schema that we use for codegen in the SDK.

So, we should now review the set of generated type names across all languages, and decide which ones we don't want to support forever (e.g., because they are too verbose or too likely to clash). We can then go back to the underlying code that produces the JSON schema and add withTypeName annotations to those parts of the schema. This information will then flow into the SDK, where our per-language codegenerators can transform those names according to per-language conventions, but in general will get a better result than the pure autogenerated names.

This will be a lot of breaking changes, so we will want to do it soon, and have some good docs to explain the mappings from old to new names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDK GACopilot SDK General Availability trackingenhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions