Skip to content

Commit

Permalink
Merge pull request #274 from tanvi029/domains-fix
Browse files Browse the repository at this point in the history
domains field added
  • Loading branch information
pranavrd authored Sep 20, 2023
2 parents 40315c5 + c7219f1 commit a17b049
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
9 changes: 8 additions & 1 deletion docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ paths:
post:
tags:
- Mlayer Dataset
description: Fetches the dataset details of a particular dataset using dataset_id. Domains, Instance and provider field can be used to filter the datasets.
description: Fetches the dataset details of a particular dataset using dataset_id. Domains, Instance, Tags and provider field can be used to filter the datasets.
operationId: get dataset and its resources
requestBody:
description: 'Based on id dataset and its resources are retrieved. If id field blank or not present then, tags, providers and instance can be used to filter from all datasets.'
Expand Down Expand Up @@ -4061,6 +4061,11 @@ components:
description: provider/providers based on which datasets need to be filtered
items:
type: string
domains:
type: array
description: data models based on which datasets need to be filtered
items:
type: string

example:
id: 8b95ab80-2aaf-4636-a65e-7f2563d0d371
Expand All @@ -4071,6 +4076,8 @@ components:
providers:
- bbeacb12-5e54-339d-92e0-d8e063b551a8
- bbeacb12-5e54-339d-92e0-d8e063b551r9
domains:
- itms

successResponseForGettingDatasetResources:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,17 @@ public MlayerService getMlayerDataset(
});
} else if ((requestData.containsKey("tags")
|| requestData.containsKey("instance")
|| requestData.containsKey("providers"))
|| requestData.containsKey("providers")
|| requestData.containsKey("domains"))
&& (!requestData.containsKey(ID) || requestData.getString(ID).isBlank())) {
if (requestData.containsKey("domains") && !requestData.getJsonArray("domains").isEmpty()) {
JsonArray domainsArray = requestData.getJsonArray("domains");
JsonArray tagsArray = requestData.containsKey("tags")
? requestData.getJsonArray("tags") : new JsonArray();

tagsArray.addAll(domainsArray);
requestData.put("tags", tagsArray);
}
String query = GET_ALL_DATASETS_BY_FIELDS;

if (requestData.containsKey(TAGS) && !requestData.getJsonArray(TAGS).isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"instance": "pune",
"tags": [
"flood", "env"
],
"domains": [
"flood", "env"
]
}
],
Expand Down Expand Up @@ -69,6 +72,17 @@
}
]
}
},
"domains": {
"$id": "#/properties/domains",
"type": "array",
"title": "Mlayer Dataset Domains Schema",
"description": "Domain names are the data models",
"default": "",
"examples": [
["flood", "flooding"]
],
"pattern": "^[a-zA-Z ]*$"
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"info": {
"_postman_id": "7dcd7e34-2e9a-4fd3-97fe-4c41e1f86cca",
"_postman_id": "18907aa9-5b2f-4c81-b526-f18b1e940d1c",
"name": "iudx-catalogue-server v5.0.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "17194681"
"_exporter_id": "27217689"
},
"item": [
{
Expand Down Expand Up @@ -14467,7 +14467,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"tags\" : [\"flood\", \"transport\"],\r\n \"instance\" : \"pune\",\r\n \"providers\": [\"bbeacb12-5e54-339d-92e0-d8e063b551a8\"]\r\n}",
"raw": "{\r\n \"tags\" : [\"flood\", \"transport\"],\r\n \"instance\" : \"pune\",\r\n \"providers\": [\"bbeacb12-5e54-339d-92e0-d8e063b551a8\"],\r\n \"domains\" : [\"itms\"]\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -14520,7 +14520,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n \"tags\" : [],\r\n \"instance\" : \"\",\r\n \"providers\": []\r\n}",
"raw": "{\r\n \"tags\" : [],\r\n \"instance\" : \"\",\r\n \"providers\": [],\r\n \"domains\": []\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down

0 comments on commit a17b049

Please sign in to comment.