Bugfix/JSON5 Parsing (#5201)

use json5 for parsing input data
This commit is contained in:
Henry Heng
2025-09-12 17:27:03 +01:00
committed by GitHub
parent e002e617df
commit 4af067a444
12 changed files with 32 additions and 43 deletions
@@ -1,6 +1,7 @@
import { z } from 'zod'
import { DynamicStructuredTool } from '../OpenAPIToolkit/core'
import { secureFetch } from '../../../src/httpSecurity'
import JSON5 from 'json5'
export const desc = `Use this when you want to execute a POST request to create or update a resource.`
@@ -27,7 +28,7 @@ const createRequestsPostSchema = (bodySchema?: string) => {
// If bodySchema is provided, parse it and add dynamic body params
if (bodySchema) {
try {
const parsedSchema = JSON.parse(bodySchema)
const parsedSchema = JSON5.parse(bodySchema)
const bodyParamsObject: Record<string, z.ZodTypeAny> = {}
Object.entries(parsedSchema).forEach(([key, config]: [string, any]) => {