[BUG] Error processing OpenAPI json file for python client
See original GitHub issueBug 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Zalando RESTful API and Event Guidelines
Zalando's software architecture centers around decoupled microservices that provide functionality via RESTful APIs with a JSON payload.
Read more >JSON and APIs with Python - Towards Data Science
This pure data is often in a JSON (JavaScript Object Notation) format, which we can then parse through and extract what we need...
Read more >How to Use Swagger Inspector
Swagger Inspector lets you make calls to an API based on the API definition. We support OpenAPI 2.0 (aka Swagger 2.0), OpenAPI 3.0,...
Read more >Handling Errors - FastAPI
FastAPI has some default exception handlers. These handlers are in charge of returning the default JSON responses when you raise an HTTPException and...
Read more >Minimal APIs quick reference - Microsoft Learn
When a web app is created with Visual Studio or dotnet new , a Properties/launchSettings.json file is created that specifies the ports the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great, thanks. I have worked around that for now by adding schemas everywhere. I was having the error reported above when using
python-experimental
, but with the_JAVA_ARGS
workaround now both of the code generators work for me!Aha! For my sub-issue 2 above, the magical answer is to prepend
to the invocation of
openapi-generator
. I can use the python-experimental generator as follows:Then it runs to completion successfully.