You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swagger-gradle-plugin does not load io.swagger.v3.jaxrs2.ext.OpenAPIExtension classes.
The code in io.swagger.v3.jaxrs2.ext.OpenAPIExtensions uses ServiceLoader.load(OpenAPIExtension.class) to load extensions. The problem is that ServiceLoader uses Thread.currentThread().getContextClassLoader() when a ClassLoader is not specified which cannot see the META-INF\services files from within a gradle plugin.
Using ServiceLoader.load(OpenAPIExtension.class, OpenAPIExtensions.class.getClassLoader()) should load services correctly.
The text was updated successfully, but these errors were encountered:
aharin
changed the title
OpenAPIExtension's are not loaded up by swagger-gradle-plugin
OpenAPIExtension's are not loaded by swagger-gradle-plugin
Oct 29, 2020
I, too, am hitting this particular issue. I am attempting to use the Gradle plugin as a means of auto-generating the spec in order to provide an API diff on PRs. We use an OpenAPIExtension as a means of parsing our custom auth annotations and adding both the associated ApiResponse objects and the security scheme to the operation.
Being unable to generate the spec via the Gradle plugin means that diffing our API spec requires booting our Java application, querying the endpoint, and then generating a diff. Ultimately, it wastes several precious CI minutes on every PR commit's status checks.
swagger-gradle-plugin does not load
io.swagger.v3.jaxrs2.ext.OpenAPIExtension
classes.The code in
io.swagger.v3.jaxrs2.ext.OpenAPIExtensions
usesServiceLoader.load(OpenAPIExtension.class)
to load extensions. The problem is thatServiceLoader
usesThread.currentThread().getContextClassLoader()
when aClassLoader
is not specified which cannot see theMETA-INF\services
files from within a gradle plugin.Using
ServiceLoader.load(OpenAPIExtension.class, OpenAPIExtensions.class.getClassLoader())
should load services correctly.The text was updated successfully, but these errors were encountered: