Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit Error Types #642

Draft
wants to merge 13 commits into
base: poc
Choose a base branch
from
Draft

Conversation

anthonyjoeseph
Copy link

@anthonyjoeseph anthonyjoeseph commented Apr 17, 2022

Closes #453, Closes #635

Completes the work started by @gcanti in the poc branch, which is explained at a high level here (by the author) and in the docs

As per the notes in the POC branch, all Schemable-related code has been moved into a separate repo called io-ts-contrib. It's registered under anthonyjoeseph's GitHub account, but ownership would ideally be transferred to a maintainer of io-ts

(This PR is still a draft, pending the following)

TODO

  • Update Decoder readme to explain how to add custom LeafE error types that are printable, and how to pattern match on errors (based on gcanti's explanation)
  • Complete test coverage (currently only old v2.2 tests have been ported up to TaskDecoder & Codec, new Decoder2 function tests have yet to be ported)
  • Figure out how to use Codec.lazy w/o @ts-expect-error
  • Replace snapshot testing (compare printed string errors) (?)
  • Reduce fp-ts version (?)

io-ts-contrib TODO:

  • Docs
    • Guard
    • Arbitrary
    • JsonSchema
    • Type
  • Complete test coverage

Open Questions

Does io-ts 3.0.0 depend on fp-ts 3.0.0 still? (I thought I saw that somewhere but I can't find it now) Why?

Any way to use Kleisli to remove duplicate code between Decoders and TaskDecoders? Maybe through the help of multiple case-specific Applicative, Chain, Semigroup and/or Alt instances? (Or is this even worth doing?)

Why do decoders store their metadata at the value level? DecodeErrors make sense, that metadata is used for walking the tree, but what's the decoder stuff for?

Why was 'refine' originally removed from Decoder2? fromRefinement? (This PR adds refinement back in)

Add Alt & Category instances for Decoder and TaskDecoder?

Decoder/TaskDecoder - input Ord instance for traversing? Or standardize "Ord.trivial"?

  • this would mean we'd have to bump fp-ts version (?)

TaskDecoder - input Applicative instances? Or standardize "Task.parallel" (would probably be sufficient for e.g. graphql resolvers)?

@cdimitroulas
Copy link

hey @anthonyjoeseph, it's been a while since this was opened. Is it still the direction of travel for the io-ts POC and (hopefully) next major version of it? Do you need any help with this?

@gcanti
Copy link
Owner

gcanti commented Jan 9, 2023

@cdimitroulas The next major iteration of a io-ts-like library is being developed here https://github.com/fp-ts/schema.

I don't plan to make changes to io-ts before @fp-ts/schema reaches v1.

Once @fp-ts/schema@1.0.0 will be out, I'll think about what's the best migration path (and whether it makes sense)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants