https://kotlinlang.org logo
Title
m

Manasseh

03/17/2023, 2:07 PM
Hey guys! I've been having issues setting up swagger UI for my project. I have the dependency listed, and paths set, but for some reasons, I keep getting an error "Failed to load API definition". You can find screenshots of my setup
j

Jonas TM

03/17/2023, 2:29 PM
Try to move the spec file into your resources folder otherwise its not part of the JAR.
m

Manasseh

03/17/2023, 2:33 PM
I did move it to resources/static/documentation.yaml but still facing same issue.
j

Jonas TM

03/17/2023, 2:44 PM
image.png
a

Arjan van Wieringen

03/17/2023, 3:34 PM
Why is there a double forward slash in your URL?
m

Manasseh

03/17/2023, 5:59 PM
@Jonas TM I just moved the documentation file to the resources folder but I'm still faced with the same error
@Arjan van Wieringen I'm not sure about that
It's probably coming from this:
I just noticed that when I change the url in the explore input field to use one forward slash, it works. Now how do I change the url to use one forward slash by default?
Screenshot_2023-03-17_19-09-08.jpg
So I finally found a way to solve this. For those interested in knowing how, I basically recreated the index.html file for swagger-ui, after noticing the default had the url set with double forward slash in its config. You can find screenshot of the default attached
Here's my recreated (using single forward slash) index.html and some exposed routes to serve the specification and index.html file.