# Swagger UI
[![Build Status](https://travis-ci.org/swagger-api/swagger-ui.svg?branch=master)](https://travis-ci.org/swagger-api/swagger-ui)
[![NPM version](https://badge.fury.io/js/swagger-ui.svg)](http://badge.fury.io/js/swagger-ui)
[![Dependency Status](https://david-dm.org/swagger-api/swagger-ui/status.svg)](https://david-dm.org/swagger-api/swagger-ui)
[![devDependency Status](https://david-dm.org/swagger-api/swagger-ui/dev-status.svg)](https://david-dm.org/swagger-api/swagger-ui#info=devDependencies)
Swagger UI is part of the Swagger project. The Swagger project allows you to produce, visualize and consume your OWN RESTful services. No proxy or 3rd party services required. Do it your own way.
Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically
generate beautiful documentation and sandbox from a Swagger-compliant API. Because Swagger UI has no dependencies, you can host it in any server environment, or on your local machine.
## What's Swagger?
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
Check out [Swagger-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more.
## Compatibility
The OpenAPI Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows:
Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
2.1.4 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v.2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) |
2.1.4 | 2016-01-06 | 1.1, 1.2, 2.0 | [tag v.2.1.4](https://github.com/swagger-api/swagger-ui/tree/v2.1.4) |
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |
## How to Use It
### Download
You can use the swagger-ui code AS-IS! No need to build or recompile--just clone this repo and use the pre-built files in the `dist` folder. If you like swagger-ui as-is, stop here.
##### Browser support
Swagger UI works in all evergreen desktop browsers (Chrome, Safari, Firefox). Internet Explorer support is version 8 (IE8) and above.
### Build
You can rebuild swagger-ui on your own to tweak it or just so you can say you did. To do so, follow these steps:
### Windows Users: Please install [Python](https://www.python.org/downloads/windows/) before follow below guidelines for node-gyp rebuild to run.
1. `npm install`
2. `npm run build`
3. You should see the distribution under the dist folder. Open [`./dist/index.html`](./dist/index.html) to launch Swagger UI in a browser
### Development
Use `npm run serve` to make a new build, watch for changes, and serve the result at http://localhost:8080/.
### Build using Docker
To build swagger-ui using a docker container:
```
docker build -t swagger-ui-builder .
docker run -p 80:8080 swagger-ui-builder
```
This will start Swagger UI at `http://localhost`.
### Use
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click explore to view the API.
### Customize
You may choose to customize Swagger UI for your organization. Here is an overview of what's in its various directories:
- dist: Contains a distribution which you can deploy on a server or load from your local machine.
- dist/lang: The swagger localization
- lib: Contains javascript dependencies which swagger-ui depends on
- node_modules: Contains node modules which swagger-ui uses for its development.
- src
- src/main/templates: [handlebars](http://handlebarsjs.com/) templates used to render swagger-ui
- src/main/html: the html files, some images and css
- src/main/javascript: main code
### SwaggerUi
To use swagger-ui you should take a look at the [source of swagger-ui html page](https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html) and customize it. This basically requires you to instantiate a SwaggerUi object and call load() on it as below:
```javascript
var swaggerUi = new SwaggerUi({
url:"http://petstore.swagger.io/v2/swagger.json",
dom_id:"swagger-ui-container"
});
swaggerUi.load();
```
##### Parameters
Parameter Name | Description
--- | ---
url | The url pointing to `swagger.json` (Swagger 2.0) or the resource listing (earlier versions) as per [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification/).
authorizations | An authorization object to be passed to swagger-js. Setting it here will trigger inclusion of any authorization or custom signing logic when fetching the swagger description file. Note the object structure should be `{ key: AuthorizationObject }`
spec | A JSON object describing the OpenAPI Specification. When used, the `url` parameter will not be parsed. This is useful for testing manually-generated specifications without hosting them. Works for Swagger 2.0 specs only.
validatorUrl | By default, Swagger-UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation. This parameter is relevant for Swagger 2.0 specs only.
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
booleanValues | SwaggerUI renders boolean data types as a dropdown. By default it provides a 'true' and 'false' string as the possible choices. You can use this parameter to change the values in dropdown to be something else, for example 0 and 1 by setting booleanValues to new Array(0, 1).
docExpansion | Controls how the API listing is displayed. It can be set to 'none' (default), 'list' (shows operations for each resource), or 'full' (fully expanded: shows operations and their details).
apisSorter | Apply a sort to the API/tags list. It can be 'alpha' (sort by name) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.
operationsSorter | Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.
defaultModelRendering | Controls how models are shown when the API is first rendered. (The user can always switch the rendering for a given model by clicking the 'Model' and 'Model Schema' links.) It can be set to 'model' or 'schema', and the default is 'schema'.
onComplete | This is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully.
onFailure | This is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.
highlightSizeThreshold | Any size response below this threshold will be highlighted syntactically, at
没有合适的资源?快使用搜索试试~ 我知道了~
基于 SpringBoot、JHipster 的管理系统后台manager_system.zip
共373个文件
java:172个
js:86个
handlebars:20个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 14 浏览量
2024-05-15
13:46:52
上传
评论
收藏 1.45MB ZIP 举报
温馨提示
该项目利用了基于springboot + vue + mysql的开发模式框架实现的课设系统,包括了项目的源码资源、sql文件、相关指引文档等等。 【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。 【技术】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes
资源推荐
资源详情
资源评论
收起资源包目录
基于 SpringBoot、JHipster 的管理系统后台manager_system.zip (373个子文件)
mvnw.cmd 5KB
nginx.conf 372B
screen.css 48KB
screen.css 48KB
print.css 45KB
print.css 45KB
style.css 5KB
style.css 5KB
reset.css 1KB
reset.css 1KB
typography.css 452B
typography.css 452B
Dockerfile 318B
Dockerfile 175B
.dockerignore 140B
.editorconfig 475B
throbber.gif 9KB
throbber.gif 9KB
expand.gif 73B
expand.gif 73B
collapse.gif 69B
collapse.gif 69B
.gitattributes 3KB
.gitignore 2KB
operation.handlebars 6KB
main.handlebars 2KB
param_required.handlebars 1021B
oauth2.handlebars 984B
param.handlebars 965B
basic_auth.handlebars 961B
apikey_auth.handlebars 855B
signature.handlebars 806B
resource.handlebars 789B
param_list.handlebars 762B
param_readonly.handlebars 499B
param_readonly_required.handlebars 486B
auth_view.handlebars 429B
auth_button_operation.handlebars 405B
status_code.handlebars 367B
popup.handlebars 344B
parameter_content_type.handlebars 342B
response_content_type.handlebars 337B
content_type.handlebars 311B
auth_button.handlebars 49B
index.html 8KB
error.html 4KB
index.html 4KB
index.html 4KB
index.html 2KB
activationEmail.html 975B
passwordResetEmail.html 967B
creationEmail.html 958B
o2c.html 449B
o2c.html 449B
testEmail.html 109B
favicon.ico 5KB
favicon.ico 5KB
maven-wrapper.jar 48KB
ExcelUtil.java 13KB
CustomAuditEventRepositoryIntTest.java 11KB
UserResource.java 11KB
UserService.java 10KB
MailServiceIntTest.java 9KB
WorkPlan.java 8KB
RoleService.java 6KB
Project.java 6KB
LoggingConfiguration.java 6KB
AccountResource.java 6KB
ProcessResource.java 6KB
ExceptionTranslatorIntTest.java 6KB
User.java 6KB
TypeSpecificationResource.java 6KB
FileService.java 6KB
AuditResourceIntTest.java 6KB
RoleResource.java 6KB
MenuResource.java 6KB
DepartmentResource.java 6KB
DepartmentService.java 5KB
TestUtil.java 5KB
SecurityConfiguration.java 5KB
FileUtil.java 5KB
CacheConfiguration.java 5KB
ProcessService.java 5KB
JWTFilterTest.java 5KB
UserJWTControllerIntTest.java 5KB
Menu.java 5KB
LineBodyResource.java 5KB
CustomAuditEventRepository.java 5KB
ExceptionTranslator.java 4KB
WorkPlanService.java 4KB
ProjectTypeResource.java 4KB
MenuService.java 4KB
TypeSpecificationService.java 4KB
PurchaseResource.java 4KB
EquitmentResource.java 4KB
MaterialResource.java 4KB
SupplierResource.java 4KB
TokenProvider.java 4KB
SecurityUtils.java 4KB
ProjectResource.java 4KB
共 373 条
- 1
- 2
- 3
- 4
资源评论
枫蜜柚子茶
- 粉丝: 6871
- 资源: 5108
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功