/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: db2bfcd6fdcd
 */

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type StreamError = {
  error: string;
};

/** @internal */
export const StreamError$inboundSchema: z.ZodType<StreamError, unknown> = z
  .object({
    error: z.string(),
  });

export function streamErrorFromJSON(
  jsonString: string,
): SafeParseResult<StreamError, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => StreamError$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'StreamError' from JSON`,
  );
}
