Umesh Padashetty created RANGER-5194:
----------------------------------------

             Summary: Incorrect documentation of attributeDefs in Ranger REST 
API Swagger Documentation 
                 Key: RANGER-5194
                 URL: https://issues.apache.org/jira/browse/RANGER-5194
             Project: Ranger
          Issue Type: Bug
          Components: tagsync
            Reporter: Umesh Padashetty


In Ranger Swagger REST API, https://ranger.apache.org/apidocs/ui/index.html, 
attributeDefs is documented as return value in most of the Tag REST APIs. But 
in reality, only a subset of these APIs return it based on whether the 
attribute has a value in Atlas

For instance, GET /tags/tagdef/name/\{name} returns the following where the 
attributes values are not assigned in Atlas. This is mostly expected since 
Ranger can ignore tag attributes for whom there is no set value in Atlas 
{code:java}
{
  "id": 699,
  "guid": "1d0f7955-466e-4a04-96a4-77b9ee3478cb",
  "isEnabled": true,
  "createdBy": "rangertagsync",
  "updatedBy": "rangertagsync",
  "createTime": 1744727619342,
  "updateTime": 1744727619343,
  "version": 1,
  "name": "attr_expiry_test_0_jnh34e",
  "source": "Atlas"
} {code}
But the same API should return the attributeDefs whenever it is assigned a 
value in atlas. But it is observed that it still returns the same response. The 
API documentation in Swagger says it returns the following 
{code:java}
{
  "attributeDefs": [
    {
      "type": "...",
      "name": "..."
    },
    {
      "type": "...",
      "name": "..."
    }
  ],
  "source": "...",
  "name": "...",
  "createdBy": "...",
  "updateTime": 12345,
  "updatedBy": "...",
  "createTime": 12345,
  "version": 12345,
  "guid": "...",
  "isEnabled": true,
  "id": 12345
} {code}
As seen above, attributeDefs is nowhere to be seen. We should either fix the 
incorrect Swagger documentation, or address the return values of our APIs. I 
feel we should fix the API responses. I have observed a similar incorrect 
behavior with many other Tag REST APIs.

On the other hand, GET /tags/tags returns the attributes correctly, whenever it 
has a value in Atlas 
{code:java}
{
    "id": 939,
    "guid": "00f18aa7-de2d-4066-a71e-1c9d485447eb",
    "isEnabled": true,
    "createdBy": "rangertagsync",
    "updatedBy": "rangertagsync",
    "createTime": 1744775805078,
    "updateTime": 1744775805079,
    "type": "attr_expiry_test_0_jnh34e",
    "owner": 0,
    "attributes": {
      "createdAt": "today",
      "expiryType": "tomorrow"
    }
} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to