Files
oh-my-pi/packages/omptype/CHANGELOG.md
T
roboomp 05aea7e8b7 fix(omptype): rejected output-changing schema overrides
- Made type.withJsonSchema reject defaults, structural morphs, and pipe steps instead of returning a Type whose runtime output silently remained the original input.
- Kept validation-only narrow/filter schemas composable, preserving the legacy Type.Unsafe use case and nested JSON Schema emission.
- Added regressions for defaulted and parsed schemas and documented the validation-only contract.

Fixes #8143
2026-08-10 08:20:23 +00:00

4.5 KiB

Changelog

[Unreleased]

Added

  • Added type.withJsonSchema(schema, json), wrapping a validation-only schema so JSON Schema emission yields json verbatim even when embedded in objects, arrays, or unions — a .toJsonSchema() method override is dropped at nested positions because parents emit a child's IR directly. Schemas with defaults or output-changing morphs are rejected to prevent their transformed outputs from being discarded.

[17.2.10] - 2026-08-06

Changed

  • Reimplemented the Zod compatibility facade (@oh-my-pi/omptype/zod) to run purely on internal mechanics, removing the dependency on zod.

[17.2.9] - 2026-08-05

Fixed

  • Fixed the TypeBox adapter emitting an invalid left-bound-only DSL for min-only numeric schemas (e.g. Type.Integer({ minimum: 1 })), which threw left bound requires a corresponding right bound and broke extension tool loading (#7648).

[17.2.8] - 2026-08-04

Added

  • Added io: 'input' and io: 'output' options to toJsonSchema(), supporting input validation shapes and piped .to() target types
  • Added Standard Schema V1 interop: every schema exposes ~standard with synchronous validation, enabling direct use with @t3-oss/env, tRPC, and other Standard Schema consumers.
  • Added fromJsonSchema(), rebuilding callable schemas from JSON Schema documents (draft-07 / draft-2020-12 structural keywords, string formats, $defs recursion, enums, and anyOf/oneOf/allOf composition) — the inverse of Type.toJsonSchema().
  • Added $defs/$ref emission for recursive alias schemas in toJsonSchema() (draft-07 converts to definitions), preventing unbounded recursion on cyclic scopes.
  • Added AnyType, a minimal structural constraint for generic functions accepting any schema without descending the recursive fluent surface.
  • Root .default() values now materialize for undefined input in direct calls and at the Standard Schema boundary (factories run per call).
  • .narrow()/.filter() boolean overloads accept OmpErrors returns, so cond || ctx.reject(...) recipes typecheck.

Changed

  • Restored low-overhead schema construction by lazily activating advanced normalization and compatibility machinery.
  • .default() is typed input-side (i | (() => i)) and marks the schema's input as optional (i | undefined).
  • Parse keywords (string.integer.parse, parse.number, ...) now infer their morph output inside union strings, and input-side inference is union-aware.
  • Object-literal inference for .merge()/.or()/.and() unwraps embedded schema values (output and input sides).

Fixed

  • Alias intersections defer through memoized lazy nodes, so cyclic scope schemas no longer overflow the stack in .and() or morph-union determinism checks.

[17.2.7] - 2026-08-03

Added

  • Introduced omptype, an ArkType-compatible schema validation library featuring a lazy JIT runtime that compiles specialized validators on the third call for ultra-fast hot-path validation and low construction overhead.
  • Added support for a rich string definition DSL (primitives, literals, unions, arrays, bounds, inline defaults, and optional keys), object definitions (including index signatures and strict key rejection/deletion), and comprehensive composition methods (.or, .and, .array, .pipe, .narrow, .describe, .default, .allows, .assert).
  • Added TypeBox-style (@oh-my-pi/omptype/typebox) and Zod-style (@oh-my-pi/omptype/zod) authoring adapters that produce native omptype schemas.
  • Added support for recursive named scopes, modules, runtime generics, fixed/optional/variadic tuples, Date literals/bounds, disjointness-aware intersections, separate input/output inference, and draft-2020-12 JSON Schema emission.
  • Shipped transpiled ESM and TypeScript declarations in the npm package to support plain Node.js environments, while preserving TS source resolution for Bun consumers.

Changed

  • Optimized the lazy JIT compiler to support tuples, refinements, morphs, intersections, instances, and recursive aliases, while reducing schema construction overhead.

Fixed

  • Fixed a TypeScript compiler error (TS2589: "type instantiation is excessively deep") when using generic fluent composition methods on nested schemas.
  • Fixed type.raw() results (BaseType) to correctly expose fluent composition methods like .array(), .or(), and .pipe().
  • Fixed an issue in the TypeBox adapter where keyword-carrying schemas (e.g., uniqueItems arrays) would throw an error during JSON Schema emission.