/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type JSONSchemaResponseFormat = { type: "json_schema"; name: string; schema: { [k: string]: any }; description?: string | undefined; strict?: boolean | undefined; }; /** @internal */ export const JSONSchemaResponseFormat$inboundSchema: z.ZodType< JSONSchemaResponseFormat, z.ZodTypeDef, unknown > = z.object({ type: z.literal("json_schema"), name: z.string(), schema: z.record(z.any()), description: z.string().optional(), strict: z.boolean().default(false), }); /** @internal */ export type JSONSchemaResponseFormat$Outbound = { type: "json_schema"; name: string; schema: { [k: string]: any }; description?: string | undefined; strict: boolean; }; /** @internal */ export const JSONSchemaResponseFormat$outboundSchema: z.ZodType< JSONSchemaResponseFormat$Outbound, z.ZodTypeDef, JSONSchemaResponseFormat > = z.object({ type: z.literal("json_schema"), name: z.string(), schema: z.record(z.any()), description: z.string().optional(), strict: z.boolean().default(false), }); export function jsonSchemaResponseFormatToJSON( jsonSchemaResponseFormat: JSONSchemaResponseFormat, ): string { return JSON.stringify( JSONSchemaResponseFormat$outboundSchema.parse(jsonSchemaResponseFormat), ); } export function jsonSchemaResponseFormatFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => JSONSchemaResponseFormat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'JSONSchemaResponseFormat' from JSON`, ); }