Retain resource attributes in write_package() - #195
Merged
Conversation
The latter doesn't allow to set NULL as the last argument
- In add_resource(): set reserved properties format, mediatype, encoding, dialect explicitly to NULL so they are at the correct position. For CSV resources dialect is set explicitely to null (correct position) and then updated or removed - In write_resource(): no longer start a resource from scratch, but edit the existing one: 1) add path right behind name and 2) set the reserved properties - Update tests
damianooldoni
approved these changes
Mar 28, 2024
damianooldoni
left a comment
Contributor
There was a problem hiding this comment.
Nice solutions to these two issues. And nothing against the use of standard if else on one line. It allows indeed to assign NULL to the output, and it's in my opinion slightly more readable than ifelse() or if_else() expressions. I will keep it in mind in my code writing.
Just two questions. Do you think worth to:
- Add a small paragraph in the vignette where you show what is retained in the metadata by running
write_package()? - Add a sentence with the limitations of
write_package()? For example, it writes resources as CSVs only right now.
Just a reflection while reading the very clear Getting Started.
Tests, checks passed locally and documentation correctly compiled.
Member
Author
|
Thanks for the review and suggestions Damiano! Here's why I won't update the documentation further:
I'll merge this and get started on releasing 1.1.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #191, fix #160.
write_resource()no longer builds a resource from scratch for added resources, but uses the existing metadata (including custom properties).add_resource()will set some of the reserved properties likemediatype(toNULL), so they are at a logical position. These are then populated bywrite_package()...are now included BEFORE the schema.ifelse(condition, x, y)forif(condition) x else y, since it allows to return NULL in y 64e4f9dReprex for fixed #191:
Created on 2024-03-26 with reprex v2.1.0