aditya-gupta36 commented on code in PR #373:
URL: https://github.com/apache/atlas/pull/373#discussion_r2199827921
##########
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java:
##########
@@ -892,27 +892,47 @@ private void validateSearchParameters(SearchParameters
parameters) throws AtlasB
private void validateEntityFilter(SearchParameters parameters) throws
AtlasBaseException {
FilterCriteria entityFilter = parameters.getEntityFilters();
+ FilterCriteria tagFilter = parameters.getTagFilters();
- if (entityFilter == null) {
- return;
+ if (checkEmptyFilterCriteria(entityFilter) ) {
+ validateNestedCriteria(entityFilter);
}
- if (entityFilter.getCriterion() != null &&
- !entityFilter.getCriterion().isEmpty()) {
- if (entityFilter.getCondition() == null ||
StringUtils.isEmpty(entityFilter.getCondition().toString())) {
+ if (checkEmptyFilterCriteria(tagFilter)) {
+ validateNestedCriteria(tagFilter);
+ }
+ }
+
+ private boolean checkEmptyFilterCriteria(FilterCriteria criteria) {
Review Comment:
Oh, now I got it.
Thanks for the review and suggestion, Radhika.
I've refactored based on your suggestion. Now the empty filter check is
embedded inside validateNestedCriteria(), ensuring that all filters — including
nested ones — are either validated or gracefully skipped (if empty). This
simplifies the logic, removes the need for checkEmptyFilterCriteria(), and
ensures consistent and recursive validation across the tree structure while
preserving backward compatibility.
This keeps the empty filter check (for {} support), but also ensures all
filters with actual content get validated properly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]