PaloAltoNetworks / prisma.pan.dev

The home of Developer docs for Prisma by Palo Alto Networks
https://prisma.pan.dev
MIT License
21 stars 38 forks source link

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

Closed NJannasch closed 2 years ago

NJannasch commented 2 years ago

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/

welcome-to-palo-alto-networks[bot] commented 2 years ago

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

debbm commented 2 years ago

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

debbm commented 2 years ago

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