File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 4141# ' @return
4242# ' - For `create_epidata_call`: an `epidata_call` object
4343# '
44+ # ' @importFrom purrr map_chr
4445create_epidata_call <- function (endpoint , params , meta = NULL ,
4546 only_supports_classic = FALSE ) {
4647 stopifnot(is.character(endpoint ), length(endpoint ) == 1 )
4748 stopifnot(is.list(params ))
4849 stopifnot(is.null(meta ) || is.list(meta ))
4950 stopifnot(is.logical(only_supports_classic ), length(only_supports_classic ) == 1 )
51+
52+ if (length(unique(meta )) != length(meta )) {
53+ cli :: cli_abort(c(
54+ " List of expected epidata fields contains duplicate entries" ,
55+ " i" = " duplicates in meta can cause problems parsing fetched data" ,
56+ " Please fix in `endpoints.R`"
57+ ))
58+ }
59+
60+ meta_field_names <- map_chr(meta , ~ .x $ name )
61+ if (length(meta_field_names ) != length(unique(meta_field_names ))) {
62+ cli :: cli_abort(c(
63+ " List of expected epidata fields contains duplicate names" ,
64+ " i" = " duplicates in meta can cause problems parsing fetched data" ,
65+ " Please fix in `endpoints.R`"
66+ ))
67+ }
68+
5069 if (is.null(meta )) {
5170 meta <- list ()
5271 }
You can’t perform that action at this time.
0 commit comments