Changes:
- The
kind
andmodifier
keywords are now expressed as symbol keys. This change allows AJV to leverage TypeBox schemas directly without explicit configuration ofkind
andmodifier
in strict mode. Type.Intersect([...])
now returns a compositeTObject
instead of aallOf
schema representation. This change allows intersected types to be leveraged in calls toOmit
,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 forvoid
return.Type.Rec(...)
renamed toType.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 ofTObject
only.Type.Namespace(...)
has been removed.- The types
TUnion
,TEnum
,KeyOf
andTLiteral<TString>[]
are all now expressed viaallOf
. For Open API users, Please considerType.Unsafe()
to expressenum
string union representations. Documentation on usingType.Unsafe()
can be found here