swagger-api / swagger-api/swagger-parser
Parsing throws NumberFormatException: For input string: "post" in SwaggerConverter
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
The following is thrown:
java.lang.NumberFormatException: For input string: "post"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:668)
at java.base/java.lang.Integer.parseInt(Integer.java:786)
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:1140)
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:608)
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:531)
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:250)
at io.swagger.v3.parser.converter.SwaggerConverter.readResult(SwaggerConverter.java:104)
at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:85)
at io.swagger.v3.parser.OpenAPIV3Parser.read(OpenAPIV3Parser.java:124)
at io.swagger.v3.parser.OpenAPIV3Parser.read(OpenAPIV3Parser.java:113)
at redacted
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Running:
new OpenAPIV3Parser().read("swagger.json");
with swagger-parser-v2-converter-2.1.20.jar.
For the attached input.
swagger.json
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 SwaggerConverter.java line 1140 and trace the conversion path reached by OpenAPIV3Parser.read("swagger.json"). Reproduce the failure with the attached swagger.json and identify why "post" is parsed as an integer. Done means the attached input is read without NumberFormatException and the regression is covered by an appropriate parser test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100