OpenAPITools / OpenAPITools/openapi-generator
[REQ] [maven] improve error message when <inputSpec> cannot be loaded/found
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
Disclaimer: it's not a feature nor a bug, but an improvement but i didnt see that option.
When the <inputSpec> cannot be loaded from an URL (in my case when access permission is missing) there's a huge stacktrace, like so:
java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml
at ... lots of stack frames ...
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml
[WARNING] Exception while reading:
io.swagger.v3.parser.exception.ReadContentException: Unable to read location `https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml`
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml at ... lots of stack frames ...
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml
at ... lots of stack frames ...
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml
at ... lots of stack frames ...
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml
at ... lots of stack frames ...
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml
at ... lots of stack frames ...
Caused by: java.io.FileNotFoundException: https://raw.githubusercontent.com/my-repo/foo/bar/v0.ea.yml java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.OpenAPI.getExtensions()" because "openAPI" is null
at ... lots of stack frames ...
java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.OpenAPI.getExtensions()" because "openAPI" is null
at ... lots of stack frames ...
Reading this usually from the bottom up, it hard to graps what the problem is w/o going all the way up and not overlooking the relevant: java.io.FileNotFoundException:
Especially when the URL is correct but one lacks the proper token -- or in my case used a tag or branch that disappeared.
Describe the solution you'd like
In the meanwhile I have learned this, but for the new comers it would be helpful to have a more telling/verbose error message it at the bottom/last Exception
Smth. along these lines:
Error: <inputSpec> @ ${path/url} cannot be loaded (URL returned 404).
If there is an <auth> config'ed, then also add a hint like so:
You have provided an `<auth>` config. In some cases insufficient authorizations are reported as 404s.
Describe alternatives you've considered
n/a
Additional context
n/a
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 the Maven plugin's inputSpec loading and error-handling path, then reproduce the failure with an inaccessible or missing URL. Done means the final output identifies the inputSpec URL and loading failure clearly, with an authentication hint when the configured response warrants it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100