[ https://issues.apache.org/jira/browse/RANGER-5194?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Umesh Padashetty updated RANGER-5194: ------------------------------------- Description: 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. I have also observed a case where the attributeDefs is returned, but only for a few of the tags. I created another tag with attributes, and assigned it to an entity in atlas with values, and this tag is returned to have attributeDefs by Ranger APIs like seen below {code:java} { "id": 155, "guid": "6b8e2431-31e3-44d7-aef6-4f97555d7e02", "isEnabled": true, "createdBy": "rangertagsync", "updatedBy": "rangertagsync", "createTime": 1744215891278, "updateTime": 1744215891280, "version": 1, "name": "test_tag_7bf80d08_1744215889", "source": "Atlas", "attributeDefs": [ { "name": "date_attr", "type": "string" }, { "name": "int_attr", "type": "string" }, { "name": "bool_attr", "type": "string" }, { "name": "string_attr", "type": "string" }, { "name": "float_attr", "type": "string" } ] } {code} 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} was: 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} > 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 > Priority: Major > > 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. > > I have also observed a case where the attributeDefs is returned, but only for > a few of the tags. I created another tag with attributes, and assigned it to > an entity in atlas with values, and this tag is returned to have > attributeDefs by Ranger APIs like seen below > {code:java} > { > "id": 155, > "guid": "6b8e2431-31e3-44d7-aef6-4f97555d7e02", > "isEnabled": true, > "createdBy": "rangertagsync", > "updatedBy": "rangertagsync", > "createTime": 1744215891278, > "updateTime": 1744215891280, > "version": 1, > "name": "test_tag_7bf80d08_1744215889", > "source": "Atlas", > "attributeDefs": [ > { > "name": "date_attr", > "type": "string" > }, > { > "name": "int_attr", > "type": "string" > }, > { > "name": "bool_attr", > "type": "string" > }, > { > "name": "string_attr", > "type": "string" > }, > { > "name": "float_attr", > "type": "string" > } > ] > } {code} > 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)