chore(api): 将 OpenAPI 规范文件改为 YAML 格式
- api-spec.json → api-spec.yml(内容相同,YAML 更易读) - api:fetch 脚本自动转换 JSON→YAML 后删除 json 临时文件 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2a394a4882
commit
076d832a42
3
reading-platform-frontend/.gitignore
vendored
3
reading-platform-frontend/.gitignore
vendored
@ -2,4 +2,5 @@ node_modules/
|
||||
dist/
|
||||
.env.local
|
||||
|
||||
# orval 生成的文件已提交到 git,无需忽略
|
||||
# api-spec.json 是 api:fetch 的中间产物,转成 yml 后删除
|
||||
api-spec.json
|
||||
|
||||
File diff suppressed because one or more lines are too long
12146
reading-platform-frontend/api-spec.yml
Normal file
12146
reading-platform-frontend/api-spec.yml
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,9 +3,9 @@ import { defineConfig } from 'orval'
|
||||
export default defineConfig({
|
||||
readingPlatform: {
|
||||
input: {
|
||||
// 本地开发:使用下载的规范文件(运行 npm run api:fetch 更新)
|
||||
// 本地开发:使用下载的规范文件(运行 npm run api:update 更新)
|
||||
// 服务器直连时改为:'http://8.148.151.56:3002/v3/api-docs'
|
||||
target: './api-spec.json',
|
||||
target: './api-spec.yml',
|
||||
},
|
||||
output: {
|
||||
// 自动生成到这个目录,不要手动修改这里的文件
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"build": "vue-tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
||||
"api:fetch": "curl -s http://8.148.151.56:3002/v3/api-docs -o api-spec.json && echo API spec updated",
|
||||
"api:fetch": "curl -s http://8.148.151.56:3002/v3/api-docs -o api-spec.json && node -e \"const fs=require('fs'),yaml=require('js-yaml'),d=JSON.parse(fs.readFileSync('api-spec.json','utf-8'));fs.writeFileSync('api-spec.yml',yaml.dump(d,{lineWidth:120,noRefs:true}));fs.unlinkSync('api-spec.json');console.log('api-spec.yml updated')\"",
|
||||
"api:gen": "orval --config orval.config.ts",
|
||||
"api:update": "npm run api:fetch && npm run api:gen"
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user