[ 
https://issues.apache.org/jira/browse/ATLAS-5053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aditya Gupta resolved ATLAS-5053.
---------------------------------
    Resolution: Resolved

> Add recursive validation in Basic Search API to fix regression issue
> --------------------------------------------------------------------
>
>                 Key: ATLAS-5053
>                 URL: https://issues.apache.org/jira/browse/ATLAS-5053
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core
>            Reporter: Paresh Devalia
>            Assignee: Aditya Gupta
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> A regression issue has been identified in the /v2/search/basic API of Apache 
> Atlas, where the recursive validation logic for entityFilters was 
> unintentionally omitted in a previous fix.
> As a result of this missing recursive check, the API is returning incorrect 
> responses and throwing a Bad Request error for complex filter scenarios 
> involving nested filter groups.
> Example Request:
> Endpoint:
> http://localhost:21000/api/atlas/v2/search/basic
> Request Body:
> {code:java}
> {
>   "excludeDeletedEntities": true,
>   "includeSubClassifications": true,
>   "includeSubTypes": true,
>   "includeClassificationAttributes": true,
>   "entityFilters": {
>     "condition": "AND",
>     "criterion": [
>       {
>         "attributeName": "__classificationNames",
>         "operator": "eq",
>         "attributeValue": "GameCatA"
>       },
>       {
>         "condition": "AND",
>         "criterion": [
>           {
>             "attributeName": "year_held",
>             "operator": "eq",
>             "attributeValue": "2006"
>           }
>         ]
>       }
>     ]
>   },
>   "tagFilters": null,
>   "attributes": [
>     "__classificationNames",
>     "__typeName",
>     "year_held"
>   ],
>   "limit": 25,
>   "offset": 0,
>   "typeName": "tournament",
>   "classification": null,
>   "termName": null
> }
> {code}
> Observed Response:
> {code:java}
> {
>   "errorCode": "ATLAS-400-00-103",
>   "errorMessage": "Invalid operator specified for attribute: null"
> }
> {code}
> As one can see, inside entity filter, we have criterion which in itself has 
> condition and criterion i.e following nested pattern[recursively filtered], 
> si in such case it gives: 
> {
>     "errorCode": "ATLAS-400-00-103",
>     "errorMessage": "Invalid operator specified for attribute: null"
> }
> Root Cause:
> The recursive structure in the entityFilters is not being properly validated. 
> The current implementation only supports basic filter conditions (i.e., flat 
> filters added using the "Add Filter" option) and fails to handle nested or 
> grouped filters (i.e., filters added via "Add Filter Group").



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

Reply via email to