openapi: '3.0.3' info: title: zzyxyz_user_np_api description: 用户节点权限相关操作(user_name and password) version: '1.0' servers: - url: http://localhost:8081/api description: 开发环境 - url: https://api.zzyxyz.com/api description: 生产环境 security: - ApiKeyAuth: [] paths: /auth/user/{username}/login: parameters: - name: username in: path example: user_name required: true schema: type: string post: summary: 用户登录 description: 使用用户名和密码进行登录 operationId: UserLogin requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/LoginRequest' responses: '200': description: 登录成功 content: application/json: schema: $ref: '#/components/schemas/LoginResponse' '400': description: 请求参数错误 '401': description: 认证失败 /auth/user/{username}: parameters: - name: username in: path example: user_name required: true schema: type: string post: summary: 用户注册 description: 创建新用户账户 operationId: UserRegister requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RegisterRequest' responses: '201': description: 注册成功 '400': description: 请求参数错误 '409': description: 用户名已存在 patch: summary: 修改密码 description: 修改已登录用户的密码 operationId: updatePassword security: - ApiKeyAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChangePasswordRequest' responses: '200': description: 密码修改成功 '400': description: 请求参数错误 '401': description: 认证失败 delete: summary: 删除用户 description: 删除用户 operationId: deleteUser security: - ApiKeyAuth: [] responses: '200': description: 用户注销成功 '401': description: 认证失败 /auth/user/{username}/info: parameters: - name: username in: path example: user_name required: true schema: type: string get: summary: 获取用户信息 description: 获取用户信息 json object operationId: getUserInfo tags: [auth] responses: '200': description: 用户信息 content: application/json: schema: type: object '500': $ref: '#/components/responses/ServerInternalError' put: summary: 保存用户信息 description: 保存用户信息 json object operationId: saveUserInfo tags: [auth] requestBody: required: true content: application/json: schema: type: object responses: '200': description: 保存成功 '500': $ref: '#/components/responses/ServerInternalError' components: responses: ServerInternalError: description: 服务器内部错误 content: application/json: schema: $ref: '#/components/schemas/Error' schemas: LoginRequest: type: object required: - password properties: password: type: string LoginResponse: type: object properties: token: type: string user_id: type: integer format: int64 RegisterRequest: type: object required: - password properties: password: type: string email: type: string ChangePasswordRequest: type: object required: - old_password - new_password properties: old_password: type: string new_password: type: string Error: type: object description: 错误信息 properties: errtype: type: string example: "ParameterError" description: 错误类型 message: example: "传递的第一个参数错误" type: string description: 错误信息 required: - errtype - message securitySchemes: ApiKeyAuth: type: apiKey in: header name: Authorization