Closed nanashili closed 1 year ago
@nanashili It's correct behavior, there are a few ways to integrate SwiggerUI into your server, so I leave this work outside the library. The simplest way is to use the dist
folder as in the example project.
You can create a separate route for the SwaggerUI index.html (I do this in my projects) or set up a default file for the public directory as in the example. When using the second method, do not forget to append /
at the end of the path when opening the page. Also in the scheme settings in Xcode specify the project root folder as a working directory.
Could you give an example on how to set the SwaggerUI index.html
as a route or even make a public file
the default file?
@nanashili sure
I use leaf in my projects so I renamed index.html
to swagger.leaf
, saved it to Resources/Views
folder, updated paths in the file and the route is
func boot(routes: RoutesBuilder) throws {
routes.get("api") { req in
req.view.render("swagger")
}
.excludeFromOpenAPI()
}
But the other way is easier, did you try to run the petstore project?
Hi @dankinsoid, yes I have tried to run the example project... Here is a recording of what happens.
Maybe try swagger/index.html
@dankinsoid I tried that and it doesn't work either
@nanashili Which swift/vapor version?
On the example I'm using the one provided by the library and on my personal API I'm using vapor 4.75.0 and swift 5.6
@nanashili To be honest I don't know what can be wrong
maybe try smth like chmod -R -x Example
So I'm playing around with this library that seems fantastic but the only issue is when you run the your backend there is no swagger website being generated only the swagger json. I tried the example and same issue persists.
The only part of the library that actually works is the fetching the
swagger.json
file