import type { JsonAnnotations, JsonAnyInstance, JsonObjectInstance, JsonSchema, JsonSchema7TypeName } from '../../../json.js'; import { type Node } from '../../cst/node.js'; import type { SchemaOptions } from '../base.js'; import { NullableType } from '../nullable/nullable.js'; import { type ObjectOptions, type ObjectShape, ObjectType } from '../object/object.js'; import { type StringFormat } from '../string/string.js'; import type { ThereforeSchema } from '../types.js'; import type { ValidatorInputOptions } from '../validator/types.js'; export declare const jsonschemaKeys: ["examples", "title", "writeonly"]; export declare const jsonDefinitionKeys: ("default" | "description" | "readonly" | "deprecated")[]; export declare function asNullable(node: N, doc: JsonAnnotations & { optional?: boolean; }): N | NullableType; export declare function annotateNode(node: N, doc: JsonAnnotations & { optional?: boolean; }, context: JsonSchemaContext): N; export declare function retrievePropertiesFromPattern(indexPattern: string): { names: string[]; pattern?: never; } | { pattern: string; names?: never; }; export declare function indexProperties(node: JsonAnnotations & JsonAnyInstance & JsonObjectInstance, context: JsonSchemaContext): { properties: Record; strict: boolean | undefined; recordType: Node | undefined; patternProperties: Record | undefined; }; export declare class JSONObjectType extends ObjectType { patternProperties: Record | undefined; element?: Node | undefined; constructor({ shape, recordType, patternProperties, }: { shape: ObjectShape; recordType?: Node | undefined; patternProperties?: Record | undefined; }, options?: SchemaOptions>); } export declare const fromFormat: Record | 'ulid' | 'uuid' | string, StringFormat>; type JsonSchemaWalker = Record Node>; interface JsonSchemaContext { strict: boolean; references: Map Node>; document: object; name?: string | undefined; allowIntersection?: boolean; optionalNullable: boolean; connections: Node[]; formats: boolean; validator: ValidatorInputOptions | undefined; render: (node: JsonSchema, options?: { childProperty?: keyof Pick | undefined; name?: string | undefined; }) => Node; annotate: (node: N, schema: JsonSchema & { optional?: boolean; }) => Node; } export declare function buildContext({ node, name, context: maybeContext, }: { node: JsonSchema; name?: string | undefined; context?: Partial; }): JsonSchemaContext; export declare function walkJsonschema({ node, visitor, childProperty, name, context: maybeContext, }: { node: JsonSchema; visitor: JsonSchemaWalker; name?: string | undefined; childProperty?: keyof Pick | undefined; context?: Partial; }): Node; /** * @category JsonSchema */ export interface JsonSchemaOptions { /** * Toggles whether additional properties should be allowed by default on objects. (is used when * no additionalProperties is set on the schema) * * @defaultValue false */ strict?: boolean; references?: Map Node>; exportAllSymbols?: boolean; document?: object; formats?: boolean; /** * If true, the schema will be dereferenced if the root node is a reference. * * @default true */ dereference?: boolean; /** * If true, intersection types are being calculated from the `allOf` clause. * * @defaultValue true */ allowIntersection?: boolean; /** * If true, all non-required fields will also be allowed to be `null` */ optionalNullable?: boolean; validator?: ValidatorInputOptions | undefined; } /** * Create a new `ThereforeCst` instance with the given options. * * ### Example * ```ts * $jsonschema({type: 'object', properties: {foo: {type: "string"}}}) * ``` * * @param schema - The JSON Draft 7 schema. * @param options - Additional options to pass to the tuple. * * @group Schema */ export declare function $jsonschema(schema: JsonSchema, options?: SchemaOptions): ThereforeSchema; export {};