Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Description

The maxpagesize parameter from Azure.Core TypeSpec models needs camelCase formatting (maxPageSize) in generated C# code to follow naming conventions.

Implementation Status: Work in Progress

This PR adds the infrastructure for parameter renaming but the visitor implementation is not yet functional. The generated code still produces _maxpagesize instead of _maxPageSize for field names.

Changes Made

  • Added MaxPageSizeParameterVisitor: Visitor that detects maxpagesize parameters and attempts to create new InputMethodParameter and InputQueryParameter objects with Name="maxPageSize" while preserving SerializedName="maxpagesize" for wire format
  • Updated test expectations: Modified test data files to expect maxPageSize in generated collection result definitions
  • Integrated visitor: Added to AzureClientGenerator visitor pipeline early in execution order

Known Issue

The InputServiceMethod.Update(parameters:) call does not propagate parameter name changes to generated code. Field names in CollectionResultDefinition continue using the original parameter name.

Possible causes under investigation:

  • Parameter updates may not be persisted through the provider creation pipeline
  • Field name derivation may occur before visitor execution or from a cached source
  • Different API or pattern may be required for parameter renaming vs. removal

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code.
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK.
Original prompt

This section details on the original issue you should resolve

<issue_title>maxpagesize parameter casing should be camel case</issue_title>
<issue_description>maxpagesize comes from the standard Azure.Core tsp model, but we need to fix the casing. We should add a visitor in the Azure.Generator that will update any parameters in ScmMethodProvider from "maxpagesize" to "maxPageSize".</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix maxpagesize parameter casing to camel case Add MaxPageSizeParameterVisitor to rename maxpagesize parameter to camelCase Dec 11, 2025
Copilot AI requested a review from JoshLove-msft December 11, 2025 22:19
if (p.SerializedName.Equals(MaxPageSizeWireName, System.StringComparison.OrdinalIgnoreCase))
{
// Create a new parameter with the updated name
return new InputMethodParameter(
Copy link
Member

Choose a reason for hiding this comment

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

Hmm I think we should probably add Update methods in MTG and just change the name.

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.

maxpagesize parameter casing should be camel case

2 participants