Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Subject Names When Generating Commands with *SkypeForBusiness* in their operationId #795

Closed
peombwa opened this issue Jun 24, 2021 · 1 comment

Comments

@peombwa
Copy link
Contributor

peombwa commented Jun 24, 2021

Operations that have *SkypeForBusiness* in their operation Ids are generated as commands with incorrect subject names. It looks like AutoREST.PowerShell truncates everything after *Skype in *SkypeForBusiness*. e.g.,
This operation with operationId: reports_getSkypeForBusinessActivityCounts:

  '/reports/microsoft.graph.getSkypeForBusinessActivityCounts(period=''{period}'')':
    get:
      tags:
        - reports.Functions
      summary: Invoke function getSkypeForBusinessActivityCounts
      operationId: reports_getSkypeForBusinessActivityCounts

ends up being generated as Get-MgReportSkype instead of the expected Get-MgReportSkypeForBusinessActivityCount.

Repro Steps:

  1. Generate PowerShell module using this sample OpenAPI document as AutoREST's input-file:
autorest --powershell --input-file:https://gist.githubusercontent.com/peombwa/3883d3bd7152f59c0bf5f53adfabd6f4/raw/d8cf9bba631e1ace66f4ee7e5f2def74fb333155/BrokenSkypeForBusiness.yml --clear-output-folder
  1. Inspect the generate cmdlets folder. You'll notice all cmdlets that call /reports/microsoft.graph.getSkypeForBusiness* are generated as Get-MgReportSkype.
    image

Environment

  • Tested with both autorest/powershell v2.1.401 and v3.0.402.

Related to microsoftgraph/msgraph-sdk-powershell#628.

@dolauli
Copy link
Contributor

dolauli commented Jul 23, 2021

It is by design. If there are preposition like ['with', 'at', 'by', 'for', 'in', 'of'] in the operationId, the preposition and following part will be truncated. In this case, we think the operationId is 'DoActionWithStyle' and we will truncate the withstyle part. So for your case, only one cmdlet will be generated, and there will be one parameter set for each forxxx. If you expect one cmdlet per get, you may replace 'for' with some placeholder in the operationId and then using a directive to rename the subject.

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

No branches or pull requests

2 participants