mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
pi-schema: opt-in coercion, compile(schema, { coerce: true }) with coerce() and
parse(), the superset of TypeBox's Value.Convert rules and pi-ai's old coercion;
unresolvedRefs option; url and json-pointer-uri-fragment formats.
pi-ai: Tool takes any JSON Schema; validation through pi-schema; Type, Static
and TSchema are no longer exported (breaking). pi-agent-core and pi-durable:
tools on pi-schema, no TypeBox dependency. Coding agent: extensions keep Type,
Static, TSchema and StringEnum through an extension view of pi-ai; built-in
tools stay on TypeBox.
31 lines
667 B
TypeScript
31 lines
667 B
TypeScript
// JSON Schema validation (drafts 2020-12 and 7) without eval: compile() builds a schema into plain closures once.
|
|
// The builders return plain JSON Schema objects typed with the values they accept.
|
|
|
|
export {
|
|
type Annotations,
|
|
arr,
|
|
bool,
|
|
bytes,
|
|
int,
|
|
type LengthBounds,
|
|
lit,
|
|
map,
|
|
type NumberBounds,
|
|
nul,
|
|
nullable,
|
|
num,
|
|
Optional,
|
|
obj,
|
|
oneOf,
|
|
opt,
|
|
type Properties,
|
|
type Schema,
|
|
type Static,
|
|
type StaticObject,
|
|
str,
|
|
tuple,
|
|
union,
|
|
unknown,
|
|
} from "./builders.ts";
|
|
export type { Check, CompileOptions, FormatCheck, JsonSchema, ParseResult, ValidationError } from "./types.ts";
|
|
export { CoercingValidator, compile, Validator } from "./validator.ts";
|