swagger-api / swagger-api/swagger-codegen
NullPointerException in SpringCodegen due to ModelUtils returning possibly null values in Operation[]
Open
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
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
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