Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"next": "16.2.11",
"react": "^19.0.0",
"react-dom": "^19.2.6",
"zod": "^3.25.76"
"zod": "^4.6.6"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/SpecEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function validate(raw: string): string | null {
}
const result = OperationSchema.safeParse(parsed)
if (!result.success) {
const first = result.error.errors[0]
const first = result.error.issues[0]
return `${first.path.join('.') || 'root'}: ${first.message}`
}
return null
Expand Down
2 changes: 1 addition & 1 deletion apps/evals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@types/node": "^22.0.0",
"promptfoo": "^0.121.19",
"promptfoo": "^0.125.1",
"tsx": "^4.22.3",
"typescript": "^5"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@libsql/client": "^0.17.3",
"ai": "^6.0.185",
"drizzle-orm": "^0.45.2",
"zod": "^3.25.76"
"zod": "^4.6.6"
},
"devDependencies": {
"postgres": "^3.4.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/spec/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export async function buildOperation(

// We generate via plain text + JSON parsing rather than the AI SDK's
// structured-output mode: OpenAPI schema objects are open-ended JSON Schema
// (z.record(z.any())), which strict structured-output APIs (OpenAI strict,
// (z.record(z.string(), z.any())), which strict structured-output APIs (OpenAI strict,
// Anthropic's native structured outputs) reject. Freeform text works on every
// provider; we validate the result against OperationSchema ourselves and retry.
const system = [
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/spec/schema.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { z } from 'zod'

const SchemaObject = z.record(z.any()).optional()
const SchemaObject = z.record(z.string(), z.any()).optional()

const MediaTypeSchema = z.object({
schema: SchemaObject,
example: z.any().optional(),
examples: z.record(z.any()).optional(),
examples: z.record(z.string(), z.any()).optional(),
})

const ParameterSchema = z.object({
Expand All @@ -20,8 +20,8 @@ const ParameterSchema = z.object({

const ResponseSchema = z.object({
description: z.string(),
headers: z.record(z.any()).optional(),
content: z.record(MediaTypeSchema).optional(),
headers: z.record(z.string(), z.any()).optional(),
content: z.record(z.string(), MediaTypeSchema).optional(),
})

export const OperationSchema = z.object({
Expand All @@ -34,13 +34,13 @@ export const OperationSchema = z.object({
.object({
description: z.string().optional(),
required: z.boolean().optional(),
content: z.record(MediaTypeSchema),
content: z.record(z.string(), MediaTypeSchema),
})
.nullable()
.optional(),
responses: z.record(ResponseSchema).default({}),
responses: z.record(z.string(), ResponseSchema).default({}),
deprecated: z.boolean().optional(),
security: z.array(z.record(z.array(z.string()))).optional(),
security: z.array(z.record(z.string(), z.array(z.string()))).optional(),
})

export type Operation = z.infer<typeof OperationSchema>
Expand Down
Loading
Loading