Azure / Azure/autorest.powershell
incorrect parsing and singularization of paths when generating subjects from OData
- Dominant language
- C#
- Stars
- 123
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
The Azure AD feature Terms of Use has as one of its resource surfaced in OData, agreement. It appears in CSDL as
```xml
```
and YAML as
```
microsoft.graph.identityGovernance:
title: identityGovernance
type: object
properties:
termsOfUse:
$ref: '#/components/schemas/microsoft.graph.termsOfUseContainer'
```
with operations like
```
/identityGovernance/termsOfUse/agreements:
get:
tags:
- identityGovernance.termsOfUseContainer
summary: Get agreements from identityGovernance
operationId: identityGovernance.termsOfUse_ListAgreements
```
I would expect that by default cmdlets generated for this to be named like `Get-MgIdentityGovernanceTermsOfUseAgreement`.
This is because there is a Collection() type of a singular `agreement` that has a plural `agreements`, so it makes sense for that to be represented in PSh cmdlet and type names as `Agreement`. Note there is no `term`, 'terms' or `termofuse` in this service's endpoint.
However it appears autorest.powershell is incorrectly attempting to singularize inside of the token `termsOfUse` as well, rather than treating `termsOfUse` as a token. As a result when generating PSh from this, I see generated cmdlet names like `Get-MgIdentityGovernanceTerm` and `Get-MgIdentityGovernanceTermOfUseAgreement`. For example, `GetMgIdentityGovernanceTerm_Get.cs` has
``` cs
/// [DETAILS]
/// verb: Get
/// subjectPrefix:
/// subject: IdentityGovernanceTerm
/// variant: Get
```
and `GetMgIdentityGovernanceTermOfUseAgreement_Get.cs`
```cs
/// [DETAILS]
/// verb: Get
/// subjectPrefix:
/// subject: IdentityGovernanceTermOfUseAgreement
/// variant: Get
```
It is incorrect for autorest.powershell to
- be attempting to split "termsOfUse" into words and
- singularize "terms" separately.
since 'term' or 'terms' are not entities, types or paths in the service.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.