PaloAltoNetworks/prisma.pan.dev

Issue with "User Profile API" - Wrong schema used in openapi spec

NJannasch opened this issue · 3 comments

Describe the problem

The REST API Endpoint /user/me returns MultiRoleUserProfile instead of UserProfileModel.

In the documentation the expected object has the attribute roleId but roleIds is returned:
https://prisma.pan.dev/api/cloud/cspm/user-profile#operation/get-my-profile

How to reproduce

import requests

url = "https://api.prismacloud.io/user/me"
headers = {"x-redlock-auth": "REPLACE_KEY_VALUE"}
response = requests.request("GET", url, headers=headers)
print(response.text)
# Returns: {.... "roleIds": [...] ...}

Suggested fix

Update the returned object in the OpenAPI spec from UserProfileModel towards MultiRoleUserProfile or make use of oneOf, anyOf, allOf as described in the openapi specification:
https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/

🎉 Thanks for opening your first issue here! Welcome to the community!

debbm commented

Thank you for catching this. The fix will be in 22.3.2.

debbm commented

We published the fix. Thanks again for pointing out the issue and giving a thoughtful suggested fix.