jcrist / msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML

Home Page:https://jcristharif.com/msgspec/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collecting multiple validation/constraint errors at once

ianjosephwilson opened this issue · comments

Question

I am looking for potential formencode replacements that utilize type annotations to build a validation schema. This library looks nice but it appears that it stops on the first failure. This makes sense during json deserialization where there is no where to go but with regards to constraints it might be weird if you want to return the errors to some sort of user interface, either someone trying to upload a giant CSV or someone trying to fillout a CRUD style form. Ie. you have to just keep changing and resubmitting the data over and over again until all the errors clear but you can't see them all at once to fix them all at once. Is there a way to extend this library to allow collecting/pooling higher level errors? Just like running pytest by default just tries to run all the tests unless you specially say you want to stop on the first failure.

Bummer, I guess this isn't possible/isn't being considered: discussed here

Kind of creates a weird grey area though where another library is sometimes needed to do almost the same thing. I'm going to close this though. Maybe if more people need this it could be re-opened and re-considered.