The decoders & combinators are split into four categories:
Refine - these decoders will only narrow the type
Parse - these decoders will change the type arbitrarily
Build - these combinators will build decoders from other decoders
Util - simple refinements & endomorphisms used to create decoders
Hopefully, enough implementation is specified to understand the intent
If I made a PR of this or some subset of it, would you consider it?
Who does this impact? Who is this for?
Users looking for a runtime validation library
Describe alternatives you've considered
A fork of this library, or maybe new one entirely? io-ts-validations? io-ts-decoders?
Maybe the decoders that are simply 'maps', with no chance of failure (e.g. string.truncate) could purely live in Util, since they're trivial to implement as Decoders?
🚀 Feature request
yup
,joi
,zod
,superstruct
,ajv
, andvalidate.js
all have a big library of combinators for the sake of validationio-ts
is a 'runtime type system' This PR is meant to expand it into a 'runtime validation' systemUsing 'decoders' b/c they compose
Current Behavior
Validation combinators must be implemented manually
Desired Behavior
An extensive, verbose & granular library of common validators
Suggested Solution
By type:
Array
boolean
date
Either
Error (Decoder errors)
Eq
json
NewType
NonEmptyArray
number
Option
Ord
Set
string
partial implementation (playground)
The decoders & combinators are split into four categories:
Refine
- these decoders will only narrow the typeParse
- these decoders will change the type arbitrarilyBuild
- these combinators will build decoders from other decodersUtil
- simple refinements & endomorphisms used to create decodersHopefully, enough implementation is specified to understand the intent
If I made a PR of this or some subset of it, would you consider it?
Who does this impact? Who is this for?
Users looking for a runtime validation library
Describe alternatives you've considered
A fork of this library, or maybe new one entirely?
io-ts-validations
?io-ts-decoders
?Maybe the decoders that are simply 'maps', with no chance of failure (e.g.
string.truncate
) could purely live inUtil
, since they're trivial to implement as Decoders?Additional context
closes https://github.com/gcanti/io-ts-types/issues/151 closes https://github.com/gcanti/io-ts-types/issues/59
Your environment