marshmallow icon indicating copy to clipboard operation
marshmallow copied to clipboard

Add "raise_exception" to Schema.validate()

Open ADR-007 opened this issue 5 years ago • 2 comments

Hi!

I would like to have raise_exception parameter in Schema.validate() like it is in Django REST Framework: https://www.django-rest-framework.org/api-guide/exceptions/#validationerror Because now I have to call load to have the error.

Thanks!

ADR-007 avatar Nov 30 '20 13:11 ADR-007

For your use case, is there an issue with using load?

I'd rather not add API surface if the common use case is met by existing API.

sloria avatar Dec 01 '20 20:12 sloria

For your use case, is there an issue with using load?

There could be if load has side-effects, like instantiating, or even writing stuff to DB (which might be an anti-pattern in the first place).

lafrech avatar Jun 28 '21 08:06 lafrech