利用Swagger Maven Plugin生成Rest API文档

一、在pom中添加插件:

            <plugin>
                <groupId>com.github.kongchen</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <apiSources>
                        <apiSource>
                            <!-- 支持springMVC -->
                            <springmvc>true</springmvc>
                            <!-- 你的web项目Controller包名 -->
                            <locations>us.wili.dev.admin.controller</locations>
                            <!-- 协议 -->
                            <schemes>http,https</schemes>
                            <!-- 所在主机,可以为空 -->
                            <host>localhost:8030</host>
                            <!-- web项目Context Path -->
                            <basePath>/api</basePath>
                            <!-- 必须!要在主页显示你的API的整体信息的,相当于是标题 -->
                            <info>
                                <title>文档搜索器</title>
                                <version>v1</version>
                                <description>
                                    文档搜索器-API
                                </description>
                            </info>
                            <!-- 模板位置,支持classpath:类型路径 -->
                            <templatePath>${project.basedir}/src/main/resources/template/strapdown.html.hbs</templatePath>
                            <!-- 编译期扫描controller之后合成的API文档输出位置 -->
                            <outputPath>${project.basedir}/src/main/resources/generated/document.html</outputPath>
                            <swaggerDirectory>${basedir}/src/main/resources/generated/swagger-ui</swaggerDirectory>

                        </apiSource>
                    </apiSources>
                </configuration>
                <!-- 这里很重要,简单说就是配置在maven的compile生命周期执行时触发swagger插件的generate命令 -->
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


二、添加Swagger 模板文件

    1、starpdown.html.hbs

<!DOCTYPE html>
<html>
<title>API Document</title>

<xmp theme="united" style="display:none;">
    {{>markdown}}
</xmp>

<script src="http://strapdownjs.com/v/0.2/strapdown.js"></script>
</html>

    2、markdown.hbs

#{{#info}}{{title}}


## {{join schemes " | "}}://{{host}}{{basePath}}


{{description}}

{{#contact}}
[**Contact the developer**](mailto:{{email}})
{{/contact}}

**Version** {{version}}

[**Terms of Service**]({{termsOfService}})

{{#license}}[**{{name}}**]({{url}}){{/license}}

{{/info}}

{{#if consumes}}**Consumes:** {{join consumes ", "}}{{/if}}

{{#if produces}}**Produces:** {{join produces ", "}}{{/if}}

{{#if securityDefinitions}}
# Security Definitions
{{/if}}
{{> security}}

# APIs

{{#each paths}}
## {{@key}}
{{#this}}
{{#get}}
### GET
{{> operation}}
{{/get}}

{{#put}}
### PUT
{{> operation}}
{{/put}}

{{#post}}
### POST

{{> operation}}

{{/post}}

{{#delete}}
### DELETE
{{> operation}}
{{/delete}}

{{#option}}
### OPTION
{{> operation}}
{{/option}}

{{#patch}}
### PATCH
{{> operation}}
{{/patch}}

{{#head}}
### HEAD
{{> operation}}
{{/head}}

{{/this}}
{{/each}}

# Definitions
{{#each definitions}}
## <a name="/definitions/{{key}}">{{@key}}</a>

<table border="1">
    <tr>
        <th>name</th>
        <th>type</th>
        <th>required</th>
        <th>description</th>
        <th>example</th>
    </tr>
    {{#each this.properties}}
        <tr>
            <td>{{@key}}</td>
            <td>
                {{#ifeq type "array"}}
                {{#items.$ref}}
                    {{type}}[<a href="{{items.$ref}}">{{basename items.$ref}}</a>]
                {{/items.$ref}}
                {{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}}
                {{else}}
                    {{#$ref}}<a href="{{$ref}}">{{basename $ref}}</a>{{/$ref}}
                    {{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}}
                {{/ifeq}}
            </td>
            <td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td>
            <td>{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}</td>
            <td>{{example}}</td>
        </tr>
    {{/each}}
</table>
{{/each}}

    3、operation.hbs

{{#deprecated}}-deprecated-{{/deprecated}}
<a id="{{operationId}}">{{summary}}</a>

{{description}}

{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}})
{{/if}}

{{#if security}}
#### Security
{{/if}}

{{#security}}
{{#each this}}
* {{@key}}
{{#this}}   * {{this}}
{{/this}}
{{/each}}
{{/security}}

#### Request

{{#if consumes}}
**Content-Type: ** {{join consumes ", "}}{{/if}}

##### Parameters
{{#if parameters}}
<table border="1">
    <tr>
        <th>Name</th>
        <th>Located in</th>
        <th>Required</th>
        <th>Description</th>
        <th>Default</th>
        <th>Schema</th>
    </tr>
{{/if}}

{{#parameters}}
<tr>
    <th>{{name}}</th>
    <td>{{in}}</td>
    <td>{{#if required}}yes{{else}}no{{/if}}</td>
    <td>{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}}</td>
    <td> - </td>
{{#ifeq in "body"}}
    <td>
    {{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}
    {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}}
    </td>
{{else}}
    {{#ifeq type "array"}}
            <td>Array[{{items.type}}] ({{collectionFormat}})</td>
    {{else}}
            <td>{{type}} {{#format}}({{format}}){{/format}}</td>
    {{/ifeq}}
{{/ifeq}}
</tr>
{{/parameters}}
{{#if parameters}}
</table>
{{/if}}


#### Response

{{#if produces}}**Content-Type: ** {{join produces ", "}}{{/if}}


| Status Code | Reason      | Response Model |
|-------------|-------------|----------------|
{{#each responses}}| {{@key}}    | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}|
{{/each}}

    4、security.hbs

{{#each securityDefinitions}}
### {{@key}}
{{#this}}
{{#ifeq type "oauth2"}}
<table>
    <tr>
        <th>type</th>
        <th colspan="2">{{type}}</th>
    </tr>
{{#if description}}
        <tr>
            <th>description</th>
            <th colspan="2">{{description}}</th>
        </tr>
{{/if}}
{{#if authorizationUrl}}
        <tr>
            <th>authorizationUrl</th>
            <th colspan="2">{{authorizationUrl}}</th>
        </tr>
{{/if}}
{{#if flow}}
        <tr>
            <th>flow</th>
            <th colspan="2">{{flow}}</th>
        </tr>
{{/if}}
{{#if tokenUrl}}
        <tr>
            <th>tokenUrl</th>
            <th colspan="2">{{tokenUrl}}</th>
        </tr>
{{/if}}
{{#if scopes}}
    <tr>
        <td rowspan="3">scopes</td>
{{#each scopes}}
            <td>{{@key}}</td>
            <td>{{this}}</td>
        </tr>
        <tr>
{{/each}}
    </tr>
{{/if}}
</table>
{{/ifeq}}
{{#ifeq type "apiKey"}}
<table>
    <tr>
        <th>type</th>
        <th colspan="2">{{type}}</th>
    </tr>
{{#if description}}
        <tr>
            <th>description</th>
            <th colspan="2">{{description}}</th>
        </tr>
{{/if}}
{{#if name}}
        <tr>
            <th>name</th>
            <th colspan="2">{{name}}</th>
        </tr>
{{/if}}
{{#if in}}
        <tr>
            <th>in</th>
            <th colspan="2">{{in}}</th>
        </tr>
{{/if}}
</table>
{{/ifeq}}
{{#ifeq type "basic"}}
<table>
    <tr>
        <th>type</th>
        <th colspan="2">{{type}}</th>
    </tr>
{{#if description}}
        <tr>
            <th>description</th>
            <th colspan="2">{{description}}</th>
        </tr>
{{/if}}
</table>
{{/ifeq}}
{{/this}}
{{/each}}

三、.在该项目下执行mvn clean compile,得到generated/swagger-ui/swagger.json.


生成的swagger.json:

{
  "swagger" : "2.0",
  "info" : {
    "description" : "文档搜索器-API",
    "version" : "v1",
    "title" : "文档搜索器"
  },
  "host" : "localhost:8030",
  "basePath" : "/api",
  "tags" : [ {
    "name" : "被预约人模块"
  }, {
    "name" : "预约记录模块"
  }, {
    "name" : "管理员模块"
  }, {
    "name" : "预约人模块"
  }, {
    "name" : "列表项模块"
  } ],
  "schemes" : [ "http", "https" ],
  "paths" : {
    "/api/adminUser/checkLogin" : {
      "get" : {
        "tags" : [ "管理员模块" ],
        "summary" : "检查登录状态",
        "description" : "",
        "operationId" : "checkLogin",
        "produces" : [ "application/json;charset=UTF-8" ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/adminUser/checkPhone" : {
      "post" : {
        "tags" : [ "管理员模块" ],
        "summary" : "验证手机号",
        "description" : "",
        "operationId" : "checkPhone",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/PhoneVerificationReqDto"
          }
        }, {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/HttpServletRequest"
          }
        }, {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/HttpServletResponse"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/adminUser/findPassword" : {
      "post" : {
        "tags" : [ "管理员模块" ],
        "summary" : "找回密码",
        "description" : "",
        "operationId" : "findPassword",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/PasswordVerificationReqDto"
          }
        }, {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/HttpServletRequest"
          }
        }, {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/HttpServletResponse"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/adminUser/getAuthPhoneCaptcha" : {
      "post" : {
        "tags" : [ "管理员模块" ],
        "summary" : "获取验证码-认证",
        "description" : "",
        "operationId" : "getAuthPhoneCaptcha",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "电话号码",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        }, {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/HttpServletRequest"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/adminUser/getPersonalInfo" : {
      "get" : {
        "tags" : [ "管理员模块" ],
        "summary" : "获取管理员用户信息",
        "description" : "",
        "operationId" : "getPersonalInfo",
        "produces" : [ "application/json;charset=UTF-8" ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/adminUser/updatePassword" : {
      "post" : {
        "tags" : [ "管理员模块" ],
        "summary" : "更新密码",
        "description" : "",
        "operationId" : "updatePassword",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "新密码",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "确认密码",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/enum/listDepartment" : {
      "get" : {
        "tags" : [ "列表项模块" ],
        "summary" : "部门列表",
        "description" : "",
        "operationId" : "listDepartment",
        "produces" : [ "application/json;charset=UTF-8" ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/enum/listLanguages" : {
      "get" : {
        "tags" : [ "列表项模块" ],
        "summary" : "语种列表",
        "description" : "",
        "operationId" : "listLanguages",
        "produces" : [ "application/json;charset=UTF-8" ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservationRecord/detail" : {
      "get" : {
        "tags" : [ "预约记录模块" ],
        "summary" : "预约记录详情",
        "description" : "",
        "operationId" : "detail",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "预约记录 ID",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservationRecord/list" : {
      "get" : {
        "tags" : [ "预约记录模块" ],
        "summary" : "分页获取预约记录列表",
        "description" : "",
        "operationId" : "list",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservationRecordQueryReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/PagerResponseDto"
            }
          }
        }
      }
    },
    "/api/reservationRecord/updateStatus" : {
      "post" : {
        "tags" : [ "预约记录模块" ],
        "summary" : "修改记录状态",
        "description" : "",
        "operationId" : "updateStatus",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservationRecordUpdateReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservationUser/detail" : {
      "get" : {
        "tags" : [ "预约人模块" ],
        "summary" : "预约记录详情",
        "description" : "",
        "operationId" : "detail",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "预约记录 ID",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservationUser/getRecordList" : {
      "get" : {
        "tags" : [ "预约人模块" ],
        "summary" : "预约记录列表",
        "description" : "",
        "operationId" : "getRecordList",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "预约人 ID",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ListResponseDto"
            }
          }
        }
      }
    },
    "/api/reservationUser/list" : {
      "get" : {
        "tags" : [ "预约人模块" ],
        "summary" : "分页获取预约人列表",
        "description" : "",
        "operationId" : "list",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservationUserQueryReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/PagerResponseDto"
            }
          }
        }
      }
    },
    "/api/reservedUser/add" : {
      "post" : {
        "tags" : [ "被预约人模块" ],
        "summary" : "新增被预约人",
        "description" : "",
        "operationId" : "add",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservedUserAddReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservedUser/changePassword" : {
      "post" : {
        "tags" : [ "被预约人模块" ],
        "summary" : "修改密码",
        "description" : "",
        "operationId" : "changePassword",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservedUserPasswordVerificationReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservedUser/list" : {
      "get" : {
        "tags" : [ "被预约人模块" ],
        "summary" : "分页获取被预约人列表",
        "description" : "",
        "operationId" : "list",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservedUserQueryReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/PagerResponseDto"
            }
          }
        }
      }
    },
    "/api/reservedUser/update" : {
      "post" : {
        "tags" : [ "被预约人模块" ],
        "summary" : "编辑被预约人",
        "description" : "",
        "operationId" : "update",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservedUserAddReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    },
    "/api/reservedUser/updateStatus" : {
      "post" : {
        "tags" : [ "被预约人模块" ],
        "summary" : "编辑被预约人账号状态",
        "description" : "",
        "operationId" : "updateStatus",
        "produces" : [ "application/json;charset=UTF-8" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "required" : false,
          "schema" : {
            "$ref" : "#/definitions/ReservedUserUpdateStausReqDto"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "successful operation",
            "schema" : {
              "$ref" : "#/definitions/ResponseDto"
            }
          }
        }
      }
    }
  },
  "definitions" : {
    "BufferedReader" : {
      "type" : "object"
    },
    "Cookie" : {
      "type" : "object",
      "properties" : {
        "name" : {
          "type" : "string"
        },
        "value" : {
          "type" : "string"
        },
        "comment" : {
          "type" : "string"
        },
        "domain" : {
          "type" : "string"
        },
        "maxAge" : {
          "type" : "integer",
          "format" : "int32"
        },
        "path" : {
          "type" : "string"
        },
        "secure" : {
          "type" : "boolean",
          "default" : false
        },
        "version" : {
          "type" : "integer",
          "format" : "int32"
        }
      }
    },
    "Enumeration" : {
      "type" : "object"
    },
    "HttpServletRequest" : {
      "type" : "object",
      "properties" : {
        "method" : {
          "type" : "string"
        },
        "userPrincipal" : {
          "$ref" : "#/definitions/Principal"
        },
        "session" : {
          "$ref" : "#/definitions/HttpSession"
        },
        "cookies" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Cookie"
          }
        },
        "authType" : {
          "type" : "string"
        },
        "contextPath" : {
          "type" : "string"
        },
        "servletPath" : {
          "type" : "string"
        },
        "remoteUser" : {
          "type" : "string"
        },
        "pathInfo" : {
          "type" : "string"
        },
        "requestURI" : {
          "type" : "string"
        },
        "headerNames" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "requestURL" : {
          "$ref" : "#/definitions/StringBuffer"
        },
        "queryString" : {
          "type" : "string"
        },
        "requestedSessionId" : {
          "type" : "string"
        },
        "requestedSessionIdFromUrl" : {
          "type" : "boolean",
          "default" : false
        },
        "requestedSessionIdValid" : {
          "type" : "boolean",
          "default" : false
        },
        "pathTranslated" : {
          "type" : "string"
        },
        "requestedSessionIdFromCookie" : {
          "type" : "boolean",
          "default" : false
        },
        "requestedSessionIdFromURL" : {
          "type" : "boolean",
          "default" : false
        },
        "inputStream" : {
          "$ref" : "#/definitions/ServletInputStream"
        },
        "protocol" : {
          "type" : "string"
        },
        "scheme" : {
          "type" : "string"
        },
        "contentLength" : {
          "type" : "integer",
          "format" : "int32"
        },
        "contentType" : {
          "type" : "string"
        },
        "locale" : {
          "$ref" : "#/definitions/Locale"
        },
        "attributeNames" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "parameterMap" : {
          "type" : "object",
          "additionalProperties" : {
            "type" : "object"
          }
        },
        "localName" : {
          "type" : "string"
        },
        "reader" : {
          "$ref" : "#/definitions/BufferedReader"
        },
        "localPort" : {
          "type" : "integer",
          "format" : "int32"
        },
        "serverPort" : {
          "type" : "integer",
          "format" : "int32"
        },
        "remoteAddr" : {
          "type" : "string"
        },
        "locales" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "localAddr" : {
          "type" : "string"
        },
        "secure" : {
          "type" : "boolean",
          "default" : false
        },
        "remoteHost" : {
          "type" : "string"
        },
        "remotePort" : {
          "type" : "integer",
          "format" : "int32"
        },
        "serverName" : {
          "type" : "string"
        },
        "parameterNames" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "characterEncoding" : {
          "type" : "string"
        }
      }
    },
    "HttpServletResponse" : {
      "type" : "object",
      "properties" : {
        "locale" : {
          "$ref" : "#/definitions/Locale"
        },
        "contentType" : {
          "type" : "string"
        },
        "outputStream" : {
          "$ref" : "#/definitions/ServletOutputStream"
        },
        "writer" : {
          "$ref" : "#/definitions/PrintWriter"
        },
        "bufferSize" : {
          "type" : "integer",
          "format" : "int32"
        },
        "committed" : {
          "type" : "boolean",
          "default" : false
        },
        "characterEncoding" : {
          "type" : "string"
        }
      }
    },
    "HttpSession" : {
      "type" : "object",
      "properties" : {
        "id" : {
          "type" : "string"
        },
        "creationTime" : {
          "type" : "integer",
          "format" : "int64"
        },
        "attributeNames" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "new" : {
          "type" : "boolean",
          "default" : false
        },
        "valueNames" : {
          "type" : "array",
          "items" : {
            "type" : "string"
          }
        },
        "lastAccessedTime" : {
          "type" : "integer",
          "format" : "int64"
        },
        "maxInactiveInterval" : {
          "type" : "integer",
          "format" : "int32"
        },
        "servletContext" : {
          "$ref" : "#/definitions/ServletContext"
        },
        "sessionContext" : {
          "$ref" : "#/definitions/HttpSessionContext"
        }
      }
    },
    "HttpSessionContext" : {
      "type" : "object",
      "properties" : {
        "ids" : {
          "$ref" : "#/definitions/Enumeration"
        }
      }
    },
    "ListResponseDto" : {
      "type" : "object",
      "properties" : {
        "status" : {
          "description" : "状态",
          "$ref" : "#/definitions/Status"
        },
        "data" : {
          "type" : "array",
          "description" : "数据",
          "items" : {
            "type" : "object"
          }
        }
      }
    },
    "Locale" : {
      "type" : "object",
      "properties" : {
        "country" : {
          "type" : "string"
        },
        "displayCountry" : {
          "type" : "string"
        },
        "displayLanguage" : {
          "type" : "string"
        },
        "displayName" : {
          "type" : "string"
        },
        "displayScript" : {
          "type" : "string"
        },
        "displayVariant" : {
          "type" : "string"
        },
        "extensionKeys" : {
          "type" : "array",
          "uniqueItems" : true,
          "items" : {
            "type" : "string"
          }
        },
        "iso3Country" : {
          "type" : "string"
        },
        "iso3Language" : {
          "type" : "string"
        },
        "script" : {
          "type" : "string"
        },
        "unicodeLocaleAttributes" : {
          "type" : "array",
          "uniqueItems" : true,
          "items" : {
            "type" : "string"
          }
        },
        "unicodeLocaleKeys" : {
          "type" : "array",
          "uniqueItems" : true,
          "items" : {
            "type" : "string"
          }
        },
        "variant" : {
          "type" : "string"
        },
        "language" : {
          "type" : "string"
        }
      }
    },
    "PagerObject" : {
      "type" : "object",
      "properties" : {
        "currentPage" : {
          "type" : "integer",
          "format" : "int64"
        },
        "total" : {
          "type" : "integer",
          "format" : "int64"
        },
        "perPage" : {
          "type" : "integer",
          "format" : "int64"
        },
        "array" : {
          "type" : "array",
          "items" : {
            "type" : "object"
          }
        },
        "extras" : {
          "type" : "object",
          "additionalProperties" : {
            "type" : "object"
          }
        },
        "offset" : {
          "type" : "integer",
          "format" : "int64"
        },
        "totalPageNo" : {
          "type" : "integer",
          "format" : "int64"
        }
      }
    },
    "PagerResponseDto" : {
      "type" : "object",
      "properties" : {
        "status" : {
          "description" : "状态",
          "$ref" : "#/definitions/Status"
        },
        "data" : {
          "description" : "数据",
          "$ref" : "#/definitions/PagerObject"
        }
      }
    },
    "PasswordVerificationReqDto" : {
      "type" : "object",
      "properties" : {
        "phone" : {
          "type" : "string",
          "description" : "手机号"
        },
        "password" : {
          "type" : "string",
          "description" : "新密码"
        },
        "secondPassword" : {
          "type" : "string",
          "description" : "再次新密码"
        }
      }
    },
    "PhoneVerificationReqDto" : {
      "type" : "object",
      "properties" : {
        "phone" : {
          "type" : "string",
          "description" : "手机号"
        },
        "captcha" : {
          "type" : "string",
          "description" : "验证码"
        }
      }
    },
    "Principal" : {
      "type" : "object",
      "properties" : {
        "name" : {
          "type" : "string"
        }
      }
    },
    "PrintWriter" : {
      "type" : "object"
    },
    "ReservationRecordQueryReqDto" : {
      "type" : "object",
      "properties" : {
        "page" : {
          "type" : "integer",
          "format" : "int64",
          "minimum" : 1.0
        },
        "count" : {
          "type" : "integer",
          "format" : "int64",
          "minimum" : 1.0
        },
        "condition" : {
          "type" : "string",
          "description" : "预约人/被预约人姓名"
        },
        "status" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "预约状态;0:待接受,1:接受,2:拒绝"
        }
      }
    },
    "ReservationRecordUpdateReqDto" : {
      "type" : "object",
      "properties" : {
        "recordId" : {
          "type" : "string"
        },
        "status" : {
          "type" : "integer",
          "format" : "int32"
        }
      }
    },
    "ReservationUserQueryReqDto" : {
      "type" : "object",
      "properties" : {
        "page" : {
          "type" : "integer",
          "format" : "int64",
          "minimum" : 1.0
        },
        "count" : {
          "type" : "integer",
          "format" : "int64",
          "minimum" : 1.0
        },
        "nickname" : {
          "type" : "string",
          "description" : "微信昵称"
        },
        "startTime" : {
          "type" : "string",
          "description" : "注册时间-开始"
        },
        "endTime" : {
          "type" : "string",
          "description" : "注册时间-结束"
        }
      }
    },
    "ReservedLanguagesAddReqDto" : {
      "type" : "object",
      "properties" : {
        "code" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "语种编号"
        },
        "level" : {
          "type" : "string",
          "description" : "语种水平"
        }
      }
    },
    "ReservedUserAddReqDto" : {
      "type" : "object",
      "properties" : {
        "id" : {
          "type" : "string",
          "description" : "id, 更新时 id 不能为空"
        },
        "username" : {
          "type" : "string",
          "description" : "账号"
        },
        "password" : {
          "type" : "string",
          "description" : "密码"
        },
        "name" : {
          "type" : "string",
          "description" : "姓名"
        },
        "phone" : {
          "type" : "string",
          "description" : "手机"
        },
        "position" : {
          "type" : "string",
          "description" : "职位"
        },
        "department" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "所属部门"
        },
        "university" : {
          "type" : "string",
          "description" : "毕业院校"
        },
        "languagesAddReqDtos" : {
          "type" : "array",
          "description" : "语种数组",
          "items" : {
            "$ref" : "#/definitions/ReservedLanguagesAddReqDto"
          }
        }
      }
    },
    "ReservedUserPasswordVerificationReqDto" : {
      "type" : "object",
      "properties" : {
        "reservedUserId" : {
          "type" : "string",
          "description" : "被预约人ID"
        },
        "password" : {
          "type" : "string",
          "description" : "新密码"
        },
        "secondPassword" : {
          "type" : "string",
          "description" : "再次新密码"
        }
      }
    },
    "ReservedUserQueryReqDto" : {
      "type" : "object",
      "properties" : {
        "page" : {
          "type" : "integer",
          "format" : "int64",
          "minimum" : 1.0
        },
        "count" : {
          "type" : "integer",
          "format" : "int64",
          "minimum" : 1.0
        },
        "condition" : {
          "type" : "string",
          "description" : "账号/姓名/手机号"
        },
        "code" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "语种编号"
        },
        "department" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "所属部门"
        },
        "userStatus" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "是否启用;0:禁用,1:启用"
        }
      }
    },
    "ReservedUserUpdateStausReqDto" : {
      "type" : "object",
      "properties" : {
        "reservedUserId" : {
          "type" : "string",
          "description" : "被预约人ID"
        },
        "userStatus" : {
          "type" : "integer",
          "format" : "int32",
          "description" : "是否启用;0:禁用,1:启用"
        }
      }
    },
    "ResponseDto" : {
      "type" : "object",
      "properties" : {
        "status" : {
          "description" : "状态",
          "$ref" : "#/definitions/Status"
        },
        "data" : {
          "type" : "object",
          "description" : "数据"
        }
      }
    },
    "ServletContext" : {
      "type" : "object",
      "properties" : {
        "attributeNames" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "majorVersion" : {
          "type" : "integer",
          "format" : "int32"
        },
        "minorVersion" : {
          "type" : "integer",
          "format" : "int32"
        },
        "servletContextName" : {
          "type" : "string"
        },
        "initParameterNames" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "contextPath" : {
          "type" : "string"
        },
        "serverInfo" : {
          "type" : "string"
        },
        "servlets" : {
          "$ref" : "#/definitions/Enumeration"
        },
        "servletNames" : {
          "$ref" : "#/definitions/Enumeration"
        }
      }
    },
    "ServletInputStream" : {
      "type" : "object"
    },
    "ServletOutputStream" : {
      "type" : "object"
    },
    "Status" : {
      "type" : "object",
      "properties" : {
        "errCode" : {
          "type" : "integer",
          "format" : "int32"
        },
        "message" : {
          "type" : "string"
        }
      }
    },
    "StringBuffer" : {
      "type" : "object"
    }
  }
}


  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Swagger Maven Plugin是一个用于生成Swagger接口文档Maven插件。它可以帮助开发人员在构建项目时自动生成Swagger规范的JSON或YAML文件,以便于API文档的管理和使用。 使用Swagger Maven Plugin生成接口文档swagger.json或swagger.yaml的步骤如下: 1. 在项目的pom.xml文件中添加Swagger Maven Plugin的依赖配置: ```xml <build> <plugins> <plugin> <groupId>com.github.kongchen</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>3.1.8</version> <configuration> <!-- 配置Swagger文档的基本信息 --> <apiSources> <apiSource> <springmvc>true</springmvc> <locations>com.example.controller</locations> <basePath>/api</basePath> <info> <title>API文档</title> <version>1.0.0</version> <description>API接口文档</description> <termsOfServiceUrl>http://example.com/terms-of-service</termsOfServiceUrl> <contact> <email>contact@example.com</email> </contact> <license> <name>Apache 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> </license> </info> </apiSource> </apiSources> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> </plugins> </build> ``` 2. 在项目根目录下执行以下命令生成Swagger接口文档: ``` mvn compile swagger:generate ``` 3. 执行完上述命令后,Swagger Maven Plugin会根据配置的信息扫描项目中的接口,并生成Swagger规范的JSON或YAML文件。生成的文件默认保存在项目的target目录下的swagger目录中。 生成Swagger接口文档可以通过访问http://localhost:8080/api/swagger-ui.html(假设项目部署在本地的8080端口)来查看和测试API接口。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值