静态HTML与PDF导出:资源完整和内容完整
区分描述转换、动态页面打印以及真正离线可读的交付包。
学完这一章,你能够
- 区分描述转换、动态页面打印以及真正离线可读的交付包。
- 区分描述转换、动态页面打印以及真正离线可读的交付包。
静态文档不是HTML外壳
Swagger2Markup到AsciiDoc/Markdown再到Asciidoctor输出,是一种转换工作流;先确认输入方言是否受支持,不能假定旧Swagger2转换器能解析任意OpenAPI3文档。Maven插件、依赖、执行ID及输入输出目录须组成完整工程。
curl保存UI入口或page.content取得渲染DOM,都不会自动打包相对路径JS/CSS、规范、图标和外部引用。离线文档必须包含必要资源,或把内容与样式真正内联,并在断开网络条件下检查阅读和锚点。
PDF的字体、页边距和长内容
AsciiDoc到PDF可设置A4、边距、标题页、目录、页眉页脚、代码框和字体。中文字体须有真实文件、可分发许可和正确嵌入;配置里写一个字体名不等于输出已支持中文。
长路径、JSON模型和代码需要换行/分页策略。全部操作、参数、主要响应及模型都要进入输出;只导出折叠UI首页,或者用文字抽取成功代替视觉检查,都不能说明内容完整。
浏览器打印必须等待真实就绪
wkhtmltopdf属于另一种渲染环境,旧WebKit可能无法执行现代UI;保留其历史用途但不把等待固定5秒当作就绪证明。现代浏览器打印需等待规范加载、必要节点出现和字体完成,再展开需要的操作内容。
Puppeteer/浏览器API也要匹配实际版本,不照搬已移除的方法。打印页眉页脚有独立样式上下文,页码占位和边距必须实际检查;输出文件名、规范哈希和版本一起记录。
导出与发布分别验收
静态HTML应在本地独立打开阅读,PDF应检查页数、可见文字、图形、裁切、链接与最后一页。不同转换器的实际结果分别记录,成功生成一份自有打印文档不冒称所有历史工具链均已执行。
导出只产生本地文件,不自动上传到文档平台或生产服务器。公开包不包含内部来源快照、认证令牌或机器私有路径;规范更新后重新生成并核对附件版本。
输出格式及真实交付物
| 工具/方案 | 用途 | 适用条件与本轮状态 |
| 浏览器打印 | 静态内联HTML→实际PDF | 本包78页、21操作、24模型、页码及全部页面渲染核验 |
| Swagger2Markup | 历史转换链,可接AsciiDoc/PDF工具 | Swagger2与OpenAPI3兼容性需逐版本检查;不能直接声称通用 |
| Widdershins / ReDoc静态工作流 | 把描述生成阅读文档 | HTML与PDF不同,依赖和资源须完整;本轮外部CLI待运行 |
| curl / page.content() | 获取响应或当前DOM | 不会自动打包依赖,不等于完整离线站点 |
| Puppeteer/Playwright/DevTools | 自动打开页面并打印 | 等待真实加载及字体;旧waitForTimeout用法需按版本调整,本包实际Edge DevTools打印 |
本章独立核心源码与验证步骤
展开查看收起
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="robots" content="noindex,nofollow"><title>蓝色天空网 · 接口静态阅读文档</title><style>body{max-width:1050px;margin:24px auto;padding:20px;color:#183047;font:16px/1.65 system-ui,sans-serif}h1,h2{color:#1d4ed8}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.55 Consolas,monospace;background:#f2f6fc;padding:12px;border:1px solid #cbdcf4}a{color:#1d4ed8}@page{size:A4;margin:18mm}h2,h3{break-after:avoid}.operation{break-before:page}pre{box-decoration-break:clone}header{break-after:page}</style></head><body><header><h1>蓝色天空网 · 接口学习文档</h1><p>mbsky.com · 独立本地模拟API · OpenAPI 3.0.3</p><p>完整阅读版,无需外部JS、CSS或网络连接;接口运行另需本地服务。</p><nav><ol><li><a href="#listUsers">GET /users</a></li><li><a href="#createUser">POST /users</a></li><li><a href="#getUser">GET /users/{userId}</a></li><li><a href="#replaceUser">PUT /users/{userId}</a></li><li><a href="#deleteUser">DELETE /users/{userId}</a></li><li><a href="#patchUser">PATCH /users/{userId}</a></li><li><a href="#login">POST /auth/login</a></li><li><a href="#register">POST /auth/register</a></li><li><a href="#listBooks">GET /books</a></li><li><a href="#createBook">POST /books</a></li><li><a href="#getBook">GET /books/{bookId}</a></li><li><a href="#replaceBook">PUT /books/{bookId}</a></li><li><a href="#deleteBook">DELETE /books/{bookId}</a></li><li><a href="#patchBook">PATCH /books/{bookId}</a></li><li><a href="#listProducts">GET /products</a></li><li><a href="#createProduct">POST /products</a></li><li><a href="#getProduct">GET /products/{productId}</a></li><li><a href="#replaceProduct">PUT /products/{productId}</a></li><li><a href="#deleteProduct">DELETE /products/{productId}</a></li><li><a href="#listOrders">GET /orders</a></li><li><a href="#createOrder">POST /orders</a></li></ol></nav></header><section class="operation" id="listUsers"><h2>GET /users</h2><p>分页和状态过滤用户</p><p>operationId: listUsers;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"$ref": "#/components/parameters/Page"
},
{
"$ref": "#/components/parameters/Limit"
},
{
"$ref": "#/components/parameters/Offset"
},
{
"name": "status",
"in": "query",
"schema": {
"type": "string",
"enum": [
"active",
"inactive",
"banned"
]
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserList"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="createUser"><h2>POST /users</h2><p>创建用户</p><p>operationId: createUser;业务版本 1.0.0</p><h3>参数</h3><pre>[]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewUser"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"201": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "用户名或邮箱冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="getUser"><h2>GET /users/{userId}</h2><p>获取用户详情</p><p>operationId: getUser;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserDetail"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="replaceUser"><h2>PUT /users/{userId}</h2><p>整体替换允许的用户资料</p><p>operationId: replaceUser;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReplaceUser"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserDetail"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "资源冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="deleteUser"><h2>DELETE /users/{userId}</h2><p>删除用户</p><p>operationId: deleteUser;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"204": {
"description": "成功"
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="patchUser"><h2>PATCH /users/{userId}</h2><p>部分更新允许的用户字段</p><p>operationId: patchUser;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateUser"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserDetail"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "资源冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="login"><h2>POST /auth/login</h2><p>教学用户登录</p><p>operationId: login;业务版本 1.0.0</p><h3>参数</h3><pre>[]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Login"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Token"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "凭证错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": []
}</pre></section><section class="operation" id="register"><h2>POST /auth/register</h2><p>注册独立模拟用户</p><p>operationId: register;业务版本 1.0.0</p><h3>参数</h3><pre>[]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewUser"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"201": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RegisterResult"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": []
}</pre></section><section class="operation" id="listBooks"><h2>GET /books</h2><p>分页过滤books</p><p>operationId: listBooks;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"$ref": "#/components/parameters/Page"
},
{
"$ref": "#/components/parameters/Limit"
},
{
"name": "category",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "author",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "title",
"in": "query",
"schema": {
"type": "string"
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BookList"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": []
}</pre></section><section class="operation" id="createBook"><h2>POST /books</h2><p>创建books</p><p>operationId: createBook;业务版本 1.0.0</p><h3>参数</h3><pre>[]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BookInput"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"201": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "资源冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="getBook"><h2>GET /books/{bookId}</h2><p>books详情/替换/删除</p><p>operationId: getBook;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "bookId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": []
}</pre></section><section class="operation" id="replaceBook"><h2>PUT /books/{bookId}</h2><p>books详情/替换/删除</p><p>operationId: replaceBook;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "bookId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BookInput"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "资源冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="deleteBook"><h2>DELETE /books/{bookId}</h2><p>books详情/替换/删除</p><p>operationId: deleteBook;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "bookId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"204": {
"description": "成功"
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="patchBook"><h2>PATCH /books/{bookId}</h2><p>部分更新允许的图书字段</p><p>operationId: patchBook;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "bookId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BookPatch"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Book"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "资源冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="listProducts"><h2>GET /products</h2><p>分页过滤products</p><p>operationId: listProducts;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"$ref": "#/components/parameters/Page"
},
{
"$ref": "#/components/parameters/Limit"
},
{
"name": "category",
"in": "query",
"schema": {
"type": "string"
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductList"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": []
}</pre></section><section class="operation" id="createProduct"><h2>POST /products</h2><p>创建products</p><p>operationId: createProduct;业务版本 1.0.0</p><h3>参数</h3><pre>[]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductInput"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"201": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Product"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"409": {
"description": "资源冲突",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="getProduct"><h2>GET /products/{productId}</h2><p>products详情/替换/删除</p><p>operationId: getProduct;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "productId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Product"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": []
}</pre></section><section class="operation" id="replaceProduct"><h2>PUT /products/{productId}</h2><p>products详情/替换/删除</p><p>operationId: replaceProduct;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "productId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductInput"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Product"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="deleteProduct"><h2>DELETE /products/{productId}</h2><p>products详情/替换/删除</p><p>operationId: deleteProduct;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"name": "productId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"204": {
"description": "成功"
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="listOrders"><h2>GET /orders</h2><p>查询自己的订单</p><p>operationId: listOrders;业务版本 1.0.0</p><h3>参数</h3><pre>[
{
"$ref": "#/components/parameters/Page"
},
{
"$ref": "#/components/parameters/Limit"
},
{
"name": "status",
"in": "query",
"schema": {
"type": "string",
"enum": [
"pending",
"processing",
"shipped",
"delivered",
"cancelled"
]
}
}
]</pre><h3>请求体</h3><pre>{}</pre><h3>响应与权限</h3><pre>{
"responses": {
"200": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrderList"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><section class="operation" id="createOrder"><h2>POST /orders</h2><p>按真实产品价格计算模拟订单</p><p>operationId: createOrder;业务版本 1.0.0</p><h3>参数</h3><pre>[]</pre><h3>请求体</h3><pre>{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrderInput"
}
}
}
}</pre><h3>响应与权限</h3><pre>{
"responses": {
"201": {
"description": "成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Order"
}
}
}
},
"400": {
"description": "输入错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "权限不足",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"429": {
"description": "本地教学限流",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"413": {
"description": "请求体过大",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"415": {
"description": "媒体类型错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
}</pre></section><h2>服务器、公共参数与安全方案</h2><pre>{
"servers": [
{
"url": "/api/v1",
"description": "独立本机教学服务"
}
],
"globalSecurity": [
{
"bearerAuth": []
}
],
"parameters": {
"Page": {
"name": "page",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"default": 1
}
},
"Limit": {
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 100,
"default": 20
}
},
"Offset": {
"name": "offset",
"in": "query",
"schema": {
"type": "integer",
"minimum": 0,
"default": 0
}
}
},
"responses": {
"Unauthorized": {
"description": "未认证",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"NotFound": {
"description": "资源不存在",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
},
"apiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "X-API-Key"
},
"OAuthExample": {
"type": "oauth2",
"flows": {
"authorizationCode": {
"authorizationUrl": "https://example.invalid/authorize",
"tokenUrl": "https://example.invalid/token",
"scopes": {
"read": "读取",
"write": "写入"
}
}
}
}
}
}</pre><h2>全部数据模型</h2><section id="model-UserBase"><h3>UserBase</h3><pre>{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1,
"readOnly": true
},
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50
},
"email": {
"type": "string",
"format": "email"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive",
"banned"
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"readOnly": true
}
},
"required": [
"id",
"username",
"email",
"status",
"createdAt"
]
}</pre></section><section id="model-User"><h3>User</h3><pre>{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1,
"readOnly": true
},
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50
},
"email": {
"type": "string",
"format": "email"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive",
"banned"
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"readOnly": true
}
},
"allOf": [
{
"$ref": "#/components/schemas/UserBase"
}
],
"additionalProperties": false
}</pre></section><section id="model-UserDetail"><h3>UserDetail</h3><pre>{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1,
"readOnly": true
},
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50
},
"email": {
"type": "string",
"format": "email"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive",
"banned"
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"readOnly": true
},
"firstName": {
"type": "string",
"maxLength": 80
},
"lastName": {
"type": "string",
"maxLength": 80
},
"phone": {
"type": "string",
"maxLength": 30
},
"lastLogin": {
"type": "string",
"format": "date-time"
}
},
"allOf": [
{
"$ref": "#/components/schemas/UserBase"
}
],
"additionalProperties": false
}</pre></section><section id="model-NewUser"><h3>NewUser</h3><pre>{
"type": "object",
"properties": {
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50
},
"email": {
"type": "string",
"format": "email"
},
"password": {
"type": "string",
"minLength": 8,
"maxLength": 100,
"writeOnly": true
}
},
"required": [
"username",
"email",
"password"
],
"additionalProperties": false
}</pre></section><section id="model-UpdateUser"><h3>UpdateUser</h3><pre>{
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email"
},
"firstName": {
"type": "string",
"maxLength": 80
},
"lastName": {
"type": "string",
"maxLength": 80
},
"phone": {
"type": "string",
"maxLength": 30
},
"password": {
"type": "string",
"minLength": 8,
"maxLength": 100,
"writeOnly": true
}
},
"minProperties": 1,
"additionalProperties": false
}</pre></section><section id="model-Login"><h3>Login</h3><pre>{
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string",
"writeOnly": true
}
},
"required": [
"username",
"password"
],
"additionalProperties": false
}</pre></section><section id="model-Error"><h3>Error</h3><pre>{
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"additionalProperties": false
}</pre></section><section id="model-Token"><h3>Token</h3><pre>{
"type": "object",
"properties": {
"accessToken": {
"type": "string"
},
"tokenType": {
"type": "string",
"enum": [
"Bearer"
]
},
"expiresIn": {
"type": "integer",
"minimum": 1
}
},
"required": [
"accessToken",
"tokenType",
"expiresIn"
],
"additionalProperties": false
}</pre></section><section id="model-Address"><h3>Address</h3><pre>{
"type": "object",
"properties": {
"street": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"state": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"zipCode": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"country": {
"type": "string",
"minLength": 1,
"maxLength": 120
}
},
"required": [
"street",
"city",
"state",
"zipCode",
"country"
],
"additionalProperties": false
}</pre></section><section id="model-ProductInput"><h3>ProductInput</h3><pre>{
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"description": {
"type": "string",
"maxLength": 1000
},
"priceCents": {
"type": "integer",
"minimum": 0,
"maximum": 100000000
},
"category": {
"type": "string",
"enum": [
"electronics",
"books",
"clothing",
"food"
]
},
"inStock": {
"type": "boolean",
"default": true
}
},
"required": [
"name",
"priceCents",
"category"
],
"additionalProperties": false
}</pre></section><section id="model-OrderItemInput"><h3>OrderItemInput</h3><pre>{
"type": "object",
"properties": {
"productId": {
"type": "integer",
"minimum": 1
},
"quantity": {
"type": "integer",
"minimum": 1,
"maximum": 100
}
},
"required": [
"productId",
"quantity"
],
"additionalProperties": false
}</pre></section><section id="model-OrderInput"><h3>OrderInput</h3><pre>{
"type": "object",
"properties": {
"items": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"$ref": "#/components/schemas/OrderItemInput"
}
},
"shippingAddress": {
"$ref": "#/components/schemas/Address"
}
},
"required": [
"items",
"shippingAddress"
],
"additionalProperties": false
}</pre></section><section id="model-BookInput"><h3>BookInput</h3><pre>{
"type": "object",
"properties": {
"title": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"author": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"publishDate": {
"type": "string",
"format": "date"
},
"isbn": {
"type": "string",
"format": "isbn",
"description": "Custom validation: real ISBN10/13 checksum; sample code does not claim actual publisher assignment."
},
"category": {
"type": "string",
"minLength": 1,
"maxLength": 40
}
},
"required": [
"title",
"author",
"isbn"
],
"additionalProperties": false
}</pre></section><section id="model-ReplaceUser"><h3>ReplaceUser</h3><pre>{
"type": "object",
"properties": {
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50
},
"email": {
"type": "string",
"format": "email"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive",
"banned"
]
},
"firstName": {
"type": "string",
"maxLength": 80
},
"lastName": {
"type": "string",
"maxLength": 80
},
"phone": {
"type": "string",
"maxLength": 30
}
},
"required": [
"username",
"email",
"status"
],
"additionalProperties": false
}</pre></section><section id="model-Product"><h3>Product</h3><pre>{
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"description": {
"type": "string",
"maxLength": 1000
},
"priceCents": {
"type": "integer",
"minimum": 0,
"maximum": 100000000
},
"category": {
"type": "string",
"enum": [
"electronics",
"books",
"clothing",
"food"
]
},
"inStock": {
"type": "boolean",
"default": true
},
"id": {
"type": "integer",
"minimum": 1,
"readOnly": true
},
"createdAt": {
"type": "string",
"format": "date-time",
"readOnly": true
}
},
"required": [
"name",
"priceCents",
"category",
"id",
"createdAt"
],
"additionalProperties": false
}</pre></section><section id="model-Book"><h3>Book</h3><pre>{
"type": "object",
"properties": {
"title": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"author": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"publishDate": {
"type": "string",
"format": "date"
},
"isbn": {
"type": "string",
"format": "isbn",
"description": "Custom validation: real ISBN10/13 checksum; sample code does not claim actual publisher assignment."
},
"category": {
"type": "string",
"minLength": 1,
"maxLength": 40
},
"id": {
"type": "integer",
"minimum": 1,
"readOnly": true
}
},
"required": [
"title",
"author",
"isbn",
"id"
],
"additionalProperties": false
}</pre></section><section id="model-BookPatch"><h3>BookPatch</h3><pre>{
"type": "object",
"properties": {
"title": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"author": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"publishDate": {
"type": "string",
"format": "date"
},
"isbn": {
"type": "string",
"format": "isbn",
"description": "Custom validation: real ISBN10/13 checksum; sample code does not claim actual publisher assignment."
},
"category": {
"type": "string",
"minLength": 1,
"maxLength": 40
}
},
"additionalProperties": false,
"minProperties": 1
}</pre></section><section id="model-OrderItem"><h3>OrderItem</h3><pre>{
"type": "object",
"properties": {
"productId": {
"type": "integer",
"minimum": 1
},
"quantity": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"unitPriceCents": {
"type": "integer",
"minimum": 0,
"readOnly": true
}
},
"required": [
"productId",
"quantity",
"unitPriceCents"
],
"additionalProperties": false
}</pre></section><section id="model-Order"><h3>Order</h3><pre>{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": 1,
"readOnly": true
},
"userId": {
"type": "integer",
"minimum": 1,
"readOnly": true
},
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OrderItem"
}
},
"shippingAddress": {
"$ref": "#/components/schemas/Address"
},
"totalCents": {
"type": "integer",
"minimum": 0,
"readOnly": true
},
"status": {
"type": "string",
"enum": [
"pending",
"processing",
"shipped",
"delivered",
"cancelled"
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"readOnly": true
}
},
"required": [
"id",
"userId",
"items",
"shippingAddress",
"totalCents",
"status",
"createdAt"
],
"additionalProperties": false
}</pre></section><section id="model-UserList"><h3>UserList</h3><pre>{
"type": "object",
"properties": {
"total": {
"type": "integer",
"minimum": 0
},
"page": {
"type": "integer",
"minimum": 1
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
},
"required": [
"total",
"page",
"limit",
"data"
],
"additionalProperties": false
}</pre></section><section id="model-BookList"><h3>BookList</h3><pre>{
"type": "object",
"properties": {
"total": {
"type": "integer",
"minimum": 0
},
"page": {
"type": "integer",
"minimum": 1
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Book"
}
}
},
"required": [
"total",
"page",
"limit",
"data"
],
"additionalProperties": false
}</pre></section><section id="model-ProductList"><h3>ProductList</h3><pre>{
"type": "object",
"properties": {
"total": {
"type": "integer",
"minimum": 0
},
"page": {
"type": "integer",
"minimum": 1
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Product"
}
}
},
"required": [
"total",
"page",
"limit",
"data"
],
"additionalProperties": false
}</pre></section><section id="model-OrderList"><h3>OrderList</h3><pre>{
"type": "object",
"properties": {
"total": {
"type": "integer",
"minimum": 0
},
"page": {
"type": "integer",
"minimum": 1
},
"limit": {
"type": "integer",
"minimum": 1,
"maximum": 100
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Order"
}
}
},
"required": [
"total",
"page",
"limit",
"data"
],
"additionalProperties": false
}</pre></section><section id="model-RegisterResult"><h3>RegisterResult</h3><pre>{
"type": "object",
"properties": {
"user": {
"$ref": "#/components/schemas/User"
},
"token": {
"$ref": "#/components/schemas/Token"
}
},
"required": [
"user",
"token"
],
"additionalProperties": false
}</pre></section><footer>蓝色天空网 · mbsky.com · 请结合对应版本的源码与实际运行检查。</footer></body></html>
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 完整静态文档、21操作24模型及实际打印PDF
- 本轮实际范围以记录为准,规范通过/生成通过不自动等于其它语言运行成功
本章附件与实例包
常见错误与边界检查
- 把Swagger工具和OpenAPI规范混为同一服务。
- 登录误继承全局Bearer,或生成器参数混用。
- 只有状态码没有检查字段、敏感数据、实际权限与金额。
技术规范与官方资料
练习与参考解答
查看参考解答
保持合同和实现同版本;明确验证输入、响应、权限、异常和环境,不能用模拟结果冒充真实运行。