All notable changes to the library will be documented in this file.
- Fix
intersectschema to infer correct input and output types for non-tuple array options instead ofnever(pull request #1478)
- Add
isoDateTimeSecondvalidation action to validate ISO date times with seconds (pull request #1418) - Add
toCamelCase,toKebabCase,toPascalCaseandtoSnakeCasetransformation actions to convert strings between common naming conventions (pull request #1457) - Change internal
ReadonlyOutputKeysandOutputWithReadonlytypes ofobjectschemas andWithReadonlytype ofrecordschemas to improve TypeScript type performance (pull request #1442) - Change hot paths to reduce object allocations and improve runtime performance (pull request #1437)
- Change build target to ES2020 so distributed output stays compatible with environments that lack support for newer syntax (pull request #1455)
- Change internal
_LruCacheto use a TypeScriptprivatemethod instead of a#privateclass field to avoid runtime helpers in the transpiled output (pull request #1455) - Change internal
_isValidObjectKeyto useObject.prototype.hasOwnProperty.callinstead ofObject.hasOwnso the distributed output stays compatible with runtimes that lack the ES2022Object.hasOwnbuiltin (pull request #1421) - Change
flattenmethod to accept readonly issue arrays (pull request #1269) - Fix potential
RangeErrorcaused by spreading large issue arrays (pull request #1437) - Fix
creditCardvalidation action to reject Mastercard numbers with invalid lengths (pull request #1462) - Fix
intersectschema to no longer mutate input values, allowing frozen objects and arrays to be merged (pull request #1463)
- Change
MAC48_REGEX,MAC64_REGEXandMAC_REGEXto drop theiflag for better JSON Schema compatibility (pull request #1430) - Change
hashaction to use case-expanded character classes instead of theiflag (pull request #1430)
- Add
guardtransformation action to narrow types using type predicates (pull request #1204) - Add
parseBooleantransformation action to parse boolean values from strings and other types (pull request #1251) - Add
isrcvalidation action to validate ISRC codes (pull request #1373) - Add
cachemethod for caching schema output by input (pull request #1170) - Add
domainvalidation action to validate domain names (pull request #1284) - Add
jwsCompactvalidation action to validate JWS compact strings (pull request #1348) - Fix
creditCardvalidation action to allow 13-digit Visa card numbers (pull request #1347) - Fix
isoTimestampvalidation action to allow optional space before UTC offset for PostgreSQLtimestamptzcompatibility (pull request #1195) - Fix types for deeply readonly default and fallback values
- Add
toBigint,toBoolean,toDate,toNumberandtoStringtransformation actions (pull request #1212) - Add
examplesaction to add example values to a schema (pull request #1199) - Add
getExamplesmethod to extract example values from a schema (pull request #1199) - Add
isbnvalidation action to validate ISBN-10 and ISBN-13 strings (pull request #1097) - Add exports for
RawCheckAddIssue,RawCheckContext,RawCheckIssueInfo,RawTransformAddIssue,RawTransformContextandRawTransformIssueInfotypes for better developer experience withrawCheckandrawTransformactions (pull request #1359) - Change build step to tsdown
- Fix ReDoS vulnerability in
EMOJI_REGEXused byemojiaction
- Add
messagemethod to overwrite local error message configuration of a schema (pull request #1103) - Add
summarizemethod to summarize issues into a pretty-printable multi-line string (pull request #1158) - Add
getTitle,getDescriptionandgetMetadatamethods to extract metadata of a schema (pull request #1154) - Add
minEntriesandmaxEntriesvalidation action to validate number of object entries (pull request #1100) - Add
entriesandnotEntriesvalidation action to validate number of object entries (pull request #1156) - Add
parseJsonandstringifyJsontransformation action to parse and stringify JSON (pull request #1137) - Add
flavortransformation action to flavor the output type of a schema (pull request #950) - Add support for bigints to
multipleOfvalidation action (pull request #1164) - Change implementation of
variantandvariantAsyncschema to improve performance by aborting validation of discriminators early (pull request #1110) - Change name of
NanoIDActionandNanoIDIssueinterface toNanoIdActionandNanoIdIssue(pull request #1171) - Fix internal
MarkOptionaltype to fix input and output type of objects in edge cases (issue #1176)
- Add
assertmethod to assert values (issue #862) - Add
checkItemsAsyncaction (pull request #856) - Add
graphemes,maxGraphemes,minGraphemesandnotGraphemesaction (pull request #853) - Add
words,maxWords,minWordsandnotWordsaction - Add
argsandreturnsaction to transform functions (issue #243) - Add
rfcEmailaction to validate RFC 5322 email addresses (pull request #912) - Add
gtValueandltValueaction for greater than and less than validation (pull request #978, #985) - Add
valuesandnotValuesaction for easier multi-value validation (pull request #919) - Add
slugaction to validate URL slugs (pull request #910) - Add support for
ReadonlyMapandReadonlySettoreadonlyaction (issue #1059) - Add
entriesFromObjectsutil to improve tree shaking (pull request #1023) - Add new overload signature to
pipeandpipeAyncmethod to support unlimited pipe items of same input and output type (issue #852) - Add
@__NO_SIDE_EFFECTS__notation to improve tree shaking (pull request #995) - Add
exactOptionalandexactOptionalAsyncschema (PR #1013) - Change types and implementation to support Standard Schema
- Change behaviour of
minValueandmaxValueforNaN(pull request #843) - Change type and behaviour of
nullable,nullableAsync,nullish,nullishAsync,optional,optionalAsync,undefinedableandundefinedableAsyncfor undefined default value (issue #878) - Change type signature of
partialCheckandpartialCheckAsyncaction to add.pathListproperty in a type-safe way - Change type signature of
findItemaction to support type predicates (issue #867) - Change validation of missing object entries in
looseObject,looseObjectAsync,object,objectAsync,objectWithRest,objectWithRestAsync,strictObjectandstrictObject(PR #1013) - Change type signature of
optionalandoptionalAsyncwhen used within an object schema (PR #1013) - Change
MarkOptionaltype to fix order of entries and TS error when using generic schemas (issue #1021) - Change
VariantOptionandVariantOptionAsynctype to fix TS error when using generic schemas (issue #842) - Change implementation of
variantandvariantAsyncto support optional discriminators usingexactOptional,exactOptionalAsync,optional,optionalAsync,nullishornullishAsync - Change
_addIssueto not ignore empty strings as error message (pull request #1065) - Change
ISO_DATE_TIME_REGEXandISO_TIMESTAMP_REGEXto support space as separator (pull request #1064) - Change pipe tuple of
pipeandpipeAsyncto be readonly by default - Change
forward,forwardCheck,partialCheckandpartialCheckAsyncto improve TypeScript performance (issue #987) - Change
DECIMAL_REGEXto support floats that start with a dot (pull request #1086) - Change exports to export only public types to reduce noise
- Refactor
bytes,maxBytes,minBytesandnotBytesaction - Fix implementation of
nonOptional,nonOptionalAsync,nonNullable,nonNullableAsync,nonNullishandnonNullishAsyncschema in edge cases (issue #909) - Fix instantiation error for
anyinPathKeystype (issue #929) - Fix TypeScript error of
keyofmethod for objects with many keys (pull request #988) - Fix options filtering in
enum_schema (pull request #941) - Fix
partialCheckandpartialCheckAsyncaction for typed data with issues
- Fix function type declaration of
_runproperty
- Add
metadataaction to add custom metadata to a schema - Add
titlemetadata action to add a title to a schema (discussion #826) - Add
decimalaction to validate integer and float strings (pull request #823) - Rename
decimalaction todigits(pull request #823) - Rename
NoPipetype toSchemaWithoutPipe - Fix inference of generics in
IssueDotPathtype (issue #814)
- Change
referenceproperty of all action base types to be less strict (issue #799) - Change implementation of
variantandvariantAsyncto improve performance and issues generation for nested variants with different discriminators (pull request #809)
- Add
nanoidaction to validate Nano IDs (pull request #789) - Add
undefinedableandundefinedableAsyncschema (issue #385) - Fix invalid output type for transformed optional object entries (issue #806)
- Add support for
exactOptionalPropertyTypesconfig (issue #385) - Fix
IssueDotPathtype forpipeandpipeAsyncmethod (issue #793) - Fix
IssueDotPathtype forvariantandvariantAsyncschema (issue #700)
- Change
expectsandexpectedproperty by enclosing combined values in parentheses - Change question mark handling for
optional,optionalAsync,nullishandnullishAsyncschemas in objects - Fix TypeScript errors in
TuplePathandQuestionMarkSchematype (issue #659, #776) - Fix missing TypeScript errors in
pipeandpipeAsyncmethod (pull request #785)
- Add
base64action to validate Base64 strings (pull request #644) - Add
descriptionmetadata action (pull request #747) - Add metadata feature to
pipeandpipeAsyncmethod (pull request #747) - Refactor
HEXADECIMAL_REGEX(pull request #666) - Change
unknown[]inLengthInputtype toArrayLike<unknown> - Change
ArrayInputandContentInputtype to useMaybeReadonly - Change
EMOJI_REGEXto be more accurate and strict (pull request #666) - Fix bug in
fallbackandfallbackAsyncmethod for specific schemas (pull request #752) - Fix bug in
fallbackAsyncmethod for async schemas (pull request #732)
- Add
normalizeaction to normalize strings (issue #691) - Add support for async schemas to
entriesFromListutil - Add support for numbers and symbols to
entriesFromListutil (issue #492) - Add
keyproperty toSetPathItemtype to improve DX (issue #693, #694) - Remove
FunctionReferencetype and refactor code
- Increase argument limit of
pipeandpipeAsyncmethod (issue #643)
- Add
file,functionandpromiseschema - Add
awaitAsyncaction to await promise in pipeline - Add
operationproperty tofilterItems,findItem,mapItems,reduceItemsandsortItemaction - Rename
actionargument offilterItems,findItem,mapItems,reduceItemsandsortItemaction tooperation - Rename
actionargument and property oftransformandtransformAsyncaction tooperation - Change and improve implementation of
_stringifyutil
- Fix
_isPartiallyTypedutil ofpartialCheckandpartialCheckAsyncaction
- Fix type exports for JSR and Deno (pull request #663)
- Fix types of
partialCheckandpartialCheckAsyncaction
- Add export alias with reserved keywords for functions with underscore suffix
- Add
partialCheckandpartialCheckAsyncaction (issue #76, #145, #260) - Add
checkItems,filterItems,findItem,mapItems,reduceItemsandsortItemaction (issue #595) - Rename
everyandsomeaction toeveryItemandsomeItem - Rename
_isAllowedObjectKeyto_isValidObjectKeyand add check for inherited properties - Remove
RecordPathItemandTuplePathItemtype and refactor code - Fix
receivedproperty of issue indateschema for invalid dates (issue #654)
- Add
rawCheck,rawCheckAsync,rawTransformandrawTransformAsyncaction (issue #597) - Change
FlatErrorstype for better developer experience (discussion #640) - Change
pipeandpipeAsyncmethod to mark output as untyped only when necessary (discussion #613) - Remove unused
skipPipeoption fromConfigtype and refactor library - Fix
thisreference inlooseTuple,looseTupleAsync,strictTuple,strictTupleAsync,tuple,tupleAsync,tupleWithRestandtupleWithRestAsyncschema (pull request #649) - Fix type of
optionskey inEnumSchemainterface
- Fix missing file extension for Deno (pull request #637)
To migrate from an older version, please see the official migration guide and our announcement post.
- Add
DefaultandDefaultAsynctype and refactor codebase - Add
FallbackandFallbackAsynctype and refactor codebase - Add
isOfTypetype guard util to check the type of an object - Refactor
getDefaultsandgetDefaultsAsyncmethod (pull request #259) - Refactor
getFallbacksandgetFallbacksAsyncmethod (pull request #259) - Change type definitions from
typetointerface(pull request #259, #451) - Remove deprecated properties of
safeParseandsafeParseAsyncmethod - Remove any deprecated method, schema and validation functions
- Fix
NestedPathtype offlattenfor async schemas (issue #456) - Fix implementation of
DefaultValuetype for transformed values
- Add
everyandsomepipeline validation action - Add
inputof schema togetterfunction ofrecursiveandrecursiveAsyncschema (pull request #441) - Change implementation of
transformandtransformAsyncmethod to only run transformations if there are no issues (issue #436) - Rename
recursiveandrecursiveAsyncschema tolazyandlazyAsync(issue #440) - Fix bug in
i18nutil when usingsetSchemaMessage
- Fix bug in
unionandunionAsyncschema for transformed inputs (issue #420)
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
numberandbiginttoPicklistOptionstype (issue #378) - Fix missing export of
forwardAsyncmethod (issue #412)
- Fix missing file extension for Deno (pull request #387)
- Remove
NonNullable,NonNullishandNonOptionaltype - Add
NonNullableInput,NonNullableOutput,NonNullishInput,NonNullishOutput,NonOptionalInputandNonOptionalOutputtype - Improve type signature of
omit,omitAsync,pickandpickAsyncschema to also allow read-only object keys (issue #380) - Fix type of
pipeargument atintersectandintersectAsyncschema
- Improve performance of
enum_andenumAsyncschema 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,variantandvariantAsyncschema to improve developer experience - Fix bug in
getDefaults,getDefaultsAsync,getFallbacksandgetFallbacksAsyncschema for falsy but notundefinedvalues (issue #356) - Fix type of
pipeargument atunion,unionAsync,variantandvariantAsyncschema - Fix bug that broke pipeline execution in
union,unionAsync,variantandvariantAsyncschema (issue #364) - Fix typo in type name of
startsWithvalidation action (pull request #375)
- Add
creditCard,decimal,hash,hexadecimal,hexColorandoctalpipeline validation action (pull request #292, #304, #307, #308, #309) - Add
pipeparameter tointersect,intersectAsync,union,unionAsync,variantandvariantAsyncschema (discussion #297) - Add support for multiple variant options with same discriminator key to
variantandvariantAsyncschema (issue #310) - Add path to issues if discriminator key of
variantandvariantAsyncschema is missing (issue #235, #303) - Change
PicklistOptionstype and generics ofpicklistandpicklistAsyncschema
- Fix output type of optional
objectandobjectAsyncentries with default value (issue #286) - Fix output type of
nullable,nullableAsync,nullish,nullishAsync,optionalandoptionalAsyncschema with default value (issue #286)
- Add support for
specialschema as key ofrecordschema (issue #291) - Add support for
specialandspecialAsyncschema as key ofrecordAsyncschema (issue #291) - Fix input and output type of optional
objectandobjectAsyncentries with default value (issue #286)
- Add
bicvalidation function (pull request #284) - Add
mac,mac48andmac64validation function (pull request #270) - Change
PicklistOptions,UnionOptionsandUnionOptionsAsynctype from tuple to array (issue #279) - Change
IntersectOptions,IntersectOptionsAsync,UnionOptionsandUnionOptionsAsynctype to support readonly values (issue #279) - Fix optional keys of
ObjectInputandObjectOutputtype (issue #242)
- Add support for boolean to
notValuevalidation (pull request #261) - Add
.typedto schema validation result and execute pipeline of complex schemas if output is typed (issue #76, #145) - Add
forwardmethod that forwards issues of pipelines to nested fields (issue #76, #145) - Add
skipPipeoption toistype guard method (pull request #166) - Change return type of
safeParseandsafeParseAsyncmethod - Rename and change util functions and refactor codebase
- Fix
RecordInputandRecordOuputtype when usingunionAsyncas key - Fix output type for
nullable,nullableAsync,nullish,nullishAsync,optionalandoptionalAsyncwhen using a default value (issue #271)
- 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)
- Remove
neverfrom type signatur of strict objects and tuples (issue #234)
Note: The library has been revised and refactored. There is a migration guide in the release notes.
- Add
getRestAndDefaultArgsutility function - Add
restargument toobjectandobjectAsyncschema - Add
variantandvariantAsyncschema (issue #90, #216) - Add
getFallbackproperty to schema infallbackmethod (pull request #177) - Add
PartialObjectEntriesandPartialObjectEntriesAsynctype (issue #217) - Add export for any validation regex (pull request #219)
- Add
getDefaultAsync,getDefaultsandgetDefaultsAsync,getFallback,getFallbackAsync,getFallbacks,getFallbacksAsyncmethod (issue #155) - Add support for schema validation to
transformandtransformAsync - Fix type check in
dateanddateAsyncfor invalid dates (pull request #214) - Improve security of regular expressions (pull request #202)
- Improve
optional,optionalAsync,nullable,nullableAsync,nullishandnullishAsyncschema - Change
ObjectSchemaandObjectSchemaAsynctype - Change type check in
tupleandtupleAsyncto be less strict - Change return type of
actionargument incoerceandcoerceAsynctounknown - Change type of
brand,getDefault,transformandtransformAsyncmethod - Change type of
array,arrayAsync,intersection,intersectionAsync,map,mapAsync,object,objectAsync,union,unionAsync,record,recordAsync,set,setAsync,tupleandtupleAsyncschema - Rename
schemaproperty of every schema type totype - Rename
intersectionandintersectionAsyncschema tointersectandintersectAsync - Rename
enumTypeandenumTypeAsyncschema topicklistandpicklistAsync - Rename
nativeEnumandnativeEnumAsyncschema toenum_andenumAsync - Rename
nullTypeandnullTypeAsyncschema tonull_andnullAsync - Rename
undefinedTypeandundefinedTypeAsyncschema toundefined_andundefinedAsync - Rename
voidTypeandvoidTypeAsyncschema tovoid_andvoidAsync - Rename
defaultproperty ofoptional,optionalAsync,nullable,nullableAsync,nullishandnullishAsyncschema togetDefault - Rename
ObjectShapeandObjectShapeAsynctypes toObjectEntriesandObjectEntriesAsync - Rename
TupleShapeandTupleShapeAsynctypes toTupleItemsandTupleItemsAsync - Deprecate
passthrough,strictandstripmethod in favor ofobjectschema withrestargument
- Add
notBytes,notLength,notSizeandnotValuevalidation function (pull request #194) - Add support for unions as key of
recordandrecordAsyncschema (issue #201) - Add support for pipeline validation to
transformandtransformAsync(issue #197) - Change regex of
emailvalidation to improve performance and security (pull request #180) - Change
objectandobjectAsyncschema to exclude non-existing keys (issue #199) - Fix types at
brand,transformandunwrapmethod (issue #195) - Deprecate
equalvalidation function in favor ofvalue(issue #192)
- Add
intersectionandintersectionAsyncschema (pull request #117) - Fix
RecordInputandRecordOutputtype (pull request #184) - Change
RecordSchemaandRecordSchemaAsynctype - Change
flattenfunction and improve types
- Fix missing file extensions for Deno (pull request #178, #181)
- Add support for multiple branding of a value (pull request #88)
- Add support for dynamic error messages via functions (pull request #136)
- Add
skipPipeoption to skip execution of pipelines (pull request #164)
- Add
ulidvalidation (pull request #151) - Add
getIssues,getOutputandgetPipeIssuesutil and refactor code - Fix type check in
numberandnumberAsyncschema (issue #157) - Change
PipeResulttype to allow multiple issues (issue #161) - Rename previous
getIssuesutil togetSchemaIssues
- Add possibility to define path of pipeline issue (issue #5)
- Add
getDefaultmethod to get default value of schema (issue #105) - Add support for enums as key of
recordandrecordAsyncschema (issue #134) - Add support for default values to
optional,optionalAsync,nullable,nullableAsync,nullishandnullishAsyncschema (issue #96, #118) - Deprecate
withDefaultmethod in favor ofoptionalschema
- Add
cuid2validation (pull request #130) - Add
passthrough,passthroughAsync,stripandstripAsyncmethod - Add
InstanceSchemaAsyncoverload totransformAsyncmethod (pull request #138) - Fix bug in
strictandstrictAsyncmethod for optional keys (issue #131)
- Change object type check in
objectandrecordschema
Note: The library has been revised and refactored. There is a migration guide in the release notes.
- Add
fallbackandfallbackAsyncmethod (pull request #103) - Add
excludesvalidation as negation ofincludes - Add support for more primitives to
literalschema (pull request #102) - Add support for dynamic values to
withDefaultmethod - Change
flattenfunction so that issues are also accepted as argument - Change return type of
safeParseandsafeParseAsyncmethod - Change error handling and refactor library to improve performance
- Rename
.parseto._parseand.typesto._typesto mark it as internal
- Change input type of
mimeTypevalidation toBlob - Rename
useDefaultmethod towithDefault(issue #80) - Add
brandmethod to support branded types (pull request #85)
- Fix types of
enumTypeandenumTypeAsyncschema (issue #70) - Improve performance of loops with for...of (pull request #68)
- Fix prototype pollution vulnerability of
recordandrecordAsync(pull request #67) - Add
finite,safeIntegerandmultipleOfvalidation (pull request #64, #65, #66)
- Add
integervalidation (pull request #62)
- Add
imeivalidation andisLuhnAlgoutil (pull request #37) - Fix
isoDateTime,isoTime,isoTimeSecondandisoTimestampvalidation (pull request #42)
- Fix infered
objectandrecordtypes (issue #9, #10, #34) - Add
strictandstrictAsyncmethod to detect unknown object keys
- Add
ismethod which can be used as a type guard (pull request #13) - Throw all validation issues of a pipeline by default (issue #18)
- Add
abortPipeEarlyoption to abort pipe on first error (issue #18) - Add
abortEarlyoption to abort on first error
- Add
toMinValueandtoMaxValuetransformation
- Fix invalid
comparableimport when using Deno - Add util functions to exports of library
- Rename
minRangeandmaxRangetominValueandmaxValue(issue #20) - Add
valuevalidation function
- Add
instanceandinstanceAsyncschema - Refactor library to work with Deno
- Add
bytes,minBytesandmaxBytesvalidation (pull request #1) - Change build step to tsup and exports in package.json (issue #7)
- Change order of exports in package.json (issue #7)
- Add
blobandblobAsyncschema
- Initial release