Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Problem

Model factory methods in Azure Management SDKs were generating parameter names that don't follow .NET naming conventions for acronyms. Specifically, the ETag property was being converted to eTag instead of the correct etag in camelCase parameter names.

Issue Screenshot

According to .NET naming guidelines and existing Azure SDK patterns (e.g., ServiceFabric SDK), acronyms in camelCase identifiers should be all lowercase when they are 2 letters, or all lowercase except when they form the start of another word.

Root Cause

The FirstCharToLowerCase method in StringExtensions.cs was too simplistic - it only converted the first character to lowercase, producing eTag from ETag. This didn't account for acronym naming conventions.

Solution

Updated the FirstCharToLowerCase method to properly handle acronyms according to .NET conventions:

  • 2-letter acronyms: Convert all to lowercase

    • ETagetag
    • IDid
  • 3+ letter acronyms followed by another word: Lowercase the acronym but keep the next word capitalized

    • XMLParserxmlParser
    • HTTPClienthttpClient
  • All uppercase strings: Convert all to lowercase

    • HTTPhttp
    • ABCabc

Testing

  • ✅ Added 15 comprehensive test cases for the updated method
  • ✅ All generator tests pass (75/75)
  • ✅ Applied fix to DeviceRegistry SDK as demonstration
  • ✅ DeviceRegistry SDK builds and all tests pass (20/20)

Impact

This change affects model factory methods in management plane SDKs. When SDKs are regenerated from their TypeSpec definitions, parameter names for acronyms will follow the proper .NET naming convention, consistent with other Azure SDK patterns.

Example Change

// Before
public static DeviceRegistryBillingContainerData DeviceRegistryBillingContainerData(
    ..., 
    ETag? eTag = default)

// After  
public static DeviceRegistryBillingContainerData DeviceRegistryBillingContainerData(
    ..., 
    ETag? etag = default)
Original prompt

This section details on the original issue you should resolve

<issue_title>model factory parameter should use etag instead of eTag</issue_title>
<issue_description>Image</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #53476


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix model factory parameter to use etag instead of eTag Fix model factory parameter naming: change eTag to etag for acronym compliance Oct 24, 2025
Copilot AI requested a review from live1206 October 24, 2025 08:12
Copilot finished work on behalf of live1206 October 24, 2025 08:12
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.

model factory parameter should use etag instead of eTag

2 participants