question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] [R] Code generated not immediately useable

See original GitHub issue

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What’s the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What’s the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Using the (Docker-based) openapi-generator-cli on a yaml template used otherwise, I end up with an R package that is not installable as a portion of the files are not parseable by R.

To reproduce:

edd@rob:~$ mkdir /tmp/openapi-generator-issue; cd /tmp/openapi-generator-issue
edd@rob:/tmp/openapi-generator-issue/$ curl https://raw.githubusercontent.com/TileDB-Inc/TileDB-Cloud-API-Spec/master/openapi-v1.yaml -o openapi-v1.yaml
edd@rob:/tmp/openapi-generator-issue/$ docker run --rm -u 1000:1000 -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/openapi-v1.yaml -g r -o /local/r-pkg/
edd@rob:/tmp/openapi-generator-issue/$ cd r-pkg
edd@rob:/tmp/openapi-generator-issue/r-pkg$ R CMD build .                                          # standard step of building R package
edd@rob:/tmp/openapi-generator-issue/r-pkg$ R CMD INSTALL openapi_1.0.0.tar.gz

which fails on

edd@rob:/tmp/openapi-generator-issue/r-pkg$ R CMD INSTALL openapi_1.0.0.tar.gz 
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘openapi’ ...
** using staged installation
** R
Error in parse(outFile) : bad value
ERROR: unable to collate and parse R files for package ‘openapi’
* removing ‘/usr/local/lib/R/site-library/openapi’
* restoring previous ‘/usr/local/lib/R/site-library/openapi’
edd@rob:/tmp/openapi-generator-issue/r-pkg$ 

I am actually pretty experienced in R but find this hard to debug too. We can list the files that yield ‘bad value’ on sourcing though:

edd@rob:/tmp/openapi-generator-issue/r-pkg/R$ Rscript -e 'files <- dir("."); for (f in files) { res <- try(source(f), silent=TRUE); if (inherits(res, "try-error")) cat("Error processing file", f, "\n") }'
Error processing file activity_event_type.R 
Error processing file array_actions.R 
Error processing file array_task_status.R 
Error processing file array_task_type.R 
Error processing file array_type.R 
Error processing file datatype.R 
Error processing file filter_option.R 
Error processing file filter_type.R 
Error processing file invitation_status.R 
Error processing file invitation_type.R 
Error processing file layout.R 
Error processing file namespace_actions.R 
Error processing file organization_roles.R 
Error processing file pricing_aggregate_usage.R 
Error processing file pricing_currency.R 
Error processing file pricing_interval.R 
Error processing file pricing_type.R 
Error processing file pricing_unit_label.R 
Error processing file public_share_filter.R 
Error processing file querystatus.R 
Error processing file querytype.R 
Error processing file sso_provider.R 
Error processing file udf_actions.R 
Error processing file udf_language.R 
Error processing file udf_result_type.R 
Error processing file udf_type.R 
edd@rob:/tmp/openapi-generator-issue/r-pkg/R$ 


##### openapi-generator version

```sh
edd@rob:/tmp/openapi-generator-issue/r-pkg/R$ docker run --rm openapitools/openapi-generator-cli --version
openapi-generator-cli 5.0.0-SNAPSHOT
  commit : 52b80e9
  built  : 2020-06-18T17:05:53Z
  source : https://github.com/openapitools/openapi-generator
  docs   : https://openapi-generator.tech/

edd@rob:/tmp/openapi-generator-issue/r-pkg/R$ 
OpenAPI declaration file content or url

The YAML file is given above in the snippet and from here: https://github.com/TileDB-Inc/TileDB-Cloud-API-Spec/blob/master/openapi-v1.yaml

Command line used for generation

See above. I used your Docker container, downloaded yesterday

Steps to reproduce

See above, I followed your recommended invocation.

Related issues/PRs

N/A

Suggest a fix

N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
eddelbuettelcommented, Jun 22, 2020

I leaned on a colleague and we got it sorted out. Thumbs up for the PR https://github.com/OpenAPITools/openapi-generator/pull/5728. Resulting package now builds, lacks some documentation (normal at this stage) and fails some unit tests (ditto). I can live with that.

So take this as my thumbs up for merging the PR!

0reactions
eddelbuettelcommented, Sep 4, 2022

Absolutely. We are about to do some more work on the package generated by your tool (and some edits) off the yaml spec and I will aim to point some of the remaining things out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing R Extensions - The Comprehensive R Archive Network
Ideally, the R code files should only directly assign R objects and ... However, non- ASCII character strings may not be usable in...
Read more >
How to avoid annoying error "declared and not used"
The presence of an unused variable may indicate a bug, while unused imports just slow down compilation. Accumulate enough unused imports in your...
Read more >
9 reasons Why Your QR Code is Not Working - Beaconstac blog
Poor contrast ratio; Wrong Placement ; Overcrowded QR Code. You can, of course, avoid these issues by following the best QR Code generator...
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
doesn't seem to catch -r* version suffixes" status:RESOLVED resolution:FIXED ... Bug:1577 - "java-config generated /etc/env.d does not set ROOTPATH" ...
Read more >
Bug Pattern: PREDICTABLE_RANDOM - Find Security Bugs
Therefore, such values should not be passed directly to the filesystem API. If acceptable, the application should generate its own file names and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found