import { G as JsonSchemaType, a as JsonSchema } from "./types-DYeD9SJD.cjs"; //#region src/codegen.d.ts /** * Stringifies a value for generated TypeScript code. */ declare function stringifyValue(value?: unknown, type?: JsonSchemaType | string): string; /** * Stringifies a JSON Schema fragment into a TypeScript-like type string. */ declare function stringifyType(schema?: JsonSchema): string; /** * Returns a string type representation of a value based on its type and an optional JSON Schema primitive type hint. * * @param value - The value whose type is to be represented as a string. * @returns A string representation of the value's type, which may be influenced by the provided JSON Schema primitive type hint. The function handles various JavaScript types and formats them accordingly, including special handling for `undefined`, `null`, booleans, numbers (with formatting), strings, objects, and arrays. If a specific type hint is provided, it will take precedence in determining the string representation of the value. */ declare function getJsonSchemaType(value?: unknown): JsonSchemaType | undefined; interface GenerateParserCodeOptions { /** * The name of the parser function to generate. * * @defaultValue "parse" */ name?: string; /** * Whether to ignore `default` values in the schema when generating the parser code. By default, the generated code will apply default values for missing properties and root/array values. Set this option to `true` to disable default value application, causing the generated parser to treat missing values as validation errors instead. */ ignoreDefaults?: boolean; } /** * Generates standalone parser code for a JSON Schema. * * @remarks * The generated `parse` function reads an arbitrary input value and converts it into the shape described by the schema. It walks the schema recursively to: * - Resolve local `$ref` pointers (`#/$defs/*` and `#/definitions/*`) into dedicated parser functions so recursive schemas are supported, * - If {@link GenerateParserCodeOptions.ignoreDefaults | options.ignoreDefaults} is not `true`, apply `default` values for object properties (and root/array values) that are missing from the input, * - Coerce primitive values to the declared type (for example `"42"` to `42` for an `integer` schema, or `1` to `true` for a `boolean` schema), * - Validate `const`, `enum`, `oneOf`/`anyOf` and `allOf` constraints, and * - Collect detailed, path-aware errors and throw a `Error` when the input cannot be converted into a valid value. * * @param schema - The JSON Schema to generate parser code for. * @param options - Options to customize the generated code. By default, the generated code will apply default values from the schema for missing properties and root/array values. Set `options.ignoreDefaults` to `true` to disable default value application. * @returns The generated standalone parser code as a string. */ declare function generateParserCode(schema: JsonSchema, options?: GenerateParserCodeOptions): string; //#endregion export { GenerateParserCodeOptions, generateParserCode, getJsonSchemaType, stringifyType, stringifyValue }; //# sourceMappingURL=codegen.d.cts.map