环境配置:SpringBoot、SpringFox、Swagger2Markup、Asciidoctor 和 Maven
使用 Swagger2Markup
将 Swagger.json
转换成 Markdown
:
Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
.withOutputLanguage(Language.ZH)
.withPathsGroupedBy(GroupBy.TAGS)
.build();
Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(localSwaggerFile).withConfig(config).build();
converter.toFile(outputFile);
Petstore API Description
版本 : 1.0.0
名字 : leongfeng 邮箱 : leongfeng@163.com
许可证 : Apache 2.0 许可网址 : http://www.apache.org/licenses/LICENSE-2.0.html 服务条款 : null
域名 : localhost 基础路径 : /
- Index : Index operation
- Pets : Operations about pets
Index operation
GET /
HTTP代码 | 说明 | 架构 |
---|---|---|
200 | OK | string |
401 | Unauthorized | 无内容 |
403 | Forbidden | 无内容 |
404 | Not Found | 无内容 |
application/json
*/*
Operations about pets
POST /pets
类型 | 名称 | 说明 | 架构 |
---|---|---|---|
Body | pet 必填 |
Pet object that needs to be added to the store | Pet |
HTTP代码 | 说明 | 架构 |
---|---|---|
200 | OK | string |
201 | Created | 无内容 |
401 | Unauthorized | 无内容 |
403 | Forbidden | 无内容 |
404 | Not Found | 无内容 |
405 | Invalid input | 无内容 |
application/json
*/*
PUT /pets
类型 | 名称 | 说明 | 架构 |
---|---|---|---|
Body | pet 必填 |
Pet object that needs to be added to the store | Pet |
HTTP代码 | 说明 | 架构 |
---|---|---|
200 | OK | string |
201 | Created | 无内容 |
400 | Invalid ID supplied | 无内容 |
401 | Unauthorized | 无内容 |
403 | Forbidden | 无内容 |
404 | Pet not found | 无内容 |
405 | Validation exception | 无内容 |
application/json
*/*
类型 | 名称 | 作用域 |
---|---|---|
未知 | petstore_auth | write_pets,read_pets |
GET /pets/{petId}
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
类型 | 名称 | 说明 | 架构 | 默认列 |
---|---|---|---|---|
Path | petId 必填 |
ID of pet that needs to be fetched | integer (int64) | 1 |
HTTP代码 | 说明 | 架构 |
---|---|---|
200 | OK | Pet |
400 | Invalid ID supplied | 无内容 |
401 | Unauthorized | 无内容 |
403 | Forbidden | 无内容 |
404 | Pet not found | 无内容 |
application/json
*/*
DELETE /pets/{petId}
Delete a pet from the store
类型 | 名称 | 说明 | 架构 | 默认列 |
---|---|---|---|---|
Path | petId 必填 |
ID of pet that needs to be fetched | integer (int64) | 1 |
HTTP代码 | 说明 | 架构 |
---|---|---|
200 | OK | string |
204 | No Content | 无内容 |
401 | Unauthorized | 无内容 |
403 | Forbidden | 无内容 |
application/json
*/*
名称 | 架构 |
---|---|
id 必填 |
integer (int64) |
name 必填 |
string |
名称 | 说明 | 架构 |
---|---|---|
category 可选 |
Category | |
id 可选 |
integer (int64) | |
name 可选 |
string | |
photoUrls 可选 |
< string > array | |
status 可选 |
pet status in the store | enum (available, pending, sold) |
tags 可选 |
< Tag > array |
名称 | 架构 |
---|---|
id 可选 |
integer (int64) |
name 可选 |
string |