From 9f541ff3c9f4e23a8e4bf42ed5c88e3edee9b4ec Mon Sep 17 00:00:00 2001 From: Daniel Trowbridge Date: Fri, 24 Jan 2025 12:26:47 +0000 Subject: [PATCH 1/3] feat: allow arbitrary answer and response types --- src/schema.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schema.ts b/src/schema.ts index b4234a7..7e00831 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -2,8 +2,8 @@ import { z } from 'zod' export const EvaluationFunctionRequestData = z .object({ - answer: z.string(), - response: z.string(), + answer: z.any(), + response: z.any(), params: z.record(z.string(), z.any()), }) .strict() From 721ca07848de6f7a6e9a26545a06e16d7d647ca6 Mon Sep 17 00:00:00 2001 From: Daniel Trowbridge Date: Fri, 24 Jan 2025 12:27:16 +0000 Subject: [PATCH 2/3] chore: minor bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5822de..7564fdb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lambda-feedback-segp-sandbox/ef-test-server", - "version": "0.4.0", + "version": "0.5.0", "main": "dist/index.js", "scripts": { "build": "yarn tsc", From 19fe031096b02e426a2b2c72d03b4adb35e72bec Mon Sep 17 00:00:00 2001 From: Daniel Trowbridge Date: Fri, 24 Jan 2025 12:35:20 +0000 Subject: [PATCH 3/3] fix: reject null and undefined as answer and response values --- src/schema.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/schema.ts b/src/schema.ts index 7e00831..eaf1126 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -2,8 +2,12 @@ import { z } from 'zod' export const EvaluationFunctionRequestData = z .object({ - answer: z.any(), - response: z.any(), + answer: z.union([z.string(), z.array(z.any()), z.object({}).passthrough()]), + response: z.union([ + z.string(), + z.array(z.any()), + z.object({}).passthrough(), + ]), params: z.record(z.string(), z.any()), }) .strict()