chore: moving towards agentic development
This commit is contained in:
19
frontend/scripts/fetch-openapi.mjs
Normal file
19
frontend/scripts/fetch-openapi.mjs
Normal file
@@ -0,0 +1,19 @@
|
||||
import { mkdir, writeFile } from 'node:fs/promises';
|
||||
|
||||
const url = process.env.OPENAPI_URL ?? 'http://localhost:5080/swagger/v1/swagger.json';
|
||||
const output = new URL('../../shared/openapi/openapi.json', import.meta.url);
|
||||
|
||||
console.log(`Fetching OpenAPI schema from ${url}`);
|
||||
|
||||
const response = await fetch(url);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch OpenAPI schema: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
|
||||
const schema = await response.text();
|
||||
|
||||
await mkdir(new URL('../../shared/openapi', import.meta.url), { recursive: true });
|
||||
await writeFile(output, schema);
|
||||
|
||||
console.log(`Wrote ${output.pathname}`);
|
||||
Reference in New Issue
Block a user