Skip to content

[BUG] Error processing OpenAPI json file for python client #11763

@rpgoldman

Description

@rpgoldman

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? (just errors out)
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Trying to process the OpenAPI spec from the Owlery system, https://github.com/phenoscape/owlery (spec posted below) with the python and python-experimental systems, I get errors processing the files.

Using the command-line locally I get:

Exception in thread "main" java.lang.RuntimeException: Could not process operation:
  Tag: class Tag {
    name: Knowledgebases
    description: null
    externalDocs: null
}
  Operation: null
  Resource: get /kbs
  Schemas: {}
  Exception: Cannot read field "isEnum" because "cp" is null

Using the docker image I get:

Exception in thread "main" java.lang.RuntimeException: Could not process operation:
  Tag: class Tag {
    name: Knowledgebases
    description: null
    externalDocs: null
}
  Operation: null
  Resource: get /kbs
  Schemas: {}
  Exception: null
	at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1163)
	at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:1054)
	at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:549)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:891)
	at org.openapitools.codegen.cmd.Generate.execute(Generate.java:441)
	at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.NullPointerException
	at org.openapitools.codegen.languages.PythonClientCodegen.fromProperty(PythonClientCodegen.java:440)
	at org.openapitools.codegen.DefaultCodegen.getContent(DefaultCodegen.java:6755)
	at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:4011)
	at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1131)
	... 6 more
openapi-generator version

5.4.0

OpenAPI declaration file content or url

YAML is available here: https://gist.github.com/rpgoldman/a65d85f15a9f8b08298cb19446c1b7f0

Generation Details

I believe "steps to reproduce," below, has all the required information, but happy to collect more if needed.

Steps to reproduce

CLI:

 openapi-generator generate --package-name owlery_client -v --generator-name python --output owlery-client -i swagger.json

Docker:

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i /local/swagger.json -g python-experimental -o /local/owlery-client
Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions