Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why there are no themes for swagger-ui? [closed]

I like swagger for documenting Restful APIs very much, especially "Try it out!" button, but swagger-ui interface doesn't look very cool.

And I cannot believe there are no templates for such amazing open source tool (or I can't find any)?

I don't want it for free.. Like http://getbootstrap.com/ has many sites to buy themes (like https://wrapbootstrap.com/), why I cannot find any site for swagger themes?

like image 263
Arūnas Smaliukas Avatar asked Jan 19 '15 20:01

Arūnas Smaliukas


People also ask

What is the difference between Swagger and Swagger UI?

Swagger Editor: Swagger Editor lets you edit OpenAPI specifications in YAML inside your browser and to preview documentations in real time. Swagger UI: Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from an OAS-compliant API.

How do you customize Swagger?

Customize the Swagger UI Using Javascript js under Content folder. Right click on SwaggerScript. js file and select Embedded Resource option for Build Action as shown below. Here I added javascript code in SwaggerScript.

How do I change my Swagger UI?

You can change default swagger-ui path programmatically using ApplicationListener<ApplicationPreparedEvent> . The idea is simple - override springdoc. swagger-ui. path=/custom/path before your Spring Boot application starts.

How do I hide models in Swagger UI?

To hide the "Models" section, add defaultModelsExpandDepth: -1 to the Swagger UI configuration code in your index. html . Note the option name uses plural Model*s* not Model . Swagger UI also has many other configuration options that control API documentation rendering.


2 Answers

A late answer, albeit a good one. This is pretty awesome! A slick implementation, and he has customized many things that are easy to tweak yet again for your needs: https://github.com/jensoleg/swagger-ui.

Credits go to this google group: https://groups.google.com/forum/#!topic/swagger-swaggersocket/oeMyayrvKRI. Strange that this has not been posted here yet.

For an action demo, please check out this link: http://senodio.com/site/swagger/#!/pet/addPet

--

EDIT: Recently found that the DEMO is down, so I forked the Repo (https://github.com/MartinSahlen/swagger-ui) and created a simple node/express server that runs on heroku. Please note that this a free heroku dyno, so it might take a while to load (~20 sec) if there is low activity on it for some time.

You're welcome: http://sleepy-harbor-80783.herokuapp.com/#!/pet/addPet

EDIT 2: Just came across another one that looks promising: https://github.com/legendecas/material-swagger-ui . It also seems that the swagger ui I am hosting now is resurrected at http://swaggerui.herokuapp.com/. Keeping mine as well in case it is taken down again.

like image 197
martin.code Avatar answered Sep 20 '22 16:09

martin.code


This is a collection of stylesheet themes that can be applied to Swagger UI. Link below to my repo on how to use.

Hope this helps.

https://github.com/ostranme/swagger-ui-themes

like image 32
ostranme Avatar answered Sep 17 '22 16:09

ostranme