Skip to content

[BUG] [R] Circular references break R generator with StackOverflowError #9821

@zliebersbach

Description

@zliebersbach

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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

When using a swagger.json file with circular references RClientCodegen.java throws the following exception:

Exception in thread "main" java.lang.StackOverflowError
	at java.lang.StringBuilder.append(StringBuilder.java:136)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:762)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:752)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:771)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:752)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:771)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:752)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:728)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:771)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:752)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:771)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:752)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:728)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:771)
	at org.openapitools.codegen.languages.RClientCodegen.constructExampleCode(RClientCodegen.java:752)
        ...
openapi-generator version

5.2.0 (master)

OpenAPI declaration file content or url

https://api.splashback.io/data/swagger/v1/swagger.json

Generation Details

Simply clone master and build locally as instructed in README.md.

Java version 1.8.0 (OpenJDK), Maven version 3.6.3.

Steps to reproduce

Run openapi-generator-cli with the following arguments:

$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i swagger.json -g r -o /var/tmp/r_api_client
Related issues/PRs

No related issues could be found.

Suggest a fix

Working on a fix now. Will post if any issues arise!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions