Skip to content

Fix IPv4 and IPv6 casing in generated C# parameters - #11673

Merged
JoshLove-msft merged 5 commits into
mainfrom
copilot/fix-acronym-casing
Aug 14, 2026
Merged

JoshLove-msft merged 5 commits into
mainfrom
copilot/fix-acronym-casing

Conversation

Copilot AI commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Property-derived C# parameters were emitted as iPv4 and iPv6 instead of matching the normalized IPv4 and IPv6 property names.

  • Parameter naming
    • Normalize leading IPv4/IPv6 parameter acronyms without affecting ordinary camel casing or embedded text.
public IPModel(string IPv4, string IPv6)
  • Regression coverage
    • Cover IPv4/IPv6 names, exact names, standard acronyms, and non-leading matches.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Aug 14, 2026
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix acronym casing in generated parameters Fix IPv4 and IPv6 casing in generated C# parameters Aug 14, 2026
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@11673

commit: d444af6

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a casing regression in the C# generator where property-derived parameter variable names for IPv4/IPv6 were being emitted as iPv4/iPv6 instead of the expected ipv4/ipv6, aligning parameter casing with normalized property names (e.g., IPv4, IPv6).

Changes:

  • Add a targeted IPv4/IPv6 post-normalization step in ToVariableName to rewrite leading iPv4/iPv6 to ipv4/ipv6 only at word boundaries.
  • Add regression tests covering IPv4/IPv6, standard acronym behavior, exact-name scenarios, and non-leading/non-boundary cases.
  • Minor formatting fix in an existing test update expression (& ~).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/test/Providers/PropertyProviderTests.cs Adds coverage verifying property-derived parameter declarations normalize IPv4/IPv6 and common acronym casing; includes a small formatting correction.
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/test/StringExtensionsTests.cs Adds unit tests for ToVariableName behavior specific to IPv4/IPv6 casing and boundary/non-boundary cases.
packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.Input/src/Extensions/StringExtensions.cs Implements the IPv4/IPv6 leading-acronym casing correction in ToVariableName after identifier normalization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JoshLove-msft
JoshLove-msft added this pull request to the merge queue Aug 14, 2026
Merged via the queue into main with commit d459235 Aug 14, 2026
30 checks passed
@JoshLove-msft
JoshLove-msft deleted the copilot/fix-acronym-casing branch August 14, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Acronym Casing in Generated Parameters

4 participants