Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.62k stars 5.04k forks source link

[BUG] autorest tool does not compile 2D arrays correctly #30719

Closed lijinpei2008 closed 2 days ago

lijinpei2008 commented 2 days ago

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2023-06-01-preview/EventGrid.json#L13873

API Spec version

2023-06-01-preview

Describe the bug

image

Expected behavior

Correctly generate custom commands with a two-dimensional array of parameters

Actual behavior

PS D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest> .\build-module.ps1 Creating isolated process... Cleaning build folders... Compiling module... Creating cmdlets for specified models... Creating exports and docs... $ActionPreferenceStopException/ at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary2 functionsToDefine, List1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args) at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args) at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args) at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args) at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script) at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script) in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\PsHelpers.cs:line 24 at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script) in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\PsExtensions.cs:line 144 at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.PsHelpers.GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, String[] modulePaths) in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\PsHelpers.cs:line 73 at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.ExportProxyCmdlet.ProcessRecord() in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\Cmdlets\ExportProxyCmdlet.cs:line 62 ForEach-Object: Missing ] at end of attribute or type literal.

Reproduction Steps

PS D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest> .\build-module.ps1 Creating isolated process... Cleaning build folders... Compiling module... Creating cmdlets for specified models... Creating exports and docs... $ActionPreferenceStopException/ at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary2 functionsToDefine, List1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args) at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args) at System.Management.Automation.ScriptBlock.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args) at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args) at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(String script) at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script) in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\PsHelpers.cs:line 24 at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.PsExtensions.RunScript[T](PSCmdlet cmdlet, String script) in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\PsExtensions.cs:line 144 at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.PsHelpers.GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, String[] modulePaths) in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\PsHelpers.cs:line 73 at Microsoft.Azure.PowerShell.Cmdlets.EventGrid.Runtime.PowerShell.ExportProxyCmdlet.ProcessRecord() in D:_code\4\azure-powershell\src\EventGrid\EventGrid.Autorest\generated\runtime\BuildTime\Cmdlets\ExportProxyCmdlet.cs:line 62 ForEach-Object: Missing ] at end of attribute or type literal.

Environment

VS code Powershell 7(X64)