[BUG] [python-experimental] Type null not handled properly in toExampleValue
Created by: MalteEbner
Description
With the following configuration, the openapi-generator with python-experimental breaks
- openapi-generator-cli 5.4.0, installed via npm
- using python-experimental
- using the
OAI/OpenAPI-Specification/main/examples/v2.0/yaml/petstore.yaml
Switching to python (non-experimental) or other specs solved the problem.
openapi-generator version
5.4.0
Steps to reproduce
Google colab for reproduction: https://colab.research.google.com/drive/1z2KnELth4HfaK-36ntjr_7v9g65QF63W?usp=sharing
Fully self-contained substeps in Google colab:
# install openapi-generator-cli
!npm install -g @openapitools/openapi-generator-cli
!openapi-generator-cli version-manager set 5.4.0
# get the PetStore.yaml and generate it:
!wget https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v2.0/yaml/petstore.yaml
!ls
!openapi-generator-cli generate -i petstore.yaml -g python-experimental
# Error:
# first some
[main] WARN o.o.c.l.AbstractPythonCodegen - Type null not handled properly in toExampleValue
# then finally a
java.lang.NullPointerException
Related issues/PRs
- https://github.com/OpenAPITools/openapi-generator/issues/10143
- https://github.com/OpenAPITools/openapi-generator/issues/8663 shows exactly the same error
- https://github.com/OpenAPITools/openapi-generator/issues/7824
- https://github.com/OpenAPITools/openapi-generator/pull/9131 fixed it in the python branch
Suggest a fix
- fix it in the generator