twskj / Pretty Swag
Licence: mit
Pretty UI for Swagger spec
Stars: ✭ 112
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Pretty Swag
Drf Yasg
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
Stars: ✭ 2,523 (+2152.68%)
Mutual labels: rest-api, swagger, swagger-ui, documentation-generator
Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+2422.32%)
Mutual labels: rest-api, swagger, swagger-ui, api-documentation
Tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 1,941 (+1633.04%)
Mutual labels: rest-api, swagger-ui, swagger
Openapi Viewer
Browse and test a REST API described with the OpenAPI 3.0 Specification
Stars: ✭ 82 (-26.79%)
Mutual labels: swagger, swagger-ui, api-documentation
Drf Autodocs
Ultimately automated DRF documentation rendering(UNMAINTAINED)
Stars: ✭ 82 (-26.79%)
Mutual labels: rest-api, api-documentation, documentation-generator
Angular Swagger Ui
An angularJS implementation of Swagger UI
Stars: ✭ 131 (+16.96%)
Mutual labels: swagger, swagger-ui, api-documentation
Hexo Theme Doc
A documentation theme for the Hexo blog framework
Stars: ✭ 222 (+98.21%)
Mutual labels: swagger, swagger-ui, api-documentation
Redoc
📘 OpenAPI/Swagger-generated API Reference Documentation
Stars: ✭ 15,935 (+14127.68%)
Mutual labels: swagger, api-documentation, documentation-generator
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+18899.11%)
Mutual labels: rest-api, swagger, swagger-ui
Django Ninja
💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
Stars: ✭ 875 (+681.25%)
Mutual labels: rest-api, swagger, swagger-ui
Swagger Github Pages
How to host Swagger API documentation with GitHub Pages
Stars: ✭ 102 (-8.93%)
Mutual labels: swagger, swagger-ui, api-documentation
Drf Spectacular
Sane and flexible OpenAPI 3 schema generation for Django REST framework.
Stars: ✭ 414 (+269.64%)
Mutual labels: rest-api, swagger, documentation-generator
Go Book Store Api
Go Sample project to understand Mysql CRUD operation with best practises Includes logging, JWT, Swagger and Transactions
Stars: ✭ 18 (-83.93%)
Mutual labels: rest-api, swagger, swagger-ui
Springdoc Openapi
Library for OpenAPI 3 with spring-boot
Stars: ✭ 1,113 (+893.75%)
Mutual labels: rest-api, swagger, swagger-ui
Swagger ui engine
Include swagger-ui as rails engine and document your API with simple JSON or YAML files.
Stars: ✭ 77 (-31.25%)
Mutual labels: swagger, swagger-ui
Jsdoc To Markdown
Generate markdown documentation from jsdoc-annotated javascript
Stars: ✭ 1,199 (+970.54%)
Mutual labels: api-documentation, documentation-generator
Golang Swaggerui Example
SwaggerUI generation example for Golang
Stars: ✭ 81 (-27.68%)
Mutual labels: swagger, swagger-ui
Train Ai With Django Swagger Jwt
Train AI (Keras + Tensorflow) to defend apps with Django REST Framework + Celery + Swagger + JWT - deploys to Kubernetes and OpenShift Container Platform
Stars: ✭ 66 (-41.07%)
Mutual labels: rest-api, swagger
pretty-swag
pretty-swag is a UI for Swagger Specification V2. It is inspired by Swagger Editor.
An example of the generated html from petstore spec can be found here
Bugs filing and suggestions are always welcome.
Changelog
See CHANGELOG
Requirement
Installation
npm install pretty-swag -g
Usage
pretty-swag -i input.json
pretty-swag -c config.json
pretty-swag -i input.json -o output.html
pretty-swag -i input.json -o output.html -f lite
pretty-swag -i input.json -o output.html -f offline -m true
pretty-swag -i input.json -o output.html -f offline -m true -th default
API Usage
Syntax prettySwag.run(input,output,config,callback);
API Example
const prettySwag = require('pretty-swag');
config = {};
config.format = "singleFile";
config.markdown = true;
config.fixedNav = true;
config.autoTags = true;
config.theme = {
"default": "blue",
"GET": "blue",
"POST": "indigo",
"DELETE": "red",
"PUT": "amber"
};
input = "input.json";
output = "doc.html";
prettySwag.run(input,output,config,function(err){
if(err){
console.log(err);
}
else{
console.log("success");
}
});
When dst
equals null
, no file will be written and the html will be returned as second parameter.
...
prettySwag.run(input,null,config,function(err,data){
if(err){
console.log(err);
}
else{
console.log(data); // Plain html
}
});
Command switch
Switch | Name | Optional | Description |
---|---|---|---|
-i | input | No | Location of a Swagger spec file(can be JSON or YAML) |
-o | output | Yes | Location of generated document(s). Default to doc.html |
-f | format | Yes | Format of the output (singlefile , offline , lite , noicon ). Default to singlefile
|
-m | markdown | Yes | Render Summary & Description as markdown. true or false . Default to false
|
-th | theme | Yes | One of the supported colors or pre-defined theme default
|
-c | config | Yes | Location of a configuration file |
-fixedNav | fixedNav | Yes | Include this flag to fixed the navigation bar on screen |
-autoTags | autoTags | Yes | Include this flag to turn on/off automatically generate tags by path and method name |
-noDate | noDate | Yes | Include this flag to remove generated date |
-noCredit | noCredit | Yes | Include this flag to remove credit |
-noNav | noNav | Yes | Include this flag to remove navigation bar. Default to false
|
-noReq | noRequest | Yes | Include this flag to remove request panel. Default to false
|
-noBaseURL | noBaseURL | Yes | Include this flag to suppress baseURL. Default to false
|
-indent | indent | Yes | Include this flag to specify space per indentation. Default to 3 |
-v | version | Yes | To show pertty-swag current version |
-collapsePath | collapse.path | Yes | Collapse path by default. true or false . Default to false
|
-collapseMethod | collapse.method | Yes | Collapse method by default. true or false . Default to false
|
-collapseTool | collapse.tool | Yes | Collapse tool by default. true or false . Default to true
|
-home.url | home.url | Yes | A home URL. Leave it blank to suppress the display |
-home.location | home.location | Yes | A location on navigation bar. Either L (Left) RL (Right before Expand) RR(Right most) |
-home.text | home.text | Yes | A text on navigation bar. Default to Home
|
Configuration File
Valid keys are:
- input
- output
- format
- markdown
- theme
- fixedNav
- hideNav
- autoTags
- noDate
- noCredit
- noRequest
- indent
- collapse
- customCSS
- home
Example of Configuration file
{
"input": "/tmp/petstore.json",
"output": "/tmp/petstore.html",
"format": "singlefile",
"markdown": true,
"theme": {
"default": "blue",
"GET": "blue",
"POST": "indigo",
"DELETE": "red",
"PUT": "amber"
},
"fixedNav": true,
"autoTags": true,
"indent": 2,
"collapse":{
"path":true
,"method":true
,"tool":true
}
"home":{
"URL": "https://github.com/twskj/pretty-swag/"
,"location": "RR"
,"text": "Home"
}
}
Available Colors
- red
- pink
- purple
- deep-purple
- indigo
- blue
- light-blue
- cyan
- teal
- green
- light-green
- lime
- yellow
- amber
- orange
- deep-orange
- brown
- grey
- blue-grey
- black
- white
Output format
- SingleFile - A single html embedded all fonts and icon in one file. (Default).
- Offline - A html file and a resource folder for css and js.
- Lite - A single html but need the internet connection to obtain required resources.
- NoIcon - Does not use Roboto font, and no icons (Useful when dealing with older IEs)
Features
-
Search / Filter by Tag
-
Collapsible Panel
-
Fold / Unfold Schema
-
Live Request / Response Feedback
-
Syntax Highlight code block
-
Download and Preview response data
Filtering
- Use prefix
-
to exclude unwanted tags. For example-store
will exclude api(s) that containstore
tag.
Console
- Press
Ctrl + `
to bring up a console - Press
tab
to auto complete
Available Console Commands
Command | Description |
---|---|
add header -g <key> <value> | Adding the header to all paths/methods |
remove header -g <key> <value> | Remove a given header from all paths/methods |
License
The contents of this repository are covered under the MIT License
Support on Beerpay
Like the project? buy me some 🍻!
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].