Module
The modular and type safe schema library for validating structural data π€
Changelog
All notable changes to the library will be documented in this file.
v1.0.0 (Month DD, YYYY)
- Add
assert
method to assert values (issue #862) - Add
checkItemsAsync
action (pull request #856) - Add
graphemes
,maxGraphemes
,minGraphemes
andnotGraphemes
action (pull request #853) - Add
words
,maxWords
,minWords
andnotWords
action - Add
args
andreturns
action to transform functions (issue #243) - Change types and implementation to support Standard Schema
- Change behaviour of
minValue
andmaxValue
forNaN
(pull request #843) - Refactor
bytes
,maxBytes
,minBytes
andnotBytes
action
v0.42.1 (September 20, 2024)
- Fix function type declaration of
_run
property
v0.42.0 (September 15, 2024)
- Add
metadata
action to add custom metadata to a schema - Add
title
metadata action to add a title to a schema (discussion #826) - Add
decimal
action to validate integer and float strings (pull request #823) - Rename
decimal
action todigits
(pull request #823) - Rename
NoPipe
type toSchemaWithoutPipe
- Fix inference of generics in
IssueDotPath
type (issue #814)
v0.41.0 (September 01, 2024)
- Change
reference
property of all action base types to be less strict (issue #799) - Change implementation of
variant
andvariantAsync
to improve performance and issues generation for nested variants with different discriminators (pull request #809)
v0.40.0 (August 29, 2024)
- Add
nanoid
action to validate Nano IDs (pull request #789) - Add
undefinedable
andundefinedableAsync
schema (issue #385) - Fix invalid output type for transformed optional object entries (issue #806)
v0.39.0 (August 24, 2024)
- Add support for
exactOptionalPropertyTypes
config (issue #385) - Fix
IssueDotPath
type forpipe
andpipeAsync
method (issue #793) - Fix
IssueDotPath
type forvariant
andvariantAsync
schema (issue #700)
v0.38.0 (August 20, 2024)
- Change
expects
andexpected
property by enclosing combined values in parentheses - Change question mark handling for
optional
,optionalAsync
,nullish
andnullishAsync
schemas in objects - Fix TypeScript errors in
TuplePath
andQuestionMarkSchema
type (issue #659, #776) - Fix missing TypeScript errors in
pipe
andpipeAsync
method (pull request #785)
v0.37.0 (July 30, 2024)
- Add
base64
action to validate Base64 strings (pull request #644) - Add
description
metadata action (pull request #747) - Add metadata feature to
pipe
andpipeAsync
method (pull request #747) - Refactor
HEXADECIMAL_REGEX
(pull request #666) - Change
unknown[]
inLengthInput
type toArrayLike<unknown>
- Change
ArrayInput
andContentInput
type to useMaybeReadonly
- Change
EMOJI_REGEX
to be more accurate and strict (pull request #666) - Fix bug in
fallback
andfallbackAsync
method for specific schemas (pull request #752) - Fix bug in
fallbackAsync
method for async schemas (pull request #732)
v0.36.0 (July 05, 2024)
- Add
normalize
action to normalize strings (issue #691) - Add support for async schemas to
entriesFromList
util - Add support for numbers and symbols to
entriesFromList
util (issue #492) - Add
key
property toSetPathItem
type to improve DX (issue #693, #694) - Remove
FunctionReference
type and refactor code
v0.35.0 (June 25, 2024)
- Increase argument limit of
pipe
andpipeAsync
method (issue #643)
v0.34.0 (June 24, 2024)
- Add
file
,function
andpromise
schema - Add
awaitAsync
action to await promise in pipeline - Add
operation
property tofilterItems
,findItem
,mapItems
,reduceItems
andsortItem
action - Rename
action
argument offilterItems
,findItem
,mapItems
,reduceItems
andsortItem
action tooperation
- Rename
action
argument and property oftransform
andtransformAsync
action tooperation
- Change and improve implementation of
_stringify
util
v0.33.3 (June 19, 2024)
- Fix
_isPartiallyTyped
util ofpartialCheck
andpartialCheckAsync
action
v0.33.2 (June 19, 2024)
- Fix type exports for JSR and Deno (pull request #663)
v0.33.1 (June 18, 2024)
- Fix types of
partialCheck
andpartialCheckAsync
action
v0.33.0 (June 18, 2024)
- Add export alias with reserved keywords for functions with underscore suffix
- Add
partialCheck
andpartialCheckAsync
action (issue #76, #145, #260) - Add
checkItems
,filterItems
,findItem
,mapItems
,reduceItems
andsortItem
action (issue #595) - Rename
every
andsome
action toeveryItem
andsomeItem
- Rename
_isAllowedObjectKey
to_isValidObjectKey
and add check for inherited properties - Remove
RecordPathItem
andTuplePathItem
type and refactor code - Fix
received
property of issue indate
schema for invalid dates (issue #654)
v0.32.0 (June 14, 2024)
- Add
rawCheck
,rawCheckAsync
,rawTransform
andrawTransformAsync
action (issue #597) - Change
FlatErrors
type for better developer experience (discussion #640) - Change
pipe
andpipeAsync
method to mark output as untyped only when necessary (discussion #613) - Remove unused
skipPipe
option fromConfig
type and refactor library - Fix
this
reference inlooseTuple
,looseTupleAsync
,strictTuple
,strictTupleAsync
,tuple
,tupleAsync
,tupleWithRest
andtupleWithRestAsync
schema (pull request #649) - Fix type of
options
key inEnumSchema
interface
v0.31.1 (June 08, 2024)
- Fix missing file extension for Deno (pull request #637)
v0.31.0 (June 06, 2024)
To migrate from an older version, please see the official migration guide and our announcement post.
v0.30.0 (March 06, 2024)
- Add
Default
andDefaultAsync
type and refactor codebase - Add
Fallback
andFallbackAsync
type and refactor codebase - Add
isOfType
type guard util to check the type of an object - Refactor
getDefaults
andgetDefaultsAsync
method (pull request #259) - Refactor
getFallbacks
andgetFallbacksAsync
method (pull request #259) - Change type definitions from
type
tointerface
(pull request #259, #451) - Remove deprecated properties of
safeParse
andsafeParseAsync
method - Remove any deprecated method, schema and validation functions
- Fix
NestedPath
type offlatten
for async schemas (issue #456) - Fix implementation of
DefaultValue
type for transformed values
v0.29.0 (February 19, 2024)
- Add
every
andsome
pipeline validation action - Add
input
of schema togetter
function ofrecursive
andrecursiveAsync
schema (pull request #441) - Change implementation of
transform
andtransformAsync
method to only run transformations if there are no issues (issue #436) - Rename
recursive
andrecursiveAsync
schema tolazy
andlazyAsync
(issue #440) - Fix bug in
i18n
util when usingsetSchemaMessage
v0.28.1 (February 06, 2024)
- Fix bug in
union
andunionAsync
schema for transformed inputs (issue #420)
v0.28.0 (February 05, 2024)
Note: The library has been revised and refactored. Therefore, not every change is listed in detail.
- Add i18n feature, global configurations and improve error messages (pull request #397)
- Add
number
andbigint
toPicklistOptions
type (issue #378) - Fix missing export of
forwardAsync
method (issue #412)
v0.27.1 (January 28, 2024)
- Fix missing file extension for Deno (pull request #387)
v0.27.0 (January 24, 2024)
- Remove
NonNullable
,NonNullish
andNonOptional
type - Add
NonNullableInput
,NonNullableOutput
,NonNullishInput
,NonNullishOutput
,NonOptionalInput
andNonOptionalOutput
type - Improve type signature of
omit
,omitAsync
,pick
andpickAsync
schema to also allow read-only object keys (issue #380) - Fix type of
pipe
argument atintersect
andintersectAsync
schema
v0.26.0 (January 16, 2024)
- Improve performance of
enum_
andenumAsync
schema by caching values - Change ISO timestamp regex to support timestamps with lower and higher millisecond accuracy (pull request #353)
- Change issue handling of
union
,unionAsync
,variant
andvariantAsync
schema to improve developer experience - Fix bug in
getDefaults
,getDefaultsAsync
,getFallbacks
andgetFallbacksAsync
schema for falsy but notundefined
values (issue #356) - Fix type of
pipe
argument atunion
,unionAsync
,variant
andvariantAsync
schema - Fix bug that broke pipeline execution in
union
,unionAsync
,variant
andvariantAsync
schema (issue #364) - Fix typo in type name of
startsWith
validation action (pull request #375)
v0.25.0 (December 26, 2023)
- Add
creditCard
,decimal
,hash
,hexadecimal
,hexColor
andoctal
pipeline validation action (pull request #292, #304, #307, #308, #309) - Add
pipe
parameter tointersect
,intersectAsync
,union
,unionAsync
,variant
andvariantAsync
schema (discussion #297) - Add support for multiple variant options with same discriminator key to
variant
andvariantAsync
schema (issue #310) - Add path to issues if discriminator key of
variant
andvariantAsync
schema is missing (issue #235, #303) - Change
PicklistOptions
type and generics ofpicklist
andpicklistAsync
schema
v0.24.1 (December 11, 2023)
- Fix output type of optional
object
andobjectAsync
entries with default value (issue #286) - Fix output type of
nullable
,nullableAsync
,nullish
,nullishAsync
,optional
andoptionalAsync
schema with default value (issue #286)
v0.24.0 (December 10, 2023)
- Add support for
special
schema as key ofrecord
schema (issue #291) - Add support for
special
andspecialAsync
schema as key ofrecordAsync
schema (issue #291) - Fix input and output type of optional
object
andobjectAsync
entries with default value (issue #286)
v0.23.0 (December 08, 2023)
- Add
bic
validation function (pull request #284) - Add
mac
,mac48
andmac64
validation function (pull request #270) - Change
PicklistOptions
,UnionOptions
andUnionOptionsAsync
type from tuple to array (issue #279) - Change
IntersectOptions
,IntersectOptionsAsync
,UnionOptions
andUnionOptionsAsync
type to support readonly values (issue #279) - Fix optional keys of
ObjectInput
andObjectOutput
type (issue #242)
v0.22.0 (December 03, 2023)
- Add support for boolean to
notValue
validation (pull request #261) - Add
.typed
to schema validation result and execute pipeline of complex schemas if output is typed (issue #76, #145) - Add
forward
method that forwards issues of pipelines to nested fields (issue #76, #145) - Add
skipPipe
option tois
type guard method (pull request #166) - Change return type of
safeParse
andsafeParseAsync
method - Rename and change util functions and refactor codebase
- Fix
RecordInput
andRecordOuput
type when usingunionAsync
as key - Fix output type for
nullable
,nullableAsync
,nullish
,nullishAsync
,optional
andoptionalAsync
when using a default value (issue #271)
v0.21.0 (November 19, 2023)
- Change structure of schemas, validations and transformations to make properties accessible (pull request #211)
- Fix errors in JSDoc comments and add JSDoc ESLint plugin (pull request #205)
- Fix missing file extension for Deno (pull request #249)
v0.20.1 (November 2, 2023)
- Remove
never
from type signatur of strict objects and tuples (issue #234)
v0.20.0 (October 31, 2023)
Note: The library has been revised and refactored. There is a migration guide in the release notes.
- Add
getRestAndDefaultArgs
utility function - Add
rest
argument toobject
andobjectAsync
schema - Add
variant
andvariantAsync
schema (issue #90, #216) - Add
getFallback
property to schema infallback
method (pull request #177) - Add
PartialObjectEntries
andPartialObjectEntriesAsync
type (issue #217) - Add export for any validation regex (pull request #219)
- Add
getDefaultAsync
,getDefaults
andgetDefaultsAsync
,getFallback
,getFallbackAsync
,getFallbacks
,getFallbacksAsync
method (issue #155) - Add support for schema validation to
transform
andtransformAsync
- Fix type check in
date
anddateAsync
for invalid dates (pull request #214) - Improve security of regular expressions (pull request #202)
- Improve
optional
,optionalAsync
,nullable
,nullableAsync
,nullish
andnullishAsync
schema - Change
ObjectSchema
andObjectSchemaAsync
type - Change type check in
tuple
andtupleAsync
to be less strict - Change return type of
action
argument incoerce
andcoerceAsync
tounknown
- Change type of
brand
,getDefault
,transform
andtransformAsync
method - Change type of
array
,arrayAsync
,intersection
,intersectionAsync
,map
,mapAsync
,object
,objectAsync
,union
,unionAsync
,record
,recordAsync
,set
,setAsync
,tuple
andtupleAsync
schema - Rename
schema
property of every schema type totype
- Rename
intersection
andintersectionAsync
schema tointersect
andintersectAsync
- Rename
enumType
andenumTypeAsync
schema topicklist
andpicklistAsync
- Rename
nativeEnum
andnativeEnumAsync
schema toenum_
andenumAsync
- Rename
nullType
andnullTypeAsync
schema tonull_
andnullAsync
- Rename
undefinedType
andundefinedTypeAsync
schema toundefined_
andundefinedAsync
- Rename
voidType
andvoidTypeAsync
schema tovoid_
andvoidAsync
- Rename
default
property ofoptional
,optionalAsync
,nullable
,nullableAsync
,nullish
andnullishAsync
schema togetDefault
- Rename
ObjectShape
andObjectShapeAsync
types toObjectEntries
andObjectEntriesAsync
- Rename
TupleShape
andTupleShapeAsync
types toTupleItems
andTupleItemsAsync
- Deprecate
passthrough
,strict
andstrip
method in favor ofobject
schema withrest
argument
v0.19.0 (October 08, 2023)
- Add
notBytes
,notLength
,notSize
andnotValue
validation function (pull request #194) - Add support for unions as key of
record
andrecordAsync
schema (issue #201) - Add support for pipeline validation to
transform
andtransformAsync
(issue #197) - Change regex of
email
validation to improve performance and security (pull request #180) - Change
object
andobjectAsync
schema to exclude non-existing keys (issue #199) - Fix types at
brand
,transform
andunwrap
method (issue #195) - Deprecate
equal
validation function in favor ofvalue
(issue #192)
v0.18.0 (September 30, 2023)
- Add
intersection
andintersectionAsync
schema (pull request #117) - Fix
RecordInput
andRecordOutput
type (pull request #184) - Change
RecordSchema
andRecordSchemaAsync
type - Change
flatten
function and improve types
v0.17.1 (September 25, 2023)
- Fix missing file extensions for Deno (pull request #178, #181)
v0.17.0 (September 17, 2023)
- Add support for multiple branding of a value (pull request #88)
- Add support for dynamic error messages via functions (pull request #136)
- Add
skipPipe
option to skip execution of pipelines (pull request #164)
v0.16.0 (September 16, 2023)
- Add
ulid
validation (pull request #151) - Add
getIssues
,getOutput
andgetPipeIssues
util and refactor code - Fix type check in
number
andnumberAsync
schema (issue #157) - Change
PipeResult
type to allow multiple issues (issue #161) - Rename previous
getIssues
util togetSchemaIssues
v0.15.0 (September 10, 2023)
- Add possibility to define path of pipeline issue (issue #5)
- Add
getDefault
method to get default value of schema (issue #105) - Add support for enums as key of
record
andrecordAsync
schema (issue #134) - Add support for default values to
optional
,optionalAsync
,nullable
,nullableAsync
,nullish
andnullishAsync
schema (issue #96, #118) - Deprecate
withDefault
method in favor ofoptional
schema
v0.14.0 (September 08, 2023)
- Add
cuid2
validation (pull request #130) - Add
passthrough
,passthroughAsync
,strip
andstripAsync
method - Add
InstanceSchemaAsync
overload totransformAsync
method (pull request #138) - Fix bug in
strict
andstrictAsync
method for optional keys (issue #131)
v0.13.1 (August 23, 2023)
- Change object type check in
object
andrecord
schema
v0.13.0 (August 23, 2023)
Note: The library has been revised and refactored. There is a migration guide in the release notes.
- Add
fallback
andfallbackAsync
method (pull request #103) - Add
excludes
validation as negation ofincludes
- Add support for more primitives to
literal
schema (pull request #102) - Add support for dynamic values to
withDefault
method - Change
flatten
function so that issues are also accepted as argument - Change return type of
safeParse
andsafeParseAsync
method - Change error handling and refactor library to improve performance
- Rename
.parse
to._parse
and.types
to._types
to mark it as internal
v0.12.0 (August 11, 2023)
- Change input type of
mimeType
validation toBlob
- Rename
useDefault
method towithDefault
(issue #80) - Add
brand
method to support branded types (pull request #85)
v0.11.1 (August 07, 2023)
- Fix types of
enumType
andenumTypeAsync
schema (issue #70) - Improve performance of loops with forβ¦of (pull request #68)
v0.11.0 (August 06, 2023)
- Fix prototype pollution vulnerability of
record
andrecordAsync
(pull request #67) - Add
finite
,safeInteger
andmultipleOf
validation (pull request #64, #65, #66)
v0.10.0 (August 05, 2023)
- Add
integer
validation (pull request #62)
v0.9.0 (August 04, 2023)
- Add
imei
validation andisLuhnAlgo
util (pull request #37) - Fix
isoDateTime
,isoTime
,isoTimeSecond
andisoTimestamp
validation (pull request #42)
v0.8.0 (July 31, 2023)
- Fix infered
object
andrecord
types (issue #9, #10, #34) - Add
strict
andstrictAsync
method to detect unknown object keys
v0.7.0 (July 30, 2023)
- Add
is
method which can be used as a type guard (pull request #13) - Throw all validation issues of a pipeline by default (issue #18)
- Add
abortPipeEarly
option to abort pipe on first error (issue #18) - Add
abortEarly
option to abort on first error
v0.6.0 (July 30, 2023)
- Add
toMinValue
andtoMaxValue
transformation
v0.5.0 (July 28, 2023)
- Fix invalid
comparable
import when using Deno - Add util functions to exports of library
- Rename
minRange
andmaxRange
tominValue
andmaxValue
(issue #20) - Add
value
validation function
v0.4.0 (July 27, 2023)
- Add
instance
andinstanceAsync
schema - Refactor library to work with Deno
v0.3.0 (July 27, 2023)
- Add
bytes
,minBytes
andmaxBytes
validation (pull request #1) - Change build step to tsup and exports in package.json (issue #7)
v0.2.1 (July 26, 2023)
- Change order of exports in package.json (issue #7)
v0.2.0 (July 25, 2023)
- Add
blob
andblobAsync
schema
v0.1.0 (July 12, 2023)
- Initial release