/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smart-union.js"; import { ErrorEnvelope, ErrorEnvelope$inboundSchema, } from "./error-envelope.js"; import { LegacyError, LegacyError$inboundSchema } from "./legacy-error.js"; import { SDKValidationError } from "./sdk-validation-error.js"; /** * Compose error response. */ export type ErrorResponse = ErrorEnvelope | LegacyError; /** @internal */ export const ErrorResponse$inboundSchema: z.ZodMiniType< ErrorResponse, unknown > = smartUnion([ErrorEnvelope$inboundSchema, LegacyError$inboundSchema]); export function errorResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ErrorResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ErrorResponse' from JSON`, ); }