Files
zzyxyz_go_api/config/vfs/vfs.yaml
zzy 1e81e603de feat(bookmark): 初始化书签服务并配置路由与权限控制
新增书签服务主程序,使用 Gin 框架搭建 HTTP 服务器,并注册书签相关接口处理器。
配置 CORS 中间件以支持跨域请求。服务监听端口为 8081。

feat(user_np): 初始化用户权限服务并注册认证接口

新增用户权限服务主程序,使用 Gin 框架搭建 HTTP 服务器,并注册登录、注册及修改密码等接口处理器。
服务监听端口为 8082。

refactor(config): 重构 OpenAPI 配置文件结构并拆分模块

将原有合并的 OpenAPI 配置文件按功能模块拆分为 bookmark 和 user_np 两个独立目录,
分别管理各自的 server、client 及 API 定义文件,便于后续维护和扩展。

refactor(vfs): 调整虚拟文件系统 API 接口路径与参数定义

更新 VFS API 配置文件,修改部分接口路径及参数结构,
如将文件路径参数由 path 转为 query 参数,并优化响应结构体定义。
2025-09-23 21:52:51 +08:00

256 lines
6.5 KiB
YAML

openapi: '3.0.3'
info:
title: zzyxyz_vfs_api
description: 虚拟文件系统API服务
version: '1.0'
servers:
- url: http://localhost:8083/api
description: 开发环境
- url: https://api.zzyxyz.com/api
description: 生产环境
tags:
- name: vfs
description: 虚拟文件系统相关操作
security:
- ApiKeyAuth: []
paths:
/vfs/v1/users:
post:
summary: 创建用户
description: 创建一个用户
operationId: createUser
tags: [vfs]
requestBody:
required: true
content:
application/json:
schema:
type: string
description: 用户名
responses:
'201':
description: 创建成功
content:
application/json:
schema:
type: string
description: X-VFS-TOKEN
delete:
summary: 删除用户
description: 删除一个用户
operationId: deleteUser
tags: [vfs]
responses:
'204':
description: 删除成功
'404':
description: 用户不存在
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/ServerInternalError'
/vfs/v1/files:
parameters:
- name: path
in: query
required: true
description: 文件系统路径,例如 "documents/readme.txt" 或 "services/mysql.service" 或 "folder/"
schema:
type: string
example: "readme.txt"
get:
summary: 读取文件或列出目录
description: 获取指定路径的文件内容或目录列表
operationId: getVFSNode
tags: [vfs]
parameters:
- name: op
in: query
required: false
description: 操作类型, list表示列出目录内容, 不指定则读取文件内容
schema:
type: string
enum: [list]
responses:
'200':
description: 文件内容或目录列表
content:
application/json:
schema:
oneOf:
- type: string
description: 文件内容
- type: array
items:
$ref: '#/components/schemas/VFSDirectoryEntry'
description: 目录条目列表
'404':
description: 路径不存在
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/ServerInternalError'
post:
summary: 创建文件或目录
description: 创建文件或目录
operationId: createVFSNode
tags: [vfs]
requestBody:
required: true
content:
application/json:
schema:
type: string
description: 文件内容(仅当type为file时有效)
responses:
'201':
description: 创建成功
content:
application/json:
schema:
$ref: '#/components/schemas/VFSNodeResponse'
'400':
description: 请求参数错误
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/ServerInternalError'
patch:
summary: 修改文件或修改目录
description: 修改/移动/重命名 已存在的 文件/目录
operationId: updateVFSNode
tags: [vfs]
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
new_name:
type: string
description: 新名称(用于重命名)
responses:
'200':
description: 操作成功
content:
application/json:
schema:
$ref: '#/components/schemas/VFSNodeResponse'
'400':
description: 请求参数错误
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/ServerInternalError'
delete:
summary: 删除文件或目录
description: 删除指定路径的文件或目录
operationId: deleteVFSNode
tags: [vfs]
responses:
'204':
description: 删除成功
'404':
description: 路径不存在
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/ServerInternalError'
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-VFS-Token
responses:
ServerInternalError:
description: 服务器内部错误
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: 未授权
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
VFSNodeType:
type: string
description: 节点类型
enum: [file, directory, service]
VFSNodeResponse:
type: object
properties:
name:
type: string
description: 节点名称
type:
$ref: '#/components/schemas/VFSNodeType'
created_at:
type: string
format: date-time
description: 创建时间
updated_at:
type: string
format: date-time
description: 更新时间
required:
- name
- type
- created_at
- updated_at
VFSDirectoryEntry:
type: object
properties:
name:
type: string
description: 条目名称
type:
$ref: '#/components/schemas/VFSNodeType'
permissions:
type: string
description: 权限信息,如 "rw"
required:
- name
- type
- modified
Error:
type: object
description: 错误信息
properties:
errtype:
type: string
example: "ParameterError"
description: 错误类型
message:
example: "传递的第一个参数错误"
type: string
description: 错误信息
required:
- errtype
- message