Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

swagger

Max Deichmann6b1cbb29a9c5
diff --git a/package-lock.json b/package-lock.json
index def0b0c770..08ac939a34 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,9 +28,11 @@
"@trpc/react-query": "^10.27.1",
"@trpc/server": "^10.27.1",
"@types/cors": "^2.8.13",
+ "@types/js-yaml": "^4.0.5",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"cors": "^2.8.5",
+ "js-yaml": "^4.1.0",
"lucide-react": "^0.220.0",
"next": "^13.4.3",
"next-auth": "^4.22.1",
@@ -2018,6 +2020,11 @@
"hoist-non-react-statics": "^3.3.0"
}
},
+ "node_modules/@types/js-yaml": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
+ "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA=="
+ },
"node_modules/@types/json-schema": {
"version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
diff --git a/package.json b/package.json
index 8b37d5e1df..82552bcb63 100644
--- a/package.json
+++ b/package.json
@@ -32,9 +32,11 @@
"@trpc/react-query": "^10.27.1",
"@trpc/server": "^10.27.1",
"@types/cors": "^2.8.13",
+ "@types/js-yaml": "^4.0.5",
"class-variance-authority": "^0.6.0",
"clsx": "^1.2.1",
"cors": "^2.8.5",
+ "js-yaml": "^4.1.0",
"lucide-react": "^0.220.0",
"next": "^13.4.3",
"next-auth": "^4.22.1",
diff --git a/src/pages/api-doc.tsx b/src/pages/api-doc.tsx
index 383ea5d56d..c77d851b9f 100644
--- a/src/pages/api-doc.tsx
+++ b/src/pages/api-doc.tsx
@@ -1,7 +1,8 @@
import { type GetStaticProps, type InferGetStaticPropsType } from "next";
-import { createSwaggerSpec } from "next-swagger-doc";
import dynamic from "next/dynamic";
import "swagger-ui-react/swagger-ui.css";
+import fs from "fs";
+import yaml from "js-yaml";
const SwaggerUI = dynamic<{
spec: any;
@@ -12,16 +13,8 @@ function ApiDoc({ spec }: InferGetStaticPropsType<typeof getStaticProps>) {
}
export const getStaticProps: GetStaticProps = async () => {
- const spec: Record<string, any> = createSwaggerSpec({
- definition: {
- openapi: "3.0.0",
- info: {
- title: "Langfuse API",
- version: "1.0",
- },
- },
- apiFolder: "src/pages/api",
- });
+ const file = fs.readFileSync("./generated/openapi/openapi.yml", "utf8");
+ const spec = yaml.load(file);
return {
props: {