init
This commit is contained in:
22
.roo/rules/04-api.md
Normal file
22
.roo/rules/04-api.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# 接口定义规范
|
||||
|
||||
1. **DTO定义**
|
||||
- 必须包含`description`字段说明用途
|
||||
- 必须包含`example`字段提供示例值
|
||||
- 示例:
|
||||
```typescript
|
||||
export const CreateUserDto = z.object({
|
||||
username: z.string().min(3).max(20).openapi({
|
||||
example: 'john_doe',
|
||||
description: '用户名, 3-20个字符'
|
||||
}),
|
||||
password: z.string().min(6).openapi({
|
||||
example: 'password123',
|
||||
description: '密码, 最少6位'
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
2. **API响应**
|
||||
- 统一的API响应格式
|
||||
- 完善的Swagger文档
|
||||
Reference in New Issue
Block a user