-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Given an operationId of reports_ListApplicationSignInDetailedSummary, AutoREST.PowerShell currently generates a command name of Get-ReportApplicationSign instead of Get-ReportApplicationSignInDetailedSummary. It looks like AutoREST.PowerShell treats the In in SignIn as a preposition thus truncating everything after the preposition in:
autorest.powershell/powershell/plugins/create-commands-v2.ts
Lines 80 to 89 in 8baf63e
| function splitOnAnyPreposition(parts: Array<string>) { | |
| for (const p of ['with', 'at', 'by', 'for', 'in', 'of']) { | |
| const result = splitOnPreposition(p, parts); | |
| if (result && result[0].length > 0) { | |
| // we found it, let's give it back. | |
| return result; | |
| } | |
| } | |
| return undefined; | |
| } |
Possible Solutions
- Exclude compound words such as
SignInandSignOutfrom being broken into two distinct words. - Provide a configuration that customers can use to bypass the truncation of prepositions if they desire. Certain APIs use prepositions in their paths to communicate meaning. e.g., https://graph.microsoft.com/v1.0/users/{id}/memberOf.
Workaround
We can use rename directive to target the affected command variants and rename them to the proper name as a workaround. While this works well when targeting a handful of commands, it doesn't scale when the directive needs to be applied to hundreds of APIs/commands since we need to know ahead of time which command variants are affected.