refactor(bookmark): 重构 bookmark 服务生成配置和内部引用

将 bookmark 和 user_np 服务的生成配置分离为 server 和 client 包,
并更新了相应的导入路径。同时更新了 OpenAPI 配置文件中的包名、输出路径及
启用 strict-server 模式以增强类型安全。

此外,同步更新了 VFS 服务的客户端和服务端生成配置,并完善了其 OpenAPI
错误响应定义与二进制内容支持,增强了 API 的规范性和健壮性。

修复了部分权限校验逻辑,并调整了中间件注册方式以适配新的严格模式接口。
This commit is contained in:
zzy
2025-09-25 16:15:34 +08:00
parent 24f238f377
commit b2cc27b8f5
18 changed files with 878 additions and 488 deletions

View File

@ -39,6 +39,14 @@ paths:
schema:
type: string
description: 认证令牌
'400':
$ref: '#/components/responses/ParameterError'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'500':
$ref: '#/components/responses/ServerInternalError'
delete:
summary: 删除用户
@ -54,6 +62,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
'400':
$ref: '#/components/responses/ParameterError'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'500':
$ref: '#/components/responses/ServerInternalError'
@ -86,21 +100,23 @@ paths:
content:
application/json:
schema:
oneOf:
- type: string
description: 文件内容
- type: array
items:
$ref: '#/components/schemas/VFSDirectoryEntry'
description: 目录条目列表
'404':
description: 路径不存在
content:
application/json:
description: 目录条目列表
type: array
items:
$ref: '#/components/schemas/VFSDirectoryEntry'
application/octet-stream:
schema:
$ref: '#/components/schemas/Error'
description: 文件或服务的二进制内容
type: string
format: binary
'400':
$ref: '#/components/responses/ParameterError'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/PathNotFoundError'
'500':
$ref: '#/components/responses/ServerInternalError'
@ -112,23 +128,31 @@ paths:
requestBody:
required: false
content:
application/json:
schema:
type: string
description: 文件内容(仅当type为file时有效)
application/octet-stream:
schema:
description: 文件或服务的二进制内容
type: string
format: byte
responses:
'201':
description: 创建成功
content:
application/octet-stream:
schema:
description: 文件或服务的二进制内容
type: string
format: byte
application/json:
schema:
$ref: '#/components/schemas/VFSNodeResponse'
'400':
description: 请求参数错误
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
$ref: '#/components/responses/ParameterError'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/PathNotFoundError'
'500':
$ref: '#/components/responses/ServerInternalError'
@ -161,11 +185,13 @@ paths:
schema:
$ref: '#/components/schemas/VFSNodeResponse'
'400':
description: 请求参数错误
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
$ref: '#/components/responses/ParameterError'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
$ref: '#/components/responses/PathNotFoundError'
'500':
$ref: '#/components/responses/ServerInternalError'
@ -177,12 +203,14 @@ paths:
responses:
'204':
description: 删除成功
'400':
$ref: '#/components/responses/ParameterError'
'401':
$ref: '#/components/responses/UnauthorizedError'
'403':
$ref: '#/components/responses/ForbiddenError'
'404':
description: 路径不存在
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
$ref: '#/components/responses/PathNotFoundError'
'500':
$ref: '#/components/responses/ServerInternalError'
@ -200,13 +228,49 @@ components:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
errtype: "InternalServerError"
message: "服务器内部错误"
Unauthorized:
UnauthorizedError:
description: 未授权
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
errtype: "Unauthorized"
message: "访问被拒绝,缺少有效的认证令牌"
ForbiddenError:
description: 禁止
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
errtype: "Forbidden"
message: "访问被拒绝,您没有权限访问此资源"
PathNotFoundError:
description: 路径不存在
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
errtype: "PathNotFound"
message: "指定的路径不存在"
ParameterError:
description: 请求参数错误
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
errtype: "ParameterError"
message: "请求参数无效或缺失"
schemas:
VFSNodeType:
@ -258,12 +322,34 @@ components:
properties:
errtype:
type: string
example: "ParameterError"
description: 错误类型
description: |
错误类型,可能的值包括:
- "InternalServerError": 服务器内部错误
- "Unauthorized": 客户端需要提供正确格式权限
- "Forbidden": 无权限访问
- "PathNotFound": 路径不存在
- "ParameterError": 请求参数错误
- "ConflictError": 资源冲突
- "DatabaseError": 数据库操作错误
- "NotFoundError": 资源未找到
- "AccessDenied": 访问被拒绝
- "ServiceProxyError": 代理服务错误
example: "InternalServerError"
enum:
- "InternalServerError"
- "Unauthorized"
- "Forbidden"
- "PathNotFound"
- "ParameterError"
- "ConflictError"
- "DatabaseError"
- "NotFoundError"
- "AccessDenied"
- "ServiceProxyError"
message:
example: "传递的第一个参数错误"
type: string
description: 错误信息
description: 详细的错误信息
example: "传递的第一个参数错误"
required:
- errtype
- message
- message