Skip to content

[BUG] python-experimental broken on master (java.lang.NullPointerException) #7372

@mks-m

Description

@mks-m

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

python-experimental generator fails with java.lang.NullPointerException

openapi-generator version

master

OpenAPI declaration file content or url
openapi: 3.0.0
info: {title: foo, version: 1.0.0}
components:
  schemas:
    A: {type: object, additionalProperties: {$ref: '#/components/schemas/B'}}
    B: {type: array, items: {$ref: '#/components/schemas/C'}}
    C: {type: object}
paths: {}%
Generation Details
$ docker pull openapitools/openapi-generator-cli:latest
latest: Pulling from openapitools/openapi-generator-cli
Digest: sha256:ddbc3c6d4c9734f8bc80cab402a053cfbc856e036df24dfc6edb417376fc6534
Status: Image is up to date for openapitools/openapi-generator-cli:latest
$ docker run --rm -i --user `id -u`:`id -g` -v `pwd`:/src \
        openapitools/openapi-generator-cli:latest generate \
                -i /src/oapi.yaml \
                -g python-experimental \
                --package-name foo \
                -o /src/temp-openapi-client
[main] INFO  o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] WARN  o.o.c.ignore.CodegenIgnoreProcessor - Output directory does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: python-experimental (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'python-experimental' is considered experimental.
[main] INFO  o.o.c.languages.PythonClientCodegen - Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"' (Linux/Mac)
[main] INFO  o.o.c.languages.PythonClientCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] INFO  o.o.c.l.PythonClientExperimentalCodegen - generateAliasAsModel is hard coded to true in this generator. Alias models will only be generated if they contain validations or enums
[main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO  o.o.codegen.utils.URLPathUtils - 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[main] INFO  o.o.codegen.DefaultGenerator - Model A not generated since it's a free-form object
[main] INFO  o.o.codegen.DefaultGenerator - Model C not generated since it's a free-form object
Exception in thread "main" java.lang.NullPointerException
        at org.openapitools.codegen.languages.PythonClientExperimentalCodegen.postProcessAllModels(PythonClientExperimentalCodegen.java:432)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:485)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:852)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:432)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Steps to reproduce

^^^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions