Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R] generation fails with a RuntimeException #11882

Open
oganm opened this issue Aug 26, 2022 · 0 comments
Open

[R] generation fails with a RuntimeException #11882

oganm opened this issue Aug 26, 2022 · 0 comments

Comments

@oganm
Copy link

oganm commented Aug 26, 2022

Description

Trying to use swagger-codegen on this json to generate R code by doing

java -jar swagger-codegen-cli.jar generate -l r -o swagger_gen -i openapi.txt

I get the error

Exception in thread "Thread-1" java.lang.RuntimeException: Could not generate api file for 'Default'
	at io.swagger.codegen.v3.DefaultGenerator.generateApis(DefaultGenerator.java:588)
	at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:791)
	at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:388)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at java.util.TreeMap.put(TreeMap.java:563)
	at java.util.TreeSet.add(TreeSet.java:255)
	at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
	at java.util.TreeSet.addAll(TreeSet.java:312)
	at io.swagger.codegen.v3.DefaultGenerator.processOperations(DefaultGenerator.java:976)
	at io.swagger.codegen.v3.DefaultGenerator.generateApis(DefaultGenerator.java:503)
	... 3 more

The same json can be used to generate python code without issues

java -jar swagger-codegen-cli.jar generate -l python -o swagger_gen -i openapi.txt
Swagger-codegen version

3.0.35

Swagger declaration file content or url

openapi.txt

Command line used for generation
java -jar swagger-codegen-cli.jar generate -l r -o swagger_gen -i openapi.txt

Steps to reproduce

Run the code below

wget https://github.com/swagger-api/swagger-codegen/files/9429783/openapi.txt
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.35/swagger-codegen-cli-3.0.35.jar -O swagger-codegen-cli.jar
java -jar swagger-codegen-cli.jar generate -l r -o swagger_gen -i openapi.txt

This will result in the error.

However doing

java -jar swagger-codegen-cli.jar generate -l python -o swagger_gen -i openapi.txt

will not

Related issues/PRs

#6995, #8482 Both appear to have the same error

Suggest a fix/enhancement

I am not familiar with what might be failing under the hood but trying other languages like python and java doesn't seem to be causing the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant