swagger-api / swagger-api/swagger-codegen

java.lang.NullPointerException when running config-help

Open
#10,365 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The documentation at https://github.com/swagger-api/swagger-codegen#getting-started seems incorrect, and the CLI command surface for the config-help command seems broken. I was just trying to find out what String to use for the "language" to be able to generate a client API for Node.js

Swagger-codegen version

3.0.20

Swagger declaration file content or url

N/A

Command line used for generation

N/A

Steps to reproduce

At first I followed the README and executed this command:

java -jar swagger-codegen-cli.jar help generate

This produces an error:

swagger-codegen: error: invalid choice: 'help' (choose from 'generate', 'config-help', 'meta', 'langs', 'version')

OK.. so maybe I'll try config-help..

java -jar swagger-codegen-cli.jar config-help

This also results in an error:

Exception in thread "Thread-1" java.lang.NullPointerException
        at java.lang.String.concat(String.java:2027)
        at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
        at io.swagger.codegen.v3.cli.cmd.ConfigHelp.run(ConfigHelp.java:17)
        at java.lang.Thread.run(Thread.java:748)

Finally realized there's a langs command, but sadly swagger-codegen doesn't support generating client APIs for node.js :(

(which seems odd btw)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented help generate command and the config-help command with swagger-codegen 3.0.20. Read CodegenConfigLoader.java:31 and ConfigHelp.java:17 alongside the CLI command definitions. Done means the documented command surface is accurate and config-help no longer fails with the reported NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.