swagger-api / swagger-api/swagger-codegen
[any language] NPE in generate
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am getting an NPE when trying to generate clients (in various languages) for UK Companies House Public Data API
Exception in thread "Thread-0" java.lang.NullPointerException
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:602)
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:531)
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:250)
at io.swagger.v3.parser.converter.SwaggerConverter.readResult(SwaggerConverter.java:104)
at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:85)
at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
at io.swagger.codegen.v3.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:612)
at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:386)
at java.base/java.lang.Thread.run(Thread.java:829)
Swagger-codegen version
3.0.35
Swagger declaration file content or url
this is a bunch of files starting with this
https://developer-specs.company-information.service.gov.uk/api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json
to make it easier I am uploading them all as a zip file api.ch.gov.uk-specifications.zip
Command line used for generation
swagger-codegen generate -i http://127.0.0.1:31219/api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json -l python -o tmp
Steps to reproduce
- unzip api.ch.gov.uk-specifications.zip
- run
python -m SimpleHTTPServer 31219 - run
swagger-codegen generate -i http://127.0.0.1:31219/api.ch.gov.uk-specifications/swagger-2.0/spec/swagger.json -l python -o tmp
Related issues/PRs
Perhaps slightly similar to #8348
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with the uploaded specification and the documented swagger-codegen generate command, then inspect SwaggerConverter.convert at SwaggerConverter.java:602 and the surrounding calls from OpenAPIParser.readLocation and CodegenConfigurator.toClientOptInput. Done means the supplied Companies House specification generates the Python client without an uncaught NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100