Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
112 stars 78 forks source link

Workflows is no longer singularized for some operationIds in v3.x #1108

Closed peombwa closed 1 year ago

peombwa commented 1 year ago

In AutoREST.PowerShell v2.x, cmdlets with Workflows in their operationId were all singularized as follows:

OperationId CommandName
identityGovernance.lifecycleWorkflows.workflows_activate Initialize-IdentityGovernanceLifecycleWorkflow

In AutoREST.PowerShell v3.x, the same operations id will now produce a cmdlet with the following name:

OperationId CommandName
identityGovernance.lifecycleWorkflows.workflows_activate Initialize-IdentityGovernanceLifecycleWorkflowsWorkflow

Repro Steps

Using the sample at https://gist.github.com/peombwa/c4f1a68442dfe5d636d424225b5e5e88, generate PowerShell modules using:

AutoREST.PowerShell v2.x
autorest --powershell --use:@autorest/powershell@2.1.401 --input-file:"https://gist.githubusercontent.com/peombwa/c4f1a68442dfe5d636d424225b5e5e88/raw/a4074bec0a4a36972f46be35f9a9c70b8642a4bc/lifecycleWorkflows.yml" --output-folder:V2
AutoREST.PowerShell v3.x
autorest --powershell --input-file:"https://gist.githubusercontent.com/peombwa/c4f1a68442dfe5d636d424225b5e5e88/raw/a4074bec0a4a36972f46be35f9a9c70b8642a4bc/lifecycleWorkflows.yml" --output-folder:V3

Inspect the command names at .\V2\generated\cmdlets\ and .\V3\generated\cmdlets\, generated using AutoREST.PowerShell v2.x and v3.x respectively.

Workaround

As a workaround, we able to use the following rename directive to manually singularize and deduplicate Workflows:

  - where:
      subject: (.*)(LifecycleWorkflow)sWorkflow(.*)
    set:
      subject: $1$2$3
dolauli commented 1 year ago

Fixed in autorest.powershell v4.