Skip to content

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

refactor(api): move zod schema to features/public-api (#493)

Marc Klingen08e42a6174de
diff --git a/src/pages/api/public/ingestion-api-schema.ts b/src/features/public-api/server/ingestion-api-schema.ts
similarity index 100%
rename from src/pages/api/public/ingestion-api-schema.ts
rename to src/features/public-api/server/ingestion-api-schema.ts
diff --git a/src/pages/api/public/events.ts b/src/pages/api/public/events.ts
index 961808ffd0..01c54df463 100644
--- a/src/pages/api/public/events.ts
+++ b/src/pages/api/public/events.ts
@@ -6,7 +6,7 @@ import {
EventSchema,
eventTypes,
ingestionBatch,
-} from "./ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import {
handleBatch,
handleBatchResultLegacy,
diff --git a/src/pages/api/public/generations.ts b/src/pages/api/public/generations.ts
index 9079172417..46251fc830 100644
--- a/src/pages/api/public/generations.ts
+++ b/src/pages/api/public/generations.ts
@@ -8,7 +8,7 @@ import {
GenerationsCreateSchema,
eventTypes,
ingestionBatch,
-} from "./ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import {
handleBatch,
handleBatchResultLegacy,
diff --git a/src/pages/api/public/ingestion.ts b/src/pages/api/public/ingestion.ts
index 60f56b0577..029465e9c5 100644
--- a/src/pages/api/public/ingestion.ts
+++ b/src/pages/api/public/ingestion.ts
@@ -10,7 +10,7 @@ import {
type ingestionApiSchema,
eventTypes,
singleEventSchema,
-} from "./ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import { type ApiAccessScope } from "@/src/features/public-api/server/types";
import { persistEventMiddleware } from "@/src/server/api/services/event-service";
import { backOff } from "exponential-backoff";
diff --git a/src/pages/api/public/scores.ts b/src/pages/api/public/scores.ts
index 7b95576616..322f0112f2 100644
--- a/src/pages/api/public/scores.ts
+++ b/src/pages/api/public/scores.ts
@@ -9,7 +9,7 @@ import {
ScoreSchema,
eventTypes,
ingestionBatch,
-} from "@/src/pages/api/public/ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import { v4 } from "uuid";
import {
handleBatch,
diff --git a/src/pages/api/public/spans.ts b/src/pages/api/public/spans.ts
index 13605b541e..c638bec939 100644
--- a/src/pages/api/public/spans.ts
+++ b/src/pages/api/public/spans.ts
@@ -8,7 +8,7 @@ import {
SpanPostSchema,
eventTypes,
ingestionBatch,
-} from "./ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import {
handleBatch,
handleBatchResultLegacy,
diff --git a/src/pages/api/public/traces.ts b/src/pages/api/public/traces.ts
index f7a359fbf2..d8b1da7df8 100644
--- a/src/pages/api/public/traces.ts
+++ b/src/pages/api/public/traces.ts
@@ -12,7 +12,7 @@ import {
import {
TraceSchema,
eventTypes,
-} from "@/src/pages/api/public/ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import { v4 } from "uuid";
const GetTracesSchema = z.object({
diff --git a/src/server/api/services/EventProcessor.ts b/src/server/api/services/EventProcessor.ts
index b975ef9a96..7fcc4957ab 100644
--- a/src/server/api/services/EventProcessor.ts
+++ b/src/server/api/services/EventProcessor.ts
@@ -8,7 +8,7 @@ import {
type traceEvent,
type scoreEvent,
type observationUpdateEvent,
-} from "@/src/pages/api/public/ingestion-api-schema";
+} from "@/src/features/public-api/server/ingestion-api-schema";
import { prisma } from "@/src/server/db";
import { ResourceNotFoundError } from "@/src/utils/exceptions";
import { mergeJson } from "@/src/utils/json";