Skip to content

Commit

Permalink
Merge pull request #397 from Kranthi-Guribilli/fix/obsolete-validation
Browse files Browse the repository at this point in the history
Fix: Update Resource item validation logic
  • Loading branch information
Gokul-KG authored Nov 21, 2024
2 parents fdbdf35 + 01d7b2b commit 291eb4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
openapi: 3.0.2
info:
version: '5.5.0'
version: '5.6.0'
title: Data Exchange Catalogue Server APIs
license:
name: Apache 2.0
Expand Down Expand Up @@ -47,8 +47,8 @@ info:
The application should address them accordingly.
contact:
name: For support contact IUDX Team at
email: support@iudx.org.in
url: https://iudx.org.in/
email: support@cdpg.org.in
url: https://dataforpublicgood.org.in/
servers:
- url: 'https://example-cat.com/iudx/cat/v1'
description: Production Instance
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/iudx/catalogue/server/validator/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class Constants {
+ "\"match\":{\"id.keyword\":\"$3\"}},{"
+ "\"bool\":{\"must\":[{"
+ "\"match\":{\"type.keyword\":\"iudx:Resource\"}},{"
+ "\"match\":{\"name.keyword\":\"$4\"}}]}}]}},"
+ "\"match\":{\"name.keyword\":\"$4\"}}, {"
+ "\"match\":{\"resourceGroup.keyword\":\"$3\"}}]}}]}},"
+ "\"_source\":[\"type\"]}";
public static final String OWNER_ITEM_EXISTS_QUERY =
"{\"query\":{\"bool\":{\"must\":[{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ private void validateResource(
} else if (method.equalsIgnoreCase(REQUEST_POST)
&& res.result().getInteger(TOTAL_HITS) > 3) {
LOGGER.debug("RI already exists");
handler.handle(Future.failedFuture("Fail: Resource item already exists"));
String errorMessage = String.format(
"Fail: Resource item with the name '%s' already exists in the resource group '%s'",
request.getString(NAME), resourceGroup);
handler.handle(Future.failedFuture(errorMessage));
} else {
handler.handle(Future.succeededFuture(request));
}
Expand Down

0 comments on commit 291eb4f

Please sign in to comment.