import type { Schema } from './base.ts'; /** * JSON Schema object representation. * Subset of JSON Schema Draft 7 specification. */ export interface JSONSchema { type?: 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null'; description?: string; const?: string | number | boolean; enum?: Array; properties?: Record; required?: string[]; items?: JSONSchema; anyOf?: JSONSchema[]; oneOf?: JSONSchema[]; allOf?: JSONSchema[]; additionalProperties?: JSONSchema | boolean; } /** * Options for toJSONSchema conversion. */ export interface ToJSONSchemaOptions { /** * When true, adds `additionalProperties: false` to all object schemas. * Required for LLM structured output compatibility (OpenAI, Groq, etc.). * @default false */ strict?: boolean; } /** * Convert a schema to JSON Schema format. * Supports primitives, objects, arrays, unions, literals, optional, and nullable types. * * @param schema - The schema to convert * @param options - Conversion options * @returns JSON Schema object * * @example * ```typescript * const userSchema = s.object({ * name: s.string().describe('User name'), * age: s.number().describe('User age') * }); * * const jsonSchema = s.toJSONSchema(userSchema); * // { type: 'object', properties: {...}, required: [...] } * * // For LLM structured output compatibility (OpenAI, Groq, etc.): * const strictSchema = s.toJSONSchema(userSchema, { strict: true }); * // { type: 'object', properties: {...}, required: [...], additionalProperties: false } * ``` */ export declare function toJSONSchema(schema: Schema, options?: ToJSONSchemaOptions): JSONSchema; /** * Convert a JSON Schema object to a schema. * Supports round-trip conversion with toJSONSchema. * * @param jsonSchema - The JSON Schema object to convert * @returns Schema instance * * @example * ```typescript * const jsonSchema = { * type: 'object', * properties: { * name: { type: 'string' }, * age: { type: 'number' } * }, * required: ['name', 'age'] * }; * * const schema = s.fromJSONSchema(jsonSchema); * const user = schema.parse({ name: 'John', age: 30 }); * ``` */ export declare function fromJSONSchema(jsonSchema: JSONSchema): Schema; //# sourceMappingURL=json-schema.d.ts.map