You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating python-flask, if the OAS version is 3.1.0 and any operations specify any parameters by reference, then the generation fails with the following error:
[main] ERROR o.o.codegen.DefaultCodegen - String to be sanitized is null. Default to ERROR_UNKNOWN
[main] ERROR o.o.codegen.DefaultCodegen - String to be sanitized is null. Default to ERROR_UNKNOWN
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "swaggerParameterName" is null
at org.openapitools.codegen.languages.AbstractPythonConnexionServerCodegen.preprocessOpenAPI(AbstractPythonConnexionServerCodegen.java:413)
at org.openapitools.codegen.DefaultGenerator.configureGeneratorProperties(DefaultGenerator.java:290)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:1214)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:535)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
If you attempt the generation using python (instead of python-flask), it works.
If you modify the OAS version to 3.0.x in the API spec file, it works.
If you move the parameter definition to be inline instead of by reference, it works.
openapi-generator version
I have observed this problem with multiple versions, including v7.5.0. I don't recall the earliest version I observed it with, but I am not aware of a version where this ever worked. I do not believe it is a regression.
I also reproduced it using the latest master version of the generator.
Run the specified generate command on a file containing the specified API spec.
Observe that if the same spec is run through the validate option, it passes without complaint.
Observe that the problem does not happen if the OAS version in the spec is changed to 3.0.x, or if python is generated instead of python-flask, or if the parameter definition is moved to be inline instead of being a reference.
Related issues/PRs
I searched and could not find one.
Suggest a fix
I don't have time to dig into this now, but if/when I do, I'll be sure to update the issue. But now that I have a very simple way to reproduce it, I wanted to get the issue open.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
When generating python-flask, if the OAS version is 3.1.0 and any operations specify any parameters by reference, then the generation fails with the following error:
If you attempt the generation using python (instead of python-flask), it works.
If you modify the OAS version to 3.0.x in the API spec file, it works.
If you move the parameter definition to be inline instead of by reference, it works.
openapi-generator version
I have observed this problem with multiple versions, including v7.5.0. I don't recall the earliest version I observed it with, but I am not aware of a version where this ever worked. I do not believe it is a regression.
I also reproduced it using the latest master version of the generator.
OpenAPI declaration file content or url
Generation Details
generate -i openapi.yaml -g python-flask
Steps to reproduce
Run the specified generate command on a file containing the specified API spec.
Observe that if the same spec is run through the validate option, it passes without complaint.
Observe that the problem does not happen if the OAS version in the spec is changed to 3.0.x, or if python is generated instead of python-flask, or if the parameter definition is moved to be inline instead of being a reference.
Related issues/PRs
I searched and could not find one.
Suggest a fix
I don't have time to dig into this now, but if/when I do, I'll be sure to update the issue. But now that I have a very simple way to reproduce it, I wanted to get the issue open.
The text was updated successfully, but these errors were encountered: