Skip to content

Commit 7e99e6d

Browse files
committed
Merge branch 'bugfix/asset_validation' into 'master'
hotfix/asset_validation See merge request upm-inesdata/inesdata-connector!46
2 parents 221543d + 43d3032 commit 7e99e6d

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

extensions/asset-validator/src/main/java/org/upm/inesdata/validator/InesdataAssetValidator.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public class InesdataAssetValidator {
4747
public static final String PROPERTY_ASSET_TYPE = EDC_NAMESPACE + "assetType";
4848
public static final String PROPERTY_KEYWORD = DCAT_SCHEMA + "keyword";
4949
public static final String PROPERTY_AMAZONS3_REGION = EDC_NAMESPACE + "region";
50+
public static final String PROPERTY_AMAZONS3_BUCKET_NAME = EDC_NAMESPACE + "bucketName";
51+
public static final String PROPERTY_AMAZONS3_ACCESS_KEY_ID = EDC_NAMESPACE + "accessKeyId";
52+
public static final String PROPERTY_AMAZONS3_SECRET_ACCESS_KEY = EDC_NAMESPACE + "secretAccessKey";
53+
public static final String PROPERTY_AMAZONS3_ENDPOINT_OVERRIDE = EDC_NAMESPACE + "endpointOverride";
5054
public static final String PROPERTY_HTTP_DATA_BASE_URL = EDC_NAMESPACE + "baseUrl";
5155
public static final String PROPERTY_ASSET_DATA = EDC_NAMESPACE + "assetData";
5256

@@ -184,6 +188,34 @@ private ValidationResult validateAmazonS3(JsonObject dataAddress) {
184188
));
185189
}
186190

191+
if (extractValueFromJsonArray(dataAddress, PROPERTY_AMAZONS3_BUCKET_NAME) == null) {
192+
violations.add(violation(
193+
"Field 'https://w3id.org/edc/v0.0.1/ns/bucketName' is required for AmazonS3 DataAddress type",
194+
PROPERTY_AMAZONS3_BUCKET_NAME
195+
));
196+
}
197+
198+
if (extractValueFromJsonArray(dataAddress, PROPERTY_AMAZONS3_ACCESS_KEY_ID) == null) {
199+
violations.add(violation(
200+
"Field 'https://w3id.org/edc/v0.0.1/ns/accessKeyId' is required for AmazonS3 DataAddress type",
201+
PROPERTY_AMAZONS3_ACCESS_KEY_ID
202+
));
203+
}
204+
205+
if (extractValueFromJsonArray(dataAddress, PROPERTY_AMAZONS3_SECRET_ACCESS_KEY) == null) {
206+
violations.add(violation(
207+
"Field 'https://w3id.org/edc/v0.0.1/ns/secretAccessKey' is required for AmazonS3 DataAddress type",
208+
PROPERTY_AMAZONS3_SECRET_ACCESS_KEY
209+
));
210+
}
211+
212+
if (extractValueFromJsonArray(dataAddress, PROPERTY_AMAZONS3_ENDPOINT_OVERRIDE) == null) {
213+
violations.add(violation(
214+
"Field 'https://w3id.org/edc/v0.0.1/ns/endpointOverride' is required for AmazonS3 DataAddress type",
215+
PROPERTY_AMAZONS3_ENDPOINT_OVERRIDE
216+
));
217+
}
218+
187219
return violations.isEmpty() ? ValidationResult.success() : ValidationResult.failure(violations);
188220
}
189221

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# externally before calling the sonar task
33
# Included here to avoid annoying warnings in all tasks (happens in configure stage)
44
systemProp.sonar.gradle.skipCompile=true
5-
version=0.9.0
5+
version=0.9.1

0 commit comments

Comments
 (0)