How to add custom css in swagger-ui using .Net - swagger

Hi I'm using swagger ui in my web api project. It's very good but i am facing some ui issue in page.
this is the snapshot
How can I fix this issue by adding custom css. if i have to add custom css then where i have to add. in project file or in swagger ui project then i have to import. I am also using swashbuckle to show respone message.
Please suggest me.

In swashbuckle there is an option:
InjectStylesheet
that should do exactly what you need.
That is located in the SwaggerConfig.cs and is relatively simple to integrate.
See my example here:
https://github.com/heldersepu/SwashbuckleTest/blob/master/Swagger_Test/App_Start/SwaggerConfig.cs#L238

Related

Generate HTML page from Swagger documentation

I have simple ASP.Net WebApi that use Swagger, added it using Swashbuckle. I need to show Swagger documentation as a HTML page from my ASP.Net app.
I don't know where to start, any suggestion or link would be great.
Thanks!
When you activate Swagger you can see the docu online at
https://yourpath/swagger/index.html (or something like that).

How to use the shared layout with the swagger UI (ASP CORE)

I'm using swagger to make a documentation to my API in ASP.NET Core.
And, I would like to use the shared layout to get the same menu on the top of the documentation page.
I would love to do it without re-creating a custom css file, like the documentation says.
I just hope that someone though the same as me, and I was wondering how.
Thanks in advance,

ASPNetBoilerPlate and Swagger UI All API Calls Return 400 Error

I have created a new application using the ASPNetBoilerplate MVC 5x template. I have integrated Swagger UI according to the link:
https://aspnetboilerplate.com/Pages/Documents/Swagger-UI-Integration
Again using the MVC 5x version
When I run the app and use http://localhost:/swagger to access the API and try to run any of the GetAll methods, I get a 400 error.
I have modified the .cs file and created the .js files by cutting the code directly from the documentation and made the required changes.
What am I missing?
Thanks
I hope you are not navigating to http://localhost:/swagger because there's a typo error. Correct url is http://localhost/swagger
There's no official support for bearer token for Swagger UI Api calls. But you can checkout the link below. A developer achieves what you want
https://github.com/aspnetboilerplate/module-zero-core-template/pull/87

Integrate the swagger ui into hammock

I am building up a CDI/REST Environment as basis for several projects by using hammock. What I would like to have besides CDI and REST is also json schema for generating payload classes and an automatically generated REST API documentation via swagger ui.
I am now at the point where everything works (Weld3, Resteasy, Undertow, Swagger Core, Json Schema). The only thing missing is the integration of swagger UI into my hammock stack.
In another project I already worked with swagger UI. As far as I know it is based on HTML + JS with an entry point index.hml. How do I integrate this into my hammock stack. How to tell the undertow that there is a index.html and where to find it ?
I think my question is not only related to swagger, but to the idea to have the hammock stack with additional static html content.
John Ament has added a swagger module for Swagger 2.0-rc3 to Hammock 2.1-SNAPHOT (will be released as part of Hammock 2.1):
https://github.com/hammock-project/hammock/tree/master/swagger
As for hosting Swagger UI inside a Hammock app, you can add a few files from swagger-ui/dist/* to Hammock's static resources path:
https://github.com/hammock-project/hammock/wiki/Native-Filters#static-resources

Should swagger UI be a different application

I am currently battling a swagger configuration for my spring MVC RESTful services project. I decided to follow the swagger-spring but I fail to understand if the UI part of swagger should be a totally different project or should it reside in the same context on the container?
The swagger json from my spring mvc based RESTFul services is showing up correctly on a link like: http://<server>:<port>/<context>/api-docs but whenever I put in the swagger UI components in the application(JSP, CSS and JS files), I cannot access the swagger UI, which should look like this.
You need to update index.html that came with swagger-ui. Update below line to your webapp URL.
url: "http://petstore.swagger.wordnik.com/api/api-docs",

Resources