Resolve review comments on Azure management-plane .NET SDK PRs. Handles renaming types/properties, changing property types, and other API surface adjustments by updating TypeSpec client.tsp and regenerating.
Resolve review comments on Azure management-plane SDK PRs by making changes in the TypeSpec spec repo (client.tsp) and regenerating the SDK.
Trigger phrases: "resolve review comments", "fix review comments", "resolve PR comments", "rename types", "fix naming", "resolve naming comments", "fix API surface".
Management-plane SDK code is generated from TypeSpec definitions in azure-rest-api-specs. Review comments on SDK PRs often request changes to the generated API surface — renaming types, renaming properties, or changing property types to be more user-friendly. These changes are made in the spec repo's client.tsp using TypeSpec decorators (primarily @@clientName), then the SDK is regenerated.
@@clientName(TypeSpecName, "CSharpName", "csharp") — renames a TypeSpec model/union/enum/property to a different name in the generated C# SDK. This is the primary tool for resolving naming comments.@@clientName only works on types defined in the service's TypeSpec — you can only target models, unions, enums, and interfaces that are explicitly declared in the service's .tsp files. If a type is not defined there (e.g., it comes from ARM common types or TypeSpec templates), @@clientName cannot target it. See "Renaming via SDK Custom Code" below.@@clientName cannot target aliases — if a type is defined as an alias, @@clientName cannot target it. See "Handling Unsupported Cases" below.client.tsp may be changed in the spec repo — do not modify any other .tsp files or config files. If resolving a comment would require changes to other files, skip that change and inform the user with the reason after processing all other comments. Since only client.tsp is modified, swagger regeneration is never needed.Review comments may flag type names that are too generic and could collide with types from other SDKs or lack sufficient context.
Goal: Make the name more descriptive by adding context — this could be the RP name, the resource name, or other domain-specific context. The right prefix depends on what makes the name unambiguous and meaningful.
Examples:
| Original | Renamed | Context Added |
|---|---|---|
ProvisioningState | ManagedOpsProvisioningState | RP name |
ServiceInformation | ManagedOpsServiceInformation | RP name |
EncryptionProperties | VaultEncryptionProperties | Resource name |
ConnectionState | PrivateEndpointConnectionState | Feature name |
How to decide the prefix: Read the review comment carefully — it may suggest a specific prefix. If not, choose the most natural context that makes the name unambiguous within the SDK's namespace. When uncertain, ask the user what prefix or name they prefer.
Properties can also be renamed using @@clientName on the model's property:
@@clientName(MyModel.oldPropertyName, "NewPropertyName", "csharp");
Some review comments ask for property types to be changed (e.g., string → ResourceIdentifier, string → TimeSpan). Use the @@alternateType decorator in client.tsp to change the generated C# type:
@@alternateType(MyModel.myProperty, armResourceIdentifier, "csharp");
@@alternateType(MyModel.durationProperty, duration, "csharp");
This changes the property's type in the generated C# SDK without modifying other .tsp files. If @@alternateType cannot handle the requested type change, skip the change and inform the user with the reason after processing all other comments.
Fetch the PR's review comments using GitHub MCP tools. For each unresolved comment:
.tsp files under the spec folder for a model, union, or enum declaration with the same name.
@@clientName in client.tsp (Step 3)If a comment is ambiguous about what the new name should be, ask the user before proceeding.
Find tsp-location.yaml in the SDK package directory:
sdk/<service>/Azure.ResourceManager.<Service>/tsp-location.yaml
This file contains:
directory: path to the TypeSpec spec (e.g., specification/managedoperations/ManagedOps.Management)commit: the spec repo commit SHArepo: the spec repo (e.g., Azure/azure-rest-api-specs)Key spec files:
client.tsp — where @@clientName and @@alternateType decorators go (this is the only .tsp file you should modify).tsp files — read-only reference for understanding models, unions, and aliasesThis step applies only to types that are defined in the service's TypeSpec files. For types NOT defined in the service's TypeSpec, skip to Step 3b.
Locate the spec repo. It may be:
../azure-rest-api-specs relative to the SDK repo)If there is an existing spec PR branch, check it out. If there is no spec PR or branch yet, create a new branch from the commit referenced in tsp-location.yaml.
Add @@clientName decorators to client.tsp. Read the existing client.tsp to find the correct using statement for the service namespace (e.g., using Microsoft.ManagedOps;, using Azure.ResourceManager.Compute;, etc.), then add decorators targeting the types to rename:
@@clientName(GenericTypeName, "MoreDescriptiveTypeName", "csharp");
@@clientName(MyModel.genericProperty, "moreDescriptiveProperty", "csharp");
Make sure the using statement for the service namespace is present so that type names resolve correctly. Check the namespace declaration in main.tsp or other .tsp files to find the correct namespace.
Types that are not defined in the service's TypeSpec (e.g., from ARM common types or TypeSpec templates) cannot be renamed via @@clientName. Instead, create SDK-side customization files to rename them.
src/Customize/Models/ directory (create the directory if it doesn't exist).partial class (or partial struct for value types) with the desired name, and apply the [CodeGenType("OriginalGeneratedName")] attribute to map it to the generated type.Example: To rename OptionalPropertiesUpdateableProperties to DurableTaskPrivateEndpointConnectionPatchProperties:
// src/Customize/Models/DurableTaskPrivateEndpointConnectionPatchProperties.cs
using Azure.ResourceManager.DurableTask.Models;
namespace Azure.ResourceManager.DurableTask.Models
{
[CodeGenType("OptionalPropertiesUpdateableProperties")]
public partial class DurableTaskPrivateEndpointConnectionPatchProperties
{
}
}
After creating customization files, proceed to Step 6 (Regenerate the SDK) — Steps 4 and 5 (commit spec changes and update tsp-location.yaml) are only needed if client.tsp was also modified.
Commit client.tsp changes and push to the spec PR branch.
Update the commit field in tsp-location.yaml to point to the new spec commit SHA: