Skip to content

Commit

Permalink
fix: fix contact point parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopacheco1 committed Aug 6, 2024
1 parent a717332 commit b853016
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion _http/ckan.http
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GET https://catalogue.portal.dev.gdi.lu/api/3/action/enhanced_package_search?fq=
GET https://catalogue.portal.dev.gdi.lu/api/3/action/enhanced_package_show?id=bc7664b4-284a-44c0-9ce8-bc3d6882e7fe

###
GET https://catalogue.portal.dev.gdi.lu/api/3/action/enhanced_package_show?id=dummy
GET https://catalogue.portal.dev.gdi.lu/api/3/action/enhanced_package_show?id=bc7664b4-284a-44c0-9ce8-bc3d6882e7fe

###
GET https://catalogue.portal.dev.gdi.lu/api/3/action/enhanced_package_show?id=dummy
Expand Down
4 changes: 2 additions & 2 deletions _http/discovery.http
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Content-Type: application/json
}

###
GET http://localhost:8080/api/v1/datasets/577f4d4b-a861-4178-91d5-f46019174193
GET http://localhost:8080/api/v1/datasets/bc7664b4-284a-44c0-9ce8-bc3d6882e7fe

###
GET http://localhost:8080/api/v1/datasets/dummy
Expand All @@ -45,4 +45,4 @@ GET http://localhost:8080/api/v1/datasets/dummy
GET http://localhost:8080/api/v1/datasets/577f4d4b-a861-4178-91d5-f46019174193.ttl

###
GET http://localhost:8080/api/v1/organizations
GET https://api.portal.dev.gdi.lu/discovery/api/v1/organizations
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public RetrievedDataset from(CkanPackage ckanPackage) {
.spatial(value(ckanPackage.getSpatialUri()))
.distributions(distributions(ckanPackage))
.keywords(keywords(ckanPackage))
.contacts(contactPoint(ckanPackage.getContacts()))
.contacts(contactPoint(ckanPackage.getContactPoint()))
.datasetRelationships(relations(ckanPackage.getDatasetRelationships()))
.dataDictionary(dictionary(ckanPackage.getDataDictionary()))
.build();
Expand Down Expand Up @@ -86,8 +86,8 @@ private List<DatasetDictionaryEntry> dictionary(List<CkanDatasetDictionaryEntry>

private ContactPoint contactPointEntry(CkanContactPoint value) {
return ContactPoint.builder()
.name(value.getName())
.email(value.getEmail())
.name(value.getContactName())
.email(value.getContactEmail())
.build();
}

Expand Down
13 changes: 6 additions & 7 deletions src/main/openapi/ckan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,10 @@ components:
type: array
items:
$ref: "#/components/schemas/CkanTag"
contacts:
contact_point:
type: array
items:
$ref: "#/components/schemas/CkanContactPoint"
title: Contacts
creators:
type: array
items:
Expand Down Expand Up @@ -295,15 +294,15 @@ components:
- title
CkanContactPoint:
properties:
name:
contact_name:
type: string
title: name
email:
contact_email:
type: string
title: email
contact_uri:
type: string
title: email
required:
- name
- email
CkanCreator:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion src/main/openapi/discovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ components:
title: Keywords
provenance:
type: string
title: Contact URI
title: Provenance
spatial:
$ref: "#/components/schemas/ValueLabel"
title: Spatial
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,14 @@ void can_parse() {
.lastModified("2024-03-19T13:37:05.472970")
.build()
))
.contacts(List.of(
CkanContactPoint.builder().name("Contact 1").email("[email protected]")
.contactPoint(List.of(
CkanContactPoint.builder()
.contactName("Contact 1")
.contactEmail("[email protected]")
.build(),
CkanContactPoint.builder().name("Contact 2").email("[email protected]")
CkanContactPoint.builder()
.contactName("Contact 2")
.contactEmail("[email protected]")
.build()
))
.creators(List.of(
Expand Down
7 changes: 7 additions & 0 deletions src/test/resources/mappings/package_show.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
"state": "active",
"temporal_end": "2025-12-31",
"temporal_start": "2020-01-01",
"contact_point": [
{
"contact_email": "file:///srv/app/[email protected]",
"contact_name": "Chief Technology Officer of BioData.pt",
"contact_uri": ""
}
],
"theme": [
{
"display_name": "Bio ontology",
Expand Down

0 comments on commit b853016

Please sign in to comment.