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

[BUG] NullPointerException when loading configuration #11276

Closed
idkCpp opened this issue Jan 11, 2022 · 7 comments
Closed

[BUG] NullPointerException when loading configuration #11276

idkCpp opened this issue Jan 11, 2022 · 7 comments

Comments

@idkCpp
Copy link

idkCpp commented Jan 11, 2022

Description

I have an automatic build pipeline that uses the openapi generator to create a python-flask server.
Today the builds started failing with a NullPointerException and the below mentioned stack-trace.

openapi-generator version

I use the following Docker Image:
openapitools/openapi-generator-cli latest 132da9168d58

OpenAPI declaration file content or url

Seems to be irrelevant, also happens with the swagger petstore.

Generation Details
docker run --rm -u $(id -u) -v "$(pwd):/local" openapitools/openapi-generator-cli generate -i /local/openapi.yaml -g python-flask -o /local/app -c /local/config.json --package-name PKGNAM --skip-operation-example

Contents of config.json:

{
        "packageName": "PKGNAM",
        "serverPort": "8080"
}
Output
Exception in thread "main" java.lang.NullPointerException
	at java.base/java.lang.String.concat(Unknown Source)
	at org.openapitools.codegen.CodegenConfigLoader.forName(CodegenConfigLoader.java:48)
	at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:94)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:272)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
@JLEdward
Copy link

JLEdward commented Jan 12, 2022

Also starting to get this NullPointerException from yesterday. Strangely I do not see any version changes on the openapi-generator-cli.jar:

$ java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar version
5.4.0-SNAPSHOT

Anyone aware of any solution to this please? For now I'm reverting to 5.3.1.

@willgit-sl
Copy link

Also starting to get this NullPointerException from yesterday. Strangely I do not see any version changes on the openapi-generator-cli.jar:

$ java -jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar version
5.4.0-SNAPSHOT

Anyone aware of any solution to this please? For now I'm reverting to 5.3.1.

I'm seeing the same issue. Didn't have to go back to 5.3.1, I just went back to commit 361b593

@provokateurin
Copy link
Contributor

Hello, I'm also facing this issue and did a bisect and found out that commit dd3bba8 broke it. @spacether pinging you as the author of the commit.

@LPCmedia
Copy link

This is rather blocker for us. Can we revert or is there something we need to add to the config file ?

@idkCpp
Copy link
Author

idkCpp commented Jan 13, 2022

I now use openapitools/openapi-generator-cli:latest-release instead of openapitools/openapi-generator-cli:latest. For me this works fine.

@spacether
Copy link
Contributor

Thank you for reporting this. I am investigating it.
Short term solutions are to use our latest release or to add the generator name into your config file. If I can't come up with a quick fix then I will revert it.

spacether added a commit to spacether/openapi-generator that referenced this issue Jan 14, 2022
This reverts commit dd3bba8.
Because it broke peoples builds per this issue OpenAPITools#11276
spacether added a commit that referenced this issue Jan 14, 2022
This reverts commit dd3bba8.
Because it broke peoples builds per this issue #11276
@spacether
Copy link
Contributor

spacether commented Jan 14, 2022

Sorry for creating this bug in master branch.
The master branch has been fixed by #11316
Separately I will work on a new PR to add the feature back in and I will include a test which covers this use case of:

  • g (generatorName) passed in to command line args
  • generatorName not present in the config file

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

No branches or pull requests

6 participants