swagger-api / swagger-api/swagger-parser
SwaggerParserExtension is not extensible
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
In the doc, it's written that we can use Java SPI to provide customized extension for SwaggerParserExtension.
But when extensions are being read, OpenAPIV3Parser#getExtensions() always add OpenAPIV3Parser in first. So any class that we add in META-INF/services/io.swagger.v3.parser.core.extensions.SwaggerParserExtension will never be used, because default parser return a non null object for a valid JSON.
I wanted to use that mechanism in order to mock the parser in an unit test.
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 OpenAPIV3Parser#getExtensions() and the SwaggerParserExtension SPI registration described in the documentation. Inspect how META-INF/services/io.swagger.v3.parser.core.extensions.SwaggerParserExtension is loaded and how the default parser is prioritized. Done means a registered custom extension can be selected for mocking instead of being bypassed by the default parser, with regression coverage where the existing tests allow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100