swagger-api / swagger-api/swagger-codegen

NullPointerException in SpringCodegen due to ModelUtils returning possibly null values in Operation[]

Open
#7,007 1 comment 0 reactions 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

If PathItem contains null values for Operations then line 418 in SpringCodegen throws a NPE.
for (Operation operation : operations) {
if (operation.getTags() != null) { // line 418

Swagger-codegen version

3.0.0_enhancements

Swagger declaration file content or url
Steps to reproduce
Related issues/PRs

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 at SpringCodegen line 418 and inspect how ModelUtils supplies the Operation[] for the OpenAPI input in modules\swagger-codegen\src\test\resources\3_0_0\test-api.yml. Run the provided spring-mvc generation command and verify that an input containing null operations completes without a NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.