/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: dc7d8977211f */ 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 { TextRange, TextRange$inboundSchema, TextRange$Outbound, TextRange$outboundSchema, } from "./textrange.js"; export type RelatedQuestion = { /** * The text of the related question */ question?: string | undefined; /** * The answer for the related question */ answer?: string | undefined; /** * Subsections of the answer string to which some special formatting should be applied (eg. bold) */ ranges?: Array | undefined; }; /** @internal */ export const RelatedQuestion$inboundSchema: z.ZodType< RelatedQuestion, z.ZodTypeDef, unknown > = z.object({ question: z.string().optional(), answer: z.string().optional(), ranges: z.array(z.lazy(() => TextRange$inboundSchema)).optional(), }); /** @internal */ export type RelatedQuestion$Outbound = { question?: string | undefined; answer?: string | undefined; ranges?: Array | undefined; }; /** @internal */ export const RelatedQuestion$outboundSchema: z.ZodType< RelatedQuestion$Outbound, z.ZodTypeDef, RelatedQuestion > = z.object({ question: z.string().optional(), answer: z.string().optional(), ranges: z.array(z.lazy(() => TextRange$outboundSchema)).optional(), }); export function relatedQuestionToJSON( relatedQuestion: RelatedQuestion, ): string { return JSON.stringify(RelatedQuestion$outboundSchema.parse(relatedQuestion)); } export function relatedQuestionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RelatedQuestion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RelatedQuestion' from JSON`, ); }