Skip to content

Commit d0844df

Browse files
committed
更新 OpenAPI 配置,增加 Zod 客户端代码生成支持,并修正导入路径
1 parent f31c4e6 commit d0844df

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/features/openapi/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ export default defineConfig({
5454
},
5555
schemas: 'src/api/models',
5656
},
57+
},
58+
zod: {
59+
input: {
60+
target: './swagger.json',
61+
// 或远程: 'http://localhost:3000/api/swagger.json'
62+
},
63+
output: {
64+
target: 'src/api/zod-schemas',
65+
client: 'zod',
66+
},
5767
},
5868
});
5969
```
@@ -298,7 +308,7 @@ const UserListWithPagination: FC = function UserListWithPagination() {
298308
```tsx
299309
import { type FC } from 'react';
300310
import { z } from 'zod';
301-
import { UserSchema } from '../api/generated/zod-schemas';
311+
import { UserSchema } from '@/api/zod-schemas';
302312

303313
interface UserCardProps {
304314
userId: string

0 commit comments

Comments
 (0)