OpenAPITools / OpenAPITools/openapi-generator
[BUG][R] Generated samples/client/echo_api/r cannot be run
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The generated echo_api client for R breaks out of the box because of invalid R syntax:
The = [SUCCESS, FAILURE] has the appearance of Python code that has snuck in.
openapi-generator version
This is found in the master branch and is an issue in generated integration test code, not an issue found actually running the generator.
OpenAPI declaration file content or url
NA; this is an integration test bug
Generation Details
NA; this is an integration test bug
Steps to reproduce
Navigating to samples/client/echo_api/r, trying to load the package or run tests fails because of the syntax error:
r % Rscript -e 'devtools::test()'
ℹ Testing openapi
Error in `load_all()`:
! Failed to load R/data_query.R
Caused by error in `parse()`:
! At R/data_query.R:37:53: unexpected '['
36: #' @param ... Other optional arguments.
37: initialize = function(`id` = NULL, `outcomes` = [
Related issues/PRs
Not found
Suggest a fix
I am not quite sure what template source is responsible for this errant R code. According to
this uses the same template as the working petstore R client tests; however, the latter three all use settings
exceptionPackage: rlang
useRlangExceptionHandling: true
returnExceptionOnFailure: true
do to which they are following a quite different code generation path that might bypass wherever the issue is. I don't see SUCCESS or FAILURE anywhere in that template directory so I couldn't trace it back any further than that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with samples/client/echo_api/r/R/data_query.R at line 37 and reproduce the failure with devtools::test(). Compare the sample configuration in bin/configs/r-echo-api.yaml with the working R client test settings, then trace the R template path that produces = [SUCCESS, FAILURE]. Done means the generated echo_api R package loads and its tests run without the syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100