Add OpenAPI TypeScript config and update dependencies
Introduced `openapi-ts.config.ts` to generate client code from the OpenAPI spec. Updated several dependencies to enable OpenAPI integration, including `@hey-api` plugins, `axios`, and `@tanstack/react-query`. These changes set up the project for streamlined API access using autogenerated TypeScript clients.
This commit is contained in:
28
frontend/openapi-ts.config.ts
Normal file
28
frontend/openapi-ts.config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {defineConfig} from '@hey-api/openapi-ts';
|
||||
import path from "path";
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_BACKEND_API_URL || 'http://localhost:8000';
|
||||
const OPENAPI_URL = `${API_URL}/api/v1/openapi.json`;
|
||||
const OUTPUT_DIR = path.resolve(__dirname, './src/client');
|
||||
// const OPENAPI_FILE = path.resolve(__dirname, './openapi.json');
|
||||
|
||||
|
||||
export default defineConfig({
|
||||
input:
|
||||
OPENAPI_URL,
|
||||
output: {
|
||||
format: 'prettier',
|
||||
lint: 'eslint',
|
||||
path: OUTPUT_DIR,
|
||||
},
|
||||
plugins: [
|
||||
'@hey-api/client-axios',
|
||||
'@hey-api/schemas',
|
||||
'@hey-api/sdk',
|
||||
{
|
||||
enums: 'javascript',
|
||||
name: '@hey-api/typescript',
|
||||
},
|
||||
'@tanstack/react-query',
|
||||
],
|
||||
});
|
||||
771
frontend/package-lock.json
generated
771
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,23 +8,30 @@
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"docker:build": "docker build -t eventspace-frontend .",
|
||||
"docker:run": "docker run -p 3000:3000 eventspace-frontend"
|
||||
|
||||
"docker:run": "docker run -p 3000:3000 eventspace-frontend",
|
||||
"openapi-ts": "openapi-ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hey-api/client-axios": "^0.6.2",
|
||||
"@hey-api/client-fetch": "^0.8.3",
|
||||
"@tanstack/react-query": "^5.67.1",
|
||||
"axios": "^1.8.1",
|
||||
"jwt-decode": "^4.0.0",
|
||||
"next": "15.2.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"next": "15.2.0"
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5",
|
||||
"@types/node": "^20",
|
||||
"@eslint/eslintrc": "^3",
|
||||
"@hey-api/openapi-ts": "^0.64.10",
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"@types/node": "^20.17.23",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@tailwindcss/postcss": "^4",
|
||||
"tailwindcss": "^4",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.2.0",
|
||||
"@eslint/eslintrc": "^3"
|
||||
"openapi-typescript-codegen": "^0.29.0",
|
||||
"tailwindcss": "^4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user