swagger-parser: Unable to load an OpenAPI3 spec from the classpath
In my Vert.x 3.5.0 project, I am trying to use an OpenAPI3 specification stored in src/main/resources/adjective.yaml. The problem is that the URL for the file should be classpath:adjective.yaml, but the code in the following line:
This code assumes the URL MUST be either http or file. This will not allow from loading the spec from the classpath.
About this issue
- Original URL
 - State: closed
 - Created 6 years ago
 - Comments: 28 (14 by maintainers)
 
There was a discussion on the Vert.x Discord about this and it has nothing to do with swagger-parser. You need to set a System Property as shown here: https://github.com/InfoSec812/budjet-vertx-hibernate-reactive-openapi/blob/main/modules/api/src/main/java/com/zanclus/BudjetLauncher.java#L6
@gracekarina I believe the (as yet unreleased) changes which @slinkydeveloper made for the 3.5.1 version of Vert.x are working perfectly and we can close this issue.
@gracekarina Unfortunately, this is work on a pre-release branch which will not be accessible for you to test unless you want to download and build
vertx-webyourself. Once @slinkydeveloper and I can get it working, we will update this issue.I’ll have a look and get back to you.
That is the exact exception caused by not being able to read the spec file. Let me tag a version and I will get back to you.
Deven Phillips Senior Consulting Engineer Red Hat, Open Innovation Labs
On Jan 26, 2018 3:32 PM, “Grace Karina Gonzalez Diaz” < notifications@github.com> wrote:
NullPointerException…
The code runs fine when the spec file is present on the local filesystem (e.g. Running in my IDE or from Maven), but once I package the whole thing up as a FatJar which includes the spec file, the parser is unable to read the file from inside of the fatjar’s classpath.
Example code available at: https://github.com/rhoar-shootout/rhoar-vertx
Thanks!