Skip to content

Commit

Permalink
fix(units) : ignore unknown fields from unit file
Browse files Browse the repository at this point in the history
  • Loading branch information
loichenninger committed Jul 6, 2022
1 parent 77d898e commit 657f8be
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ public List<Unit> getUnits() throws Exception {
//Change this method when units are available in repository
final ObjectMapper objectMapper = new ObjectMapper();
URL resource = getClass().getClassLoader().getResource("measure-units.json");
List<Unit> unitList = objectMapper.readValue(
return objectMapper.readValue(
new File(resource.toURI()),
new TypeReference<List<Unit>>(){});
return unitList;
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/fr/insee/rmes/metadata/model/Unit.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package fr.insee.rmes.metadata.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Unit {

@JsonProperty("uri")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public class MetadataServiceImpl implements MetadataService {

@Override
public List<Unit> getUnits() throws Exception {
// getCodeList("a72e6e56-12a1-49b7-96c4-c724da3da5da",
// "c265b595-ced2-4526-88dc-151471de885d");
return metadataRepository.getUnits();
}

Expand Down

0 comments on commit 657f8be

Please sign in to comment.