datapackage-java
datapackage-java copied to clipboard
Incorrect check asText on ArrayNode element
Here you're checking contributors are not empty:
https://github.com/frictionlessdata/datapackage-java/blob/main/src/main/java/io/frictionlessdata/datapackage/Package.java#L775
That doesn't look like a correct way to do that. Contributors is ArrayNode which derived from ContainerNode and asText implemented there as:
@Override
public String asText() { return ""; }
https://github.com/FasterXML/jackson-databind/blob/2.15/src/main/java/com/fasterxml/jackson/databind/node/ContainerNode.java#L41
I think the right way would be:
!jsonNodeSource.get(Package.JSON_KEY_CONTRIBUTORS).isEmpty()
@iSnow
- Needs test cases
- valid concern, unfortunately down on my list of prios.