/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c8b591f780da */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of the warning. */ export const WarningType = { LongQuery: "LONG_QUERY", QuotedPunctuation: "QUOTED_PUNCTUATION", PunctuationOnly: "PUNCTUATION_ONLY", CopypastedQuotes: "COPYPASTED_QUOTES", InvalidOperator: "INVALID_OPERATOR", MaybeInvalidFacetQuery: "MAYBE_INVALID_FACET_QUERY", TooManyDatasourceGroups: "TOO_MANY_DATASOURCE_GROUPS", } as const; /** * The type of the warning. */ export type WarningType = OpenEnum; export type SearchWarning = { /** * The type of the warning. */ warningType: WarningType; /** * The last term we considered in the user's long query. */ lastUsedTerm?: string | undefined; /** * The query after ignoring/removing quotes. */ quotesIgnoredQuery?: string | undefined; /** * A list of query terms that were ignored when generating search results, if any. For example, terms containing invalid filters such as "updated:invalid_date" will be ignored. */ ignoredTerms?: Array | undefined; }; /** @internal */ export const WarningType$inboundSchema: z.ZodType< WarningType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(WarningType); /** @internal */ export const SearchWarning$inboundSchema: z.ZodType< SearchWarning, z.ZodTypeDef, unknown > = z.object({ warningType: WarningType$inboundSchema, lastUsedTerm: z.string().optional(), quotesIgnoredQuery: z.string().optional(), ignoredTerms: z.array(z.string()).optional(), }); export function searchWarningFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SearchWarning$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SearchWarning' from JSON`, ); }