sckott / apipkgen

Generate an R package from API specs
http://sckott.github.io/apipkgen/
Other
20 stars 2 forks source link

Dashes in endpoints cause malformed functions names #13

Closed eaurele closed 5 years ago

eaurele commented 5 years ago

Originally posted by @eaurele in https://github.com/ropenscilabs/apipkgen/issues/12#issuecomment-463584703

Complete reprex:

library(apipkgen)

castor_spec <- 
  "https://data.castoredc.com/api/swagger"
castor_spec_path <- "swagger.yaml"
download.file(castor_spec, castor_spec_path)

generate_pkg(
  "castorAPI/", 
  template_path = castor_spec_path
)
#> Creating package 'castorAPI' in '/tmp/RtmpbUACr5/reprex3c2d349a32'

devtools::install_local("castorAPI", force = TRUE, quiet = FALSE)
#> 
#>    checking for file ‘/tmp/Rtmp4i4wzz/fileace79080775/castorAPI/DESCRIPTION’ ...
#>   
#> ✔  checking for file ‘/tmp/Rtmp4i4wzz/fileace79080775/castorAPI/DESCRIPTION’ (534ms)
#> 
#> ─  preparing ‘castorAPI’:
#>    checking DESCRIPTION meta-information ...
#>   
#> ✔  checking DESCRIPTION meta-information
#>   
#> ─  checking for LF line-endings in source and make files and shell scripts
#> 
#> ─  checking for empty or unneeded directories
#> ─  building ‘castorAPI_0.0.0.9000.tar.gz’
#> 
#> Installing package into '/home/aurele/R/x86_64-pc-linux-gnu-library/3.5'
#> (as 'lib' is unspecified)
#> Error in i.p(...): (converted from warning) installation of package '/tmp/Rtmp4i4wzz/fileace3ffea594/castorAPI_0.0.0.9000.tar.gz' had non-zero exit status

unlink("castorAPI", TRUE, TRUE)
unlink(castor_spec_path, TRUE)
remove.packages("castorAPI")
#> Removing package from '/home/aurele/R/x86_64-pc-linux-gnu-library/3.5'
#> (as 'lib' is unspecified)
#> Error in find.package(pkgs, lib): there is no package called 'castorAPI'

standard output and standard error

trying URL 'https://data.castoredc.com/api/swagger'
downloaded 149 KB

* installing *source* package ‘castorAPI’ ...
** R
** byte-compile and prepare package for lazy loading
Error in study_study_id_record_record_id_data - point - collection_study <- function(study_id,  : 
  object 'study_study_id_record_record_id_data' not found
Error : unable to load R code in package ‘castorAPI’
ERROR: lazy loading failed for package ‘castorAPI’
* removing ‘/home/aurele/R/x86_64-pc-linux-gnu-library/3.5/castorAPI’
[WARNING] Could not parse YAML metadata at line 13 column 1: :7:21: Unexpected '
  '

Created on 2019-02-18 by the reprex package (v0.2.1)

sckott commented 5 years ago

thanks for the issue and the PR, will have a look

sckott commented 5 years ago

fixed in #14