swagger-api / swagger-api/swagger-parser
ResolverCache calls OpenAPIDeserializer.getSchema with null ParseResult
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
I get:
Exception while reading:
java.lang.NullPointerException
at io.swagger.v3.parser.util.OpenAPIDeserializer.getArray (OpenAPIDeserializer.java:1299)
at io.swagger.v3.parser.util.OpenAPIDeserializer.getSchema (OpenAPIDeserializer.java:2152)
at io.swagger.v3.parser.util.OpenAPIDeserializer.getSchema (OpenAPIDeserializer.java:2214)
at io.swagger.v3.parser.ResolverCache.loadRef (ResolverCache.java:148)
at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalSchema (ExternalRefProcessor.java:52)
at io.swagger.v3.parser.processors.ExternalRefProcessor.processRefToExternalSchema (ExternalRefProcessor.java:108)
at io.swagger.v3.parser.processors.SchemaProcessor.processReferenceSchema (SchemaProcessor.java:202)
at io.swagger.v3.parser.processors.SchemaProcessor.processComposedSchema (SchemaProcessor.java:118)
at io.swagger.v3.parser.processors.SchemaProcessor.processSchemaType (SchemaProcessor.java:50)
at io.swagger.v3.parser.processors.SchemaProcessor.processSchema (SchemaProcessor.java:39)
at io.swagger.v3.parser.processors.RequestBodyProcessor.processRequestBody (RequestBodyProcessor.java:44)
at io.swagger.v3.parser.processors.OperationProcessor.processOperation (OperationProcessor.java:45)
at io.swagger.v3.parser.processors.PathsProcessor.processPaths (PathsProcessor.java:84)
at io.swagger.v3.parser.OpenAPIResolver.resolve (OpenAPIResolver.java:49)
at io.swagger.v3.parser.OpenAPIV3Parser.readLocation (OpenAPIV3Parser.java:53)
at io.swagger.v3.parser.OpenAPIV3Parser.read (OpenAPIV3Parser.java:90)
at io.swagger.v3.parser.OpenAPIV3Parser.read (OpenAPIV3Parser.java:78)
This is caused by a null reference being passed for ParseResult. So I don't know where the parse error is. Indeed it's unclear how it would pass a non-null ParseResult, as it's a protected member of OpenAPIDeserializer. I've had to hack the source code to work out what my syntax error is.
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 ResolverCache.loadRef and follow the reported calls into OpenAPIDeserializer.getSchema and getArray, focusing on how ParseResult reaches the deserializer. Reproduce the reported parsing failure and make the parser expose the underlying syntax error instead of failing with a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100