swagger-api / swagger-api/swagger-parser
[Java/Jaxrs/Resteasy] NPE thrown when response is defined with $ref without content
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
We wanted to fix swagger-api/swagger-codegen/issues/8859 in OpenAPITools/openapi-generator thanks to this PR OpenAPITools/openapi-generator/pull/1416
Then we faced this issue OpenAPITools/openapi-generator/issues/1420.
It seems to come from swagger parser.
Here is the exception :
[WARNING] Exception while reading:
java.lang.NullPointerException
at io.swagger.v3.parser.ResolverCache.updateLocalRefs(ResolverCache.java:162)
at io.swagger.v3.parser.ResolverCache.loadRef(ResolverCache.java:152)
at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalResponse(ExternalRefProcessor.java:205)
at io.swagger.v3.parser.processors.ResponseProcessor.processReferenceResponse(ResponseProcessor.java:76)
at io.swagger.v3.parser.processors.ResponseProcessor.processResponse(ResponseProcessor.java:38)
at io.swagger.v3.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:56)
at io.swagger.v3.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:83)
at io.swagger.v3.parser.OpenAPIResolver.resolve(OpenAPIResolver.java:49)
at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:53)
at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:19)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:552)
at org.openapitools.codegen.plugin.CodeGenMojo.execute(CodeGenMojo.java:582)
Please what is your point of view about this issue?
We used OpenAPITools/openapi-generator 3.3.3-SNAPSHOT (java/jaxrs/resteasy).
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 with the stack trace at ResolverCache.java:162 and follow the response-reference path through ResolverCache.java, ExternalRefProcessor.java, and ResponseProcessor.java. Reproduce the OpenAPI response that uses $ref without content and verify that resolving it no longer throws a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100