Closed jesse-ross closed 1 year ago
This PR looks good to merge. I tested it quickly on @amsnyder's drb-estuary-salinity-data-release metadata yml and the new version of the function identified the missing entry at metadata-fax
.
Test:
remove.package('meddle')
remotes::install_github('USGS-R/meddle@improve-yaml-validation')
Restarted session + edited the metadata yml to makes sure no txt was entered at metadata-fax
> library(meddle)
Loading required package: maps
Loading required package: mapdata
USGS Support Package: https://owi.usgs.gov/R/packages.html#support
> render(filename = 'out_xml/fgdc_metadata_tmp_nofax.xml',
+ "in_text/text_data_release.yml",
+ spatial_metadata)
Error in render.character(filename = "out_xml/fgdc_metadata_tmp_nofax.xml", :
All elements of the YAML file must be defined. The following elements are blank: metadata-fax
>
When
render
is given a YAML file which has empty elements, it fails in a very unfriendly way. Example, which arose from this YAML file:This PR adds a test for empty elements, and gives a descriptive error message if there are any.
I'm calling this a draft because I haven't done a data release before, and I'm not sure that this is the right approach. Possibly the right approach might be to trim any empty values rather than failing?