/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type FeatureNode = { label: string; attribute?: string | null | undefined; value?: string | null | undefined; children?: Array | null | undefined; }; /** @internal */ export const FeatureNode$inboundSchema: z.ZodType< FeatureNode, z.ZodTypeDef, unknown > = z.object({ label: z.string(), attribute: z.nullable(z.string()).optional(), value: z.nullable(z.string()).optional(), children: z.nullable(z.array(z.lazy(() => FeatureNode$inboundSchema))) .optional(), }); /** @internal */ export type FeatureNode$Outbound = { label: string; attribute?: string | null | undefined; value?: string | null | undefined; children?: Array | null | undefined; }; /** @internal */ export const FeatureNode$outboundSchema: z.ZodType< FeatureNode$Outbound, z.ZodTypeDef, FeatureNode > = z.object({ label: z.string(), attribute: z.nullable(z.string()).optional(), value: z.nullable(z.string()).optional(), children: z.nullable(z.array(z.lazy(() => FeatureNode$outboundSchema))) .optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FeatureNode$ { /** @deprecated use `FeatureNode$inboundSchema` instead. */ export const inboundSchema = FeatureNode$inboundSchema; /** @deprecated use `FeatureNode$outboundSchema` instead. */ export const outboundSchema = FeatureNode$outboundSchema; /** @deprecated use `FeatureNode$Outbound` instead. */ export type Outbound = FeatureNode$Outbound; } export function featureNodeToJSON(featureNode: FeatureNode): string { return JSON.stringify(FeatureNode$outboundSchema.parse(featureNode)); } export function featureNodeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeatureNode$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeatureNode' from JSON`, ); }