File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,24 +10,40 @@ jobs:
1010 web :
1111 name : Web
1212 runs-on : ubuntu-latest
13- defaults :
14- run :
15- working-directory : apps/web
1613
1714 steps :
1815 - uses : actions/checkout@v4
1916
17+ - uses : astral-sh/setup-uv@v5
18+ with :
19+ enable-cache : true
20+ cache-dependency-glob : apps/api/uv.lock
21+
22+ - name : Export OpenAPI schema
23+ working-directory : apps/api
24+ run : uv sync --frozen && uv run python export_schema.py
25+
2026 - uses : actions/setup-node@v4
2127 with :
2228 node-version : 22
2329 cache : npm
2430 cache-dependency-path : apps/web/package-lock.json
2531
26- - run : npm ci
32+ - name : Install dependencies
33+ working-directory : apps/web
34+ run : npm ci
2735
28- - run : npm run lint
36+ - name : Generate API client
37+ working-directory : apps/web
38+ run : npm run codegen
2939
30- - run : npm run build
40+ - name : Lint
41+ working-directory : apps/web
42+ run : npm run lint
43+
44+ - name : Build
45+ working-directory : apps/web
46+ run : npm run build
3147
3248 api :
3349 name : API
Original file line number Diff line number Diff line change 1+ """Export the OpenAPI schema to a JSON file for client codegen."""
2+
3+ import json
4+ from pathlib import Path
5+
6+ from main import app
7+
8+ schema = app .openapi ()
9+ out = Path (__file__ ).resolve ().parent .parent .parent / "docs" / "schema" / "openapi.json"
10+ out .parent .mkdir (parents = True , exist_ok = True )
11+ out .write_text (json .dumps (schema , indent = 2 ) + "\n " )
12+ print (f"Schema written to { out } " )
Original file line number Diff line number Diff line change @@ -39,3 +39,6 @@ yarn-error.log*
3939# typescript
4040* .tsbuildinfo
4141next-env.d.ts
42+
43+ # generated api client
44+ /src /api
Original file line number Diff line number Diff line change 1+ import { defineConfig } from "@hey-api/openapi-ts" ;
2+
3+ export default defineConfig ( {
4+ input : "../../docs/schema/openapi.json" ,
5+ output : {
6+ path : "src/api" ,
7+ format : "prettier" ,
8+ } ,
9+ plugins : [ "@hey-api/client-fetch" ] ,
10+ } ) ;
You can’t perform that action at this time.
0 commit comments