/** * Models for JsonSchema with derivations in Draft-07, 2019-09, and 2020-12 * * @since 1.2.0 * @see https://json-schema.org/draft/2020-12/json-schema-validation.html */ import { type Const } from 'fp-ts/Const'; import type * as RR from 'fp-ts/ReadonlyRecord'; import { type Float, type MaxNegativeFloat, type MaxPositiveFloat } from 'schemata-ts/float'; import { type Integer, type MaxSafeInt, type MinSafeInt } from 'schemata-ts/integer'; import * as I from 'schemata-ts/internal/json-schema'; import { type Schema } from 'schemata-ts/Schema'; /** * @since 1.2.0 * @category Model */ export type JsonSchemaValue = I.JsonEmpty | I.JsonString | I.JsonNumber | I.JsonBoolean | I.JsonNull | I.JsonInteger | I.JsonConst | I.JsonLiteral | I.JsonStruct | I.JsonArray | I.JsonUnion | I.JsonIntersection | I.JsonRef; /** * @since 1.2.0 * @category Model */ export type JsonSchema = JsonSchemaValue & I.Description & I.References & I.Default; /** * Interprets a schema as a JsonSchema projecting into either Draft-07 or 2020-12 * * @since 1.2.0 * @category Interpreters */ export declare const deriveJsonSchema: (schema: Schema, version?: 'Draft-07' | '2019-09' | '2020-12', maintainIdentity?: boolean) => JsonSchema; /** * @since 1.2.0 * @category Constructors */ export declare const emptySchema: Const; /** * @since 1.2.0 * @category Constructors */ export declare const string: (params?: { minLength?: number; maxLength?: number; pattern?: string; contentEncoding?: string; contentMediaType?: string; contentSchema?: JsonSchema; format?: string; }) => Const; /** * @since 1.2.0 * @category Constructors */ export declare const number: (params?: { minimum?: Min | undefined; maximum?: Max | undefined; }) => Const>; /** * @since 1.2.0 * @category Constructors */ export declare const integer: (params?: { minimum?: Min | undefined; maximum?: Max | undefined; }) => Const>; /** * @since 1.2.0 * @category Constructors */ export declare const booleanSchema: Const; /** * @since 1.2.0 * @category Constructors */ export declare const literal: (value: A) => Const; /** * @since 1.2.0 * @category Constructors */ export declare const struct: (properties: { [K in keyof A]: Const; }, required?: ReadonlyArray, additionalProperties?: JsonSchema | false) => Const; /** * @since 1.2.0 * @category Constructors */ export declare const record: (additionalProperties: Const, propertyNames?: Const) => Const>; /** * @since 1.2.0 * @category Constructors */ export declare const array: (params?: { minItems?: number; maxItems?: number; }) => (items: Const) => Const; /** * @since 1.2.0 * @category Constructors */ export declare const tuple: (...items: { [K in keyof A]: Const; }) => Const; /** * @since 1.2.0 * @category Constructors */ export declare const nullSchema: Const; /** * @since 1.2.0 * @category Constructors */ export declare const union: []>(...members: U) => Const ? A : never>; /** * @since 1.2.0 * @category Constructors */ export declare const intersection: (right: Const) => (left: Const) => Const; /** * A reference to a schema definition * * @since 2.0.0 * @category Constructors */ export declare const ref: (ref: string) => Const; /** * @since 1.2.0 * @category URI */ export declare const URI = "schemata-ts/JsonSchema"; /** * @since 1.2.0 * @category URI */ export type URI = typeof URI; declare module 'fp-ts/lib/HKT' { interface URItoKind2 { readonly JsonSchema: Const; } } /** * @since 1.2.0 * @category Combintators */ export declare const annotate: (params?: { readonly title?: string; readonly description?: string; readonly references?: RR.ReadonlyRecord; readonly deprecated?: boolean; readonly readOnly?: boolean; }) => (schema: JsonSchema) => Const; /** * Removes the internal class identities from a `JsonSchema` * * @since 1.2.0 * @category Destructors */ export declare const stripIdentity: (schema: JsonSchema) => JsonSchema; //# sourceMappingURL=JsonSchema.d.ts.map