import { SchemaModelType } from "./SchemaModelType.js"; import * as z$1 from "zod"; //#region src/JsonSchemaType.d.ts /** * JSON Schema definition structure. * Supports standard JSON Schema draft-07/2020-12 properties. */ interface JsonSchemaDefinition { type?: string | string[]; properties?: Record; required?: string[]; additionalProperties?: boolean | JsonSchemaDefinition; items?: JsonSchemaDefinition | JsonSchemaDefinition[]; enum?: unknown[]; const?: unknown; oneOf?: JsonSchemaDefinition[]; anyOf?: JsonSchemaDefinition[]; allOf?: JsonSchemaDefinition[]; $ref?: string; title?: string; description?: string; default?: unknown; format?: string; minimum?: number; maximum?: number; minLength?: number; maxLength?: number; pattern?: string; [key: string]: unknown; } /** * Options for JsonSchemaType wrapper. */ interface JsonSchemaTypeOptions { /** Name for identification */ name?: string; } /** * Wrapper to use JSON Schema as a SchemaType. * Converts to Zod at runtime for validation. * * @example * ```typescript * const CustomFieldsSchema = fromJsonSchema({ * type: 'object', * additionalProperties: { * oneOf: [ * { type: 'string' }, * { type: 'number' }, * { type: 'boolean' }, * ], * }, * }, { name: 'CustomFields' }); * ``` */ declare class JsonSchemaType implements SchemaModelType> { private readonly jsonSchema; private readonly options; constructor(jsonSchema: JsonSchemaDefinition, options?: JsonSchemaTypeOptions); /** * Convert JSON Schema to Zod schema for runtime validation. * * Note: This is a simplified conversion. For complex schemas, * consider using a dedicated json-schema-to-zod library. */ getZod(): z$1.ZodType>; /** * Return the original JSON Schema. */ getJsonSchema(): JsonSchemaDefinition; /** * Return GraphQL type info. * JSON Schema types map to JSON scalar in GraphQL. */ getPothos(): { type: string; name?: string; }; /** * Get the configured name for this schema. */ getName(): string | undefined; /** * Convert a single JSON Schema property to Zod. */ private convertPropertyToZod; } /** * Helper to create a SchemaType from JSON Schema. * * @param schema - The JSON Schema definition * @param options - Optional configuration * @returns A SchemaType-compatible wrapper * * @example * ```typescript * const MetadataSchema = fromJsonSchema({ * type: 'object', * properties: { * createdAt: { type: 'string', format: 'date-time' }, * updatedAt: { type: 'string', format: 'date-time' }, * }, * required: ['createdAt'], * }); * ``` */ declare const fromJsonSchema: (schema: JsonSchemaDefinition, options?: JsonSchemaTypeOptions) => JsonSchemaType; //#endregion export { JsonSchemaDefinition, JsonSchemaType, JsonSchemaTypeOptions, fromJsonSchema }; //# sourceMappingURL=JsonSchemaType.d.ts.map