stnl
Version:
A simple, opinionated type validator built for performance
28 lines (27 loc) • 678 B
TypeScript
import type { TLoadedType } from "../type.js";
/**
* Describe possible output keys
*/
interface TSchema {
$schema?: "https://json-schema.org/draft/2020-12/schema";
$defs?: Record<string, TSchema>;
$id?: string;
$ref?: string;
anyOf?: TSchema[];
type?: "boolean" | "null" | "integer" | "number" | "string" | "object" | "array";
const?: unknown;
items?: TSchema | false;
prefixItems?: TSchema[];
properties?: Record<string, TSchema>;
required?: string[];
minimum?: number;
maximum?: number;
minLength?: number;
maxLength?: number;
}
/**
* Convert stnl schema to 2020-12 spec JSON schema
* @param t
*/
declare const f: (t: TLoadedType) => TSchema;
export default f;