deno.land / x / typebox@0.32.21 / changelog / 0.24.0.md

0.24.0

Changes:

  • The kind and modifier keywords are now expressed as symbol keys. This change allows AJV to leverage TypeBox schemas directly without explicit configuration of kind and modifier in strict mode.
  • Type.Intersect([...]) now returns a composite TObject instead of a allOf schema representation. This change allows intersected types to be leveraged in calls to Omit, Pick, Partial, Required.
  • Type.Void(...) now generates a { type: null } schema representation. This is principally used for RPC implementations where a RPC target function needs to respond with a serializable value for void return.
  • Type.Rec(...) renamed to Type.Recursive(...) and now supports non-mutual recursive type inference.

Added:

  • Type.Unsafe<T>(...). This type enables custom schema representations whose static type is informed by generic type T.
  • Type.Uint8Array(...). This is a non-standard schema that can be configured on AJV to enable binary buffer range validation.
  • Added optional extended design property on all schema options. This property can be used to specify design time metadata when rendering forms.

Compiler:

  • TypeBox now provides an optional experimental type compiler that can be used to validate types without AJV. This compiler is not a standard JSON schema compiler and will only compile TypeBox's known schema representations. For full JSON schema validation, AJV should still be the preference. This compiler is a work in progress.

Value:

  • TypeBox now provides a value generator that can generate default values from TypeBox types.

Breaking Changes:

  • Type.Intersect(...) is constrained to accept types of TObject only.
  • Type.Namespace(...) has been removed.
  • The types TUnion, TEnum, KeyOf and TLiteral<TString>[] are all now expressed via allOf. For Open API users, Please consider Type.Unsafe() to express enum string union representations. Documentation on using Type.Unsafe() can be found here
typebox

Version Info

Tagged at
4 weeks ago