This app is a feature test for Typescript validator (or, as they also called, "parser" or "codec") libraries.
The app is not a performance benchmark: for performance comparison, see this awesome app.
The test case is a generic data structure in combination with a set of "ways to break its invariants".
The test case checks such features as:
The table below shows the results of each test against each library.
For each library-specific code and details, click on the library name.
ajv | arktype | decoders | effect-schema | rescript-schema | runtypes | schemata-ts | superstruct | typebox | valibot | valita | yup | zod | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
addFavouriteRed Adds a duplicated valid colour to the favouriteColours field | |||||||||||||
addFavouriteTiger Adds an invalid colour to the favouriteColours field | |||||||||||||
addFileSystemDupeFile Adds a duplicated value to the tree. My tree has the “unique list” semantics, so that shouldn’t be possible | |||||||||||||
addFileSystemUFOType An enum test not unlike the Tiger test, but in composition with recursive data structures | |||||||||||||
addTwoAtsToEmail Renders the email invalid by adding two @s | |||||||||||||
clearName Clears the name field | |||||||||||||
prefixCustomerId Adds an invalid prefix to the stripeId field | |||||||||||||
setCreatedAtCyborgWar Sets invalid createdAt date | |||||||||||||
setHalfVisits Renders the visits field to be a float instead of an integer | |||||||||||||
setProfileArtist Sets the valid profile field to an invalid structure | |||||||||||||
setSubscriptionTypeBanana Sets the subscription field to banana | |||||||||||||
switchDates Switches the createdAt and updatedAt fields | |||||||||||||
encodedEqualsInput decode then encode doesnt break the input | |||||||||||||
transformationsPossible transformations are possible | |||||||||||||
acceptsTypedInput The library accepts not only unknown/any types as validation input, but more refined "intermediate" types as well | |||||||||||||
branded Branded types are supported | |||||||||||||
canGenerateJsonSchema Whether the schema itself can be serialized to cross-system communication. Became more relevant with OpenAI introducing structured outputs | |||||||||||||
emailFormatAmbiguityIsAccountedFor Email format ambiguity is accounted for either in API or in Docs. The library doesn't promise not being able to deliver | |||||||||||||
templateLiterals Template literals are supported | |||||||||||||
typedErrors Typed errors are supported |