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

deserialize() throws exception even if strict=False #261

Closed
density opened this Issue Aug 18, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@density

density commented Aug 18, 2015

See https://github.com/marshmallow-code/marshmallow/blob/2.0.0b4/marshmallow/marshalling.py#L254

Instead of adding the validation error to self.errors, Unmarshaller throws an exception directly at this line. This can happen, for example, if the data you're trying to deserialize is a list instead of a dictionary. I think this should be treated like any other validation error and not actually throw the exception here.

@sloria sloria added the bug label Aug 23, 2015

@sloria

This comment has been minimized.

Member

sloria commented Aug 23, 2015

Thanks for reporting @density . I will fix this shortly.

@sloria sloria closed this in 14479c1 Aug 23, 2015

@sloria

This comment has been minimized.

Member

sloria commented Aug 23, 2015

Fixed. The current behavior is now:

from marshmallow import Schema, fields, ValidationError

class MySchema(Schema):
    foo = fields.Field()

MySchema().load([]).errors
# {'_schema': ['Data must be a dict, got a list']}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment