/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; 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"; import { Cpe, Cpe$inboundSchema } from "./cpe.js"; import { CPELifeCycle, CPELifeCycle$inboundSchema } from "./cpelifecycle.js"; import { Evidence, Evidence$inboundSchema } from "./evidence.js"; export const Source = { Unknown: "", Censys: "censys", Recog: "recog", Wappalyzer: "wappalyzer", ThirdParty: "third_party", HtmlMetaExtractor: "html_meta_extractor", } as const; export type Source = OpenEnum; export type Attribute = { components?: Array | null | undefined; confidence?: number | undefined; cpe?: string | undefined; edition?: string | undefined; evidence?: Array | null | undefined; lifeCycle?: CPELifeCycle | undefined; part?: string | undefined; product?: string | undefined; source?: Source | undefined; type?: Array | null | undefined; update?: string | undefined; vendor?: string | undefined; version?: string | undefined; }; /** @internal */ export const Source$inboundSchema: z.ZodType = openEnums.inboundSchema(Source); /** @internal */ export const Attribute$inboundSchema: z.ZodType< Attribute, z.ZodTypeDef, unknown > = z.object({ components: z.nullable(z.array(Cpe$inboundSchema)).optional(), confidence: z.number().optional(), cpe: z.string().optional(), edition: z.string().optional(), evidence: z.nullable(z.array(Evidence$inboundSchema)).optional(), life_cycle: CPELifeCycle$inboundSchema.optional(), part: z.string().optional(), product: z.string().optional(), source: Source$inboundSchema.optional(), type: z.nullable(z.array(z.string())).optional(), update: z.string().optional(), vendor: z.string().optional(), version: z.string().optional(), }).transform((v) => { return remap$(v, { "life_cycle": "lifeCycle", }); }); export function attributeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Attribute$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Attribute' from JSON`, ); }