datapackage-java icon indicating copy to clipboard operation
datapackage-java copied to clipboard

Incorrect check asText on ArrayNode element

Open mike-podolskiy90 opened this issue 2 years ago • 1 comments

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

mike-podolskiy90 avatar Apr 22 '23 15:04 mike-podolskiy90

  • Needs test cases
  • valid concern, unfortunately down on my list of prios.

iSnow avatar Sep 04 '23 23:09 iSnow