/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type TextFieldConfig = { /** * Maximum character length constraint for the input. */ maxLength?: number | undefined; /** * Minimum character length requirement for the input. */ minLength?: number | undefined; }; /** @internal */ export const TextFieldConfig$inboundSchema: z.ZodType< TextFieldConfig, z.ZodTypeDef, unknown > = z.object({ max_length: z.number().optional(), min_length: z.number().optional(), }).transform((v) => { return remap$(v, { "max_length": "maxLength", "min_length": "minLength", }); }); /** @internal */ export type TextFieldConfig$Outbound = { max_length?: number | undefined; min_length?: number | undefined; }; /** @internal */ export const TextFieldConfig$outboundSchema: z.ZodType< TextFieldConfig$Outbound, z.ZodTypeDef, TextFieldConfig > = z.object({ maxLength: z.number().optional(), minLength: z.number().optional(), }).transform((v) => { return remap$(v, { maxLength: "max_length", minLength: "min_length", }); }); export function textFieldConfigToJSON( textFieldConfig: TextFieldConfig, ): string { return JSON.stringify(TextFieldConfig$outboundSchema.parse(textFieldConfig)); } export function textFieldConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TextFieldConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TextFieldConfig' from JSON`, ); }