/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 09019ad45aa7 */ 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 { FacetValue, FacetValue$inboundSchema } from "./facetvalue.js"; export type FacetBucket = { /** * Estimated number of results in this facet. */ count?: number | undefined; /** * The datasource the value belongs to. This will be used by the all tab to show types across all datasources. */ datasource?: string | undefined; /** * Estimated percentage of results in this facet. */ percentage?: number | undefined; value?: FacetValue | undefined; }; /** @internal */ export const FacetBucket$inboundSchema: z.ZodType< FacetBucket, z.ZodTypeDef, unknown > = z.object({ count: z.number().int().optional(), datasource: z.string().optional(), percentage: z.number().int().optional(), value: FacetValue$inboundSchema.optional(), }); export function facetBucketFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FacetBucket$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FacetBucket' from JSON`, ); }