Skip to content

Commit

Permalink
fix: typo dcat:endpointUrl (#4524)
Browse files Browse the repository at this point in the history
fix: adds dcat:endpointURL and deprecate dcat:endpointUrl in DataService transformer
  • Loading branch information
wolf4ood authored Oct 3, 2024
1 parent f449c33 commit 9f33db9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_DATA_SERVICE_TYPE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_OLD_ATTRIBUTE;

/**
* Converts from a {@link DataService} to a DCAT data service as a {@link JsonObject} in JSON-LD expanded form.
Expand All @@ -47,6 +48,7 @@ public JsonObjectFromDataServiceTransformer(JsonBuilderFactory jsonFactory) {
.add(TYPE, DCAT_DATA_SERVICE_TYPE);

addIfNotNull(dataService.getEndpointDescription(), DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE, objectBuilder);
addIfNotNull(dataService.getEndpointUrl(), DCAT_ENDPOINT_URL_OLD_ATTRIBUTE, objectBuilder);
addIfNotNull(dataService.getEndpointUrl(), DCAT_ENDPOINT_URL_ATTRIBUTE, objectBuilder);

return objectBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_DATA_SERVICE_TYPE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_ATTRIBUTE;
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCAT_ENDPOINT_URL_OLD_ATTRIBUTE;
import static org.mockito.Mockito.mock;

class JsonObjectFromDataServiceTransformerTest {
Expand Down Expand Up @@ -57,6 +58,7 @@ void transform_returnJsonObject() {
assertThat(result.getJsonString(ID).getString()).isEqualTo(dataService.getId());
assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DCAT_DATA_SERVICE_TYPE);
assertThat(result.getJsonString(DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE).getString()).isEqualTo("description");
assertThat(result.getJsonString(DCAT_ENDPOINT_URL_OLD_ATTRIBUTE).getString()).isEqualTo("url");
assertThat(result.getJsonString(DCAT_ENDPOINT_URL_ATTRIBUTE).getString()).isEqualTo("url");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public interface PropertyAndTypeNames {
String DCAT_DATASET_ATTRIBUTE = DCAT_SCHEMA + "dataset";
String DCAT_DISTRIBUTION_ATTRIBUTE = DCAT_SCHEMA + "distribution";
String DCAT_ACCESS_SERVICE_ATTRIBUTE = DCAT_SCHEMA + "accessService";
String DCAT_ENDPOINT_URL_ATTRIBUTE = DCAT_SCHEMA + "endpointUrl";
@Deprecated(since = "0.10.0")
String DCAT_ENDPOINT_URL_OLD_ATTRIBUTE = DCAT_SCHEMA + "endpointUrl";
String DCAT_ENDPOINT_URL_ATTRIBUTE = DCAT_SCHEMA + "endpointURL";
String DCAT_ENDPOINT_DESCRIPTION_ATTRIBUTE = DCAT_SCHEMA + "endpointDescription";

//EDC
Expand Down

0 comments on commit 9f33db9

Please sign in to comment.