swagger-api / swagger-api/swagger-parser

swagger-parser-v3 can throw NPE due to non-initialized instance fields.

Open
#682 40 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

swagger-parser-v3 can throw NPE parsing/loading Open API spec. The NPE is caused by io.swagger.v3.parser.util#ResolverFully because the schemas and examples fields are not initialized in all cases.

Version 2.0.0-rc3.

Our local fix was to just always initialize all the private fields maps with empty HashMap.

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 io.swagger.v3.parser.util.ResolverFully and trace the parsing/loading paths that use its schemas and examples fields. Reproduce the OpenAPI parsing failure against version 2.0.0-rc3, then verify that the fields are initialized in every path and the NPE no longer occurs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.