/* * 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"; import { GrammarFormat, GrammarFormat$inboundSchema, GrammarFormat$Outbound, GrammarFormat$outboundSchema, } from "./grammarformat.js"; import { TextFormat, TextFormat$inboundSchema, TextFormat$Outbound, TextFormat$outboundSchema, } from "./textformat.js"; export type CustomToolFormat = TextFormat | GrammarFormat; /** @internal */ export const CustomToolFormat$inboundSchema: z.ZodType< CustomToolFormat, z.ZodTypeDef, unknown > = z.union([TextFormat$inboundSchema, GrammarFormat$inboundSchema]); /** @internal */ export type CustomToolFormat$Outbound = | TextFormat$Outbound | GrammarFormat$Outbound; /** @internal */ export const CustomToolFormat$outboundSchema: z.ZodType< CustomToolFormat$Outbound, z.ZodTypeDef, CustomToolFormat > = z.union([TextFormat$outboundSchema, GrammarFormat$outboundSchema]); export function customToolFormatToJSON( customToolFormat: CustomToolFormat, ): string { return JSON.stringify( CustomToolFormat$outboundSchema.parse(customToolFormat), ); } export function customToolFormatFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomToolFormat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomToolFormat' from JSON`, ); }