Skip to content

Arrays#297

Merged
peterdesmet merged 14 commits into
mainfrom
arrays
Jun 18, 2026
Merged

Arrays#297
peterdesmet merged 14 commits into
mainfrom
arrays

Conversation

@sannegovaert

@sannegovaert sannegovaert commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #276 .

peterdesmet and others added 9 commits April 17, 2025 10:25
To avoid:

Caused by error in `enc2utf8()`:
! argument is not a character vector
To avoid:

Caused by error in `enc2utf8()`:
! argument is not a character vector
To avoid error by readr::col_factor()

`! `levels` must be `NULL` or a character vector:`
`- `levels` is a 'list'`
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (661a457) to head (00be54c).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #297   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines          670       672    +2     
=========================================
+ Hits           670       672    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sannegovaert

Copy link
Copy Markdown
Contributor Author

The fix is tested with 2 acoustic Camtrap DP: camera-traps/bioacoustics#30

@sannegovaert
sannegovaert marked this pull request as ready for review June 12, 2026 10:44
@sannegovaert
sannegovaert requested a review from peterdesmet June 12, 2026 10:44
@sannegovaert sannegovaert self-assigned this Jun 12, 2026
- This is a good test that single-value arrays are retained as is.
- For v2 I had to switch the value/label example to the first resource.

@peterdesmet peterdesmet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have this fixed! I made a number of important changes:

  • I've updated the example dataset so that the missingValues of the second resource are a single-element array. That way, we can capture the updated behaviour where such elements are retained with the test write_package() writes unaltered datapackage.json as is.
  • enum is now always written as a list. Before, single element enum (very rare!) would be written as "enum": "value" which is incorrect. Did not create a test, as it's really an edge case (that is now resolved).
  • I've described in NEWS that multiple path and missingValues will now be written on multiple lines. This will affect us when working with the bird-tracking datapackage.json files. 😁

@peterdesmet
peterdesmet merged commit 6807f46 into main Jun 18, 2026
9 checks passed
@peterdesmet
peterdesmet deleted the arrays branch June 18, 2026 15:17
@peterdesmet peterdesmet added this to the 1.3.0 milestone Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handling of single element arrays in datapackage.json

2 participants