/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 42dd07b5ef18 */ 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 CodeLine = { lineNumber?: number | undefined; content?: string | undefined; /** * Index ranges depicting matched sections of the line */ ranges?: Array | undefined; }; /** @internal */ export const CodeLine$inboundSchema: z.ZodType< CodeLine, z.ZodTypeDef, unknown > = z.object({ lineNumber: z.number().int().optional(), content: z.string().optional(), ranges: z.array(z.lazy(() => TextRange$inboundSchema)).optional(), }); /** @internal */ export type CodeLine$Outbound = { lineNumber?: number | undefined; content?: string | undefined; ranges?: Array | undefined; }; /** @internal */ export const CodeLine$outboundSchema: z.ZodType< CodeLine$Outbound, z.ZodTypeDef, CodeLine > = z.object({ lineNumber: z.number().int().optional(), content: z.string().optional(), ranges: z.array(z.lazy(() => TextRange$outboundSchema)).optional(), }); export function codeLineToJSON(codeLine: CodeLine): string { return JSON.stringify(CodeLine$outboundSchema.parse(codeLine)); } export function codeLineFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CodeLine$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CodeLine' from JSON`, ); }