swagger-api / swagger-api/swagger-parser

swagger2.0 parse error!

Open
#1,516 0 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

2021-01-15 18:17:59,823 INFO io.swagger.parser.Swagger20Parser: 90 - reading from http://localhost/v2/api-docs
2021-01-15 18:18:00,285 ERROR io.swagger.parser.util.RemoteUrl: 163 - unable to read
java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost/AjaxResult«中文字符»/
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:138)
at io.swagger.parser.util.RefUtils.readExternalRef(RefUtils.java:135)
at io.swagger.parser.util.RefUtils.readExternalUrlRef(RefUtils.java:70)
at io.swagger.parser.ResolverCache.loadRef(ResolverCache.java:122)
at io.swagger.parser.processors.ExternalRefProcessor.processRefToExternalDefinition(ExternalRefProcessor.java:49)
at io.swagger.parser.processors.ModelProcessor.processRefModel(ModelProcessor.java:95)
at io.swagger.parser.processors.ModelProcessor.processModel(ModelProcessor.java:34)
at io.swagger.parser.processors.ResponseProcessor.processResponse(ResponseProcessor.java:34)
at io.swagger.parser.processors.OperationProcessor.processOperation(OperationProcessor.java:47)
at io.swagger.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:103)
at io.swagger.parser.SwaggerResolver.resolve(SwaggerResolver.java:66)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:81)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:66)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:60)

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 Swagger20Parser.read and follow the stack through RemoteUrl.urlToString and RefUtils.readExternalUrlRef while resolving the external reference from http://localhost/v2/api-docs. Reproduce the HTTP 400 response for the URL containing Chinese characters; done means the Swagger 2.0 document parses without this failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.