蓝色天空网 · 接口学习文档

mbsky.com · 独立本地模拟API · OpenAPI 3.0.3

完整阅读版,无需外部JS、CSS或网络连接;接口运行另需本地服务。

GET /users

分页和状态过滤用户

operationId: listUsers;业务版本 1.0.0

参数

[
  {
    "$ref": "#/components/parameters/Page"
  },
  {
    "$ref": "#/components/parameters/Limit"
  },
  {
    "$ref": "#/components/parameters/Offset"
  },
  {
    "name": "status",
    "in": "query",
    "schema": {
      "type": "string",
      "enum": [
        "active",
        "inactive",
        "banned"
      ]
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
    }
  ]
}

POST /users

创建用户

operationId: createUser;业务版本 1.0.0

参数

[]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NewUser"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

GET /users/{userId}

获取用户详情

operationId: getUser;业务版本 1.0.0

参数

[
  {
    "name": "userId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
    }
  ]
}

PUT /users/{userId}

整体替换允许的用户资料

operationId: replaceUser;业务版本 1.0.0

参数

[
  {
    "name": "userId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ReplaceUser"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

DELETE /users/{userId}

删除用户

operationId: deleteUser;业务版本 1.0.0

参数

[
  {
    "name": "userId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
    }
  ]
}

PATCH /users/{userId}

部分更新允许的用户字段

operationId: patchUser;业务版本 1.0.0

参数

[
  {
    "name": "userId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/UpdateUser"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

POST /auth/login

教学用户登录

operationId: login;业务版本 1.0.0

参数

[]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/Login"
      }
    }
  }
}

响应与权限

{
  "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": []
}

POST /auth/register

注册独立模拟用户

operationId: register;业务版本 1.0.0

参数

[]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NewUser"
      }
    }
  }
}

响应与权限

{
  "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": []
}

GET /books

分页过滤books

operationId: listBooks;业务版本 1.0.0

参数

[
  {
    "$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"
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
}

POST /books

创建books

operationId: createBook;业务版本 1.0.0

参数

[]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/BookInput"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

GET /books/{bookId}

books详情/替换/删除

operationId: getBook;业务版本 1.0.0

参数

[
  {
    "name": "bookId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
}

PUT /books/{bookId}

books详情/替换/删除

operationId: replaceBook;业务版本 1.0.0

参数

[
  {
    "name": "bookId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/BookInput"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

DELETE /books/{bookId}

books详情/替换/删除

operationId: deleteBook;业务版本 1.0.0

参数

[
  {
    "name": "bookId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
    }
  ]
}

PATCH /books/{bookId}

部分更新允许的图书字段

operationId: patchBook;业务版本 1.0.0

参数

[
  {
    "name": "bookId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/BookPatch"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

GET /products

分页过滤products

operationId: listProducts;业务版本 1.0.0

参数

[
  {
    "$ref": "#/components/parameters/Page"
  },
  {
    "$ref": "#/components/parameters/Limit"
  },
  {
    "name": "category",
    "in": "query",
    "schema": {
      "type": "string"
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
}

POST /products

创建products

operationId: createProduct;业务版本 1.0.0

参数

[]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductInput"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

GET /products/{productId}

products详情/替换/删除

operationId: getProduct;业务版本 1.0.0

参数

[
  {
    "name": "productId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
}

PUT /products/{productId}

products详情/替换/删除

operationId: replaceProduct;业务版本 1.0.0

参数

[
  {
    "name": "productId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ProductInput"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

DELETE /products/{productId}

products详情/替换/删除

operationId: deleteProduct;业务版本 1.0.0

参数

[
  {
    "name": "productId",
    "in": "path",
    "required": true,
    "schema": {
      "type": "integer",
      "minimum": 1
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
    }
  ]
}

GET /orders

查询自己的订单

operationId: listOrders;业务版本 1.0.0

参数

[
  {
    "$ref": "#/components/parameters/Page"
  },
  {
    "$ref": "#/components/parameters/Limit"
  },
  {
    "name": "status",
    "in": "query",
    "schema": {
      "type": "string",
      "enum": [
        "pending",
        "processing",
        "shipped",
        "delivered",
        "cancelled"
      ]
    }
  }
]

请求体

{}

响应与权限

{
  "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": []
    }
  ]
}

POST /orders

按真实产品价格计算模拟订单

operationId: createOrder;业务版本 1.0.0

参数

[]

请求体

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/OrderInput"
      }
    }
  }
}

响应与权限

{
  "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": []
    }
  ]
}

服务器、公共参数与安全方案

{
  "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": "写入"
          }
        }
      }
    }
  }
}

全部数据模型

UserBase

{
  "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"
  ]
}

User

{
  "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
}

UserDetail

{
  "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
}

NewUser

{
  "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
}

UpdateUser

{
  "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
}

Login

{
  "type": "object",
  "properties": {
    "username": {
      "type": "string"
    },
    "password": {
      "type": "string",
      "writeOnly": true
    }
  },
  "required": [
    "username",
    "password"
  ],
  "additionalProperties": false
}

Error

{
  "type": "object",
  "properties": {
    "code": {
      "type": "integer"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": false
}

Token

{
  "type": "object",
  "properties": {
    "accessToken": {
      "type": "string"
    },
    "tokenType": {
      "type": "string",
      "enum": [
        "Bearer"
      ]
    },
    "expiresIn": {
      "type": "integer",
      "minimum": 1
    }
  },
  "required": [
    "accessToken",
    "tokenType",
    "expiresIn"
  ],
  "additionalProperties": false
}

Address

{
  "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
}

ProductInput

{
  "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
}

OrderItemInput

{
  "type": "object",
  "properties": {
    "productId": {
      "type": "integer",
      "minimum": 1
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  },
  "required": [
    "productId",
    "quantity"
  ],
  "additionalProperties": false
}

OrderInput

{
  "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
}

BookInput

{
  "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
}

ReplaceUser

{
  "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
}

Product

{
  "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
}

Book

{
  "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
}

BookPatch

{
  "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
}

OrderItem

{
  "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
}

Order

{
  "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
}

UserList

{
  "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
}

BookList

{
  "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
}

ProductList

{
  "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
}

OrderList

{
  "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
}

RegisterResult

{
  "type": "object",
  "properties": {
    "user": {
      "$ref": "#/components/schemas/User"
    },
    "token": {
      "$ref": "#/components/schemas/Token"
    }
  },
  "required": [
    "user",
    "token"
  ],
  "additionalProperties": false
}