Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List as is #33

Merged
merged 19 commits into from
Sep 3, 2024
Merged

List as is #33

merged 19 commits into from
Sep 3, 2024

Conversation

AlexAxthelm
Copy link
Collaborator

@AlexAxthelm AlexAxthelm commented Aug 26, 2024

This PR adds functions to modify lists, given a path in the list. That is, given a list (preferably, but not necessarily named) and a position, you can apply a function to a given element. So with position = c("a", "b", "c"), the function would apply whatever function is provided to x$a$b$c and no other elements (thematically related to, but very different from purrr::map_depth).

Motivation: While working on a feature to handle multiple files in workflow.pacta, the param parsing function was throwing errors when checking that the params still validate against the schema after inheriting defaults.

The issue was that files was being specified as an array, but with the new schema, jsonlite::toJSON(..., auto_unbox = TRUE) was casting length-1 vectors as scalars (the behavior we want for almost everything else). To correct that issue, we need to mark the files entity as As-Is, using the I() function. The new functions in this PR allow that to happen.

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.07%. Comparing base (838ea80) to head (f8d3978).
Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   97.96%   98.07%   +0.10%     
==========================================
  Files           9       10       +1     
  Lines         591      622      +31     
==========================================
+ Hits          579      610      +31     
  Misses         12       12              

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

@AlexAxthelm AlexAxthelm requested a review from jdhoffa September 2, 2024 10:07
@AlexAxthelm AlexAxthelm self-assigned this Sep 2, 2024
@AlexAxthelm AlexAxthelm marked this pull request as ready for review September 2, 2024 10:07
@AlexAxthelm AlexAxthelm marked this pull request as draft September 3, 2024 06:54
@AlexAxthelm AlexAxthelm marked this pull request as ready for review September 3, 2024 07:31
Copy link
Member

@jdhoffa jdhoffa left a comment

Choose a reason for hiding this comment

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

lgtm!

And thank you for the in-depth description of the PR, will be very helpful in case we ever need to look at this in the future :-)

@AlexAxthelm AlexAxthelm merged commit 83b9e75 into main Sep 3, 2024
22 checks passed
@AlexAxthelm AlexAxthelm deleted the list-as-is branch September 3, 2024 08:48
AlexAxthelm added a commit to RMI-PACTA/workflow.pacta that referenced this pull request Sep 3, 2024
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.

2 participants