msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Duplicated operaionId

Open dinowang opened this issue 1 year ago • 2 comments

Describe the bug

Multiple Open API spec has duplicated operaionId

For example: https://github.com/microsoftgraph/msgraph-sdk-powershell/blob/dev/openApiDocs/v1.0/Users.yml

  '/users/{user-id}/photo':
    get:
      tags:
        - users.profilePhoto
      summary: Get photo from users
      description: The user's profile photo. Read-only.
      operationId: user_GetPhoto
      parameters:
        - name: user-id
  '/users/{user-id}/photos/{profilePhoto-id}':
    get:
      tags:
        - users.profilePhoto
      summary: Get photos from users
      description: The collection of the user's profile photos in different sizes. Read-only.
      operationId: user_GetPhoto
      parameters:
        - name: user-id

When user import Open API spec into product/service. Like Azure API Management will cause conflict image

Expected behavior

OperationId should unique.

How to reproduce

  1. Create Azure API Management service
  2. Click API, create API from defination
  3. Paste Open API spec URL, fill the form then press Create
image

SDK Version

v1.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

dinowang avatar Jul 10 '24 15:07 dinowang

@dinowang thanks a lot for identifying this issue. Indeed, this is a violation based on Open Api spec description. https://spec.openapis.org/oas/v3.0.3. I am transferring this issue to the team responsible so that they work on it.

timayabi2020 avatar Jul 25 '24 08:07 timayabi2020

From the OpenAPI spec. the two paths have different operation ids. See below:

image users_GetPhoto - link

image users_GetPhotos - link

irvinesunday avatar Aug 16 '24 08:08 irvinesunday

@irvinesunday for the last one i.e users_GetPhotos there is the singularization function which ends up singularizing the operation id. I think having the tag as users_GetPhotoById should resolve this issue.

timayabi2020 avatar Nov 13 '24 08:11 timayabi2020