Skip to content

Commit

Permalink
Fixed a group parameter related issue (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolauli authored Nov 12, 2024
1 parent d7b174e commit ac85891
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion powershell/plugins/sdk-cs-namer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ function correctParameterNames(model: SdkModel) {
for (const operationGroup of model.operationGroups) {
for (const operation of operationGroup.operations) {
for (const parameter of values(operation.parameters)) {
parameter.language.default.name = getEscapedReservedName(parameter.language.default.name, 'Parameter');
// Use suffix 'property' for parameters in parameter group since we use 'property' for schema names
const suffix = parameter.extensions && parameter.extensions['x-ms-parameter-grouping'] ? 'Property' : 'Parameter';
parameter.language.default.name = getEscapedReservedName(parameter.language.default.name, suffix);
}
if (operation.requests) {
// body parameters
Expand Down
2 changes: 1 addition & 1 deletion powershell/resources/templates/methodBodyRestCall.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (method.extensions && method.extensions['x-ms-request-id']) {
}
<% } -%>
<%# for odata, validation is not needed. -%>
<%- parameter.extensions && parameter.extensions['x-ms-odata'] ? '' : project.helper.ValidateType(parameter.schema, method, prefix + parameter.language.default.name, parameter.nullable != false)%>
<%- parameter.extensions && (parameter.extensions['x-ms-odata'] || parameter.extensions['x-ms-parameter-grouping']) ? '' : project.helper.ValidateType(parameter.schema, method, prefix + parameter.language.default.name, parameter.nullable != false)%>
<%});}-%>
<%(method.parameters || []).filter(p => p.protocol.http.in == 'complex').forEach(function(parameter) {-%>
<%-project.helper.PopulateGroupParameters(parameter)%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,16 @@ function New-MetadataForParameterSet()
$cmdletName = Get-MappedCmdletFromFunctionName $ParameterSetInfo.Name
$description = (Get-CmdletAttribute -CmdletInfo $ParameterSetInfo -AttributeName "DescriptionAttribute").Description
[object[]]$example = New-ExampleForParameterSet $ParameterSetInfo
if ($Null -eq $example)
{
$example = @()
}

[string[]]$signature = New-ParameterArrayInParameterSet $ParameterSetInfo
if ($Null -eq $signature)
{
$signature = @()
}

return @{
Path = $httpPath
Expand Down

0 comments on commit ac85891

Please sign in to comment.