Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: No Visual Swagger Generated.... #3

Open
nanashili opened this issue Apr 3, 2023 · 11 comments
Open

Question: No Visual Swagger Generated.... #3

nanashili opened this issue Apr 3, 2023 · 11 comments
Assignees
Labels
question Further information is requested

Comments

@nanashili
Copy link

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

@dankinsoid
Copy link
Owner

dankinsoid commented Apr 7, 2023

@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.

@dankinsoid dankinsoid self-assigned this Apr 7, 2023
@dankinsoid dankinsoid added the question Further information is requested label Apr 7, 2023
@nanashili
Copy link
Author

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?

@dankinsoid
Copy link
Owner

dankinsoid commented Apr 11, 2023

@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?

@nanashili
Copy link
Author

Hi @dankinsoid, yes I have tried to run the example project... Here is a recording of what happens.

Screen.Recording.2023-04-11.at.10.38.52.mov

@dankinsoid
Copy link
Owner

Maybe try swagger/index.html

@nanashili
Copy link
Author

@dankinsoid I tried that and it doesn't work either

@dankinsoid
Copy link
Owner

@nanashili
Which swift/vapor version?

@nanashili
Copy link
Author

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

@dankinsoid
Copy link
Owner

@nanashili To be honest I don't know what can be wrong
maybe try smth like chmod -R -x Example

@HakanKumdakciMobven
Copy link

@nanashili did you solve this?

@dankinsoid
Copy link
Owner

dankinsoid commented Sep 25, 2024

@HakanKumdakciMobven @nanashili you can try use stoplightDocumentation, it's not a Swagger UI, but much easier to configure, no html resources is needed, just one call routes.stoplightDocumentation

@dankinsoid dankinsoid reopened this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants