[
https://issues.apache.org/jira/browse/RANGER-4998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17899188#comment-17899188
]
Radhika Kundam commented on RANGER-4998:
----------------------------------------
For info, with the addition of server-side validations for resource values, API
requests now properly validate input, ensuring data integrity. The following
scenarios will trigger a validation error:
1. No values property provided: The values field is missing entirely from the
request.
2. Empty values list: The values field is present but contains no elements.
3. Blank values entries: The values list includes blank or null elements.
Validation Response: Requests failing these validations will return a 400 Bad
Request with the following error format:
{code:java}
{
"statusCode": 1,
"msgDesc": "[Validation failure: error code[4133], reason[Invalid resource:
empty or no value provided for <resource-name>], field[null], subfield[null],
type[]]",
"messageList": [
{
"name": "INVALID_INPUT_DATA",
"rbKey": "xa.validation.invalid_input_data",
"message": "Invalid input data"
}
]
}{code}
> Add validations to Ensure Non-Empty Resource Values in GDS Resource Creation
> and Edit APIs
> ------------------------------------------------------------------------------------------
>
> Key: RANGER-4998
> URL: https://issues.apache.org/jira/browse/RANGER-4998
> Project: Ranger
> Issue Type: Bug
> Components: Ranger
> Affects Versions: 3.0.0
> Reporter: Radhika Kundam
> Assignee: Radhika Kundam
> Priority: Major
> Fix For: 3.0.0
>
>
> *Problem statement*
> When trying to create a GDS resource via API, the GDS resource creation is
> working even though the values are empty for the resource section.
> Ideally, validations have to be added to ensure that the field is not empty
> during GDS resource creation / update via APIs.
> The validation is already present on the UI.
> *Steps to reproduce*
> 1. As the Ranger admin user, make a call to the API endpoint
> \{BASE_URL}/service/gds/resource using the following payload
> {code:java}
> {
> "version":1,
> "name":"test_shared_resource_{random_str}",
> "dataShareId":{DATASHARE_ID},
> "resource":{
> "database":{
> "values":[
>
> ],
> "isExcludes":false,
> "isRecursive":false
> }
> }
> }{code}
> The GDS resource creation succeeds even though the values field is empty.
> The GDS resource creation succeeds even with the below payload
> {code:java}
> {
> "version":1,
> "name":"test_shared_resource_abcdef",
> "dataShareId":34,
> "resource":{
> "database":{
> "isExcludes":false,
> "isRecursive":false
> }
> }
> } {code}
> The issue is present in the PUT /gds/resource/\{resource_id} API endpoint as
> well.
> *Expectation*
> Validations have to be added to ensure the resources are properly defined
> during GDS resource creation / edit.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)