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

validate field should prior to make_object #253

sunsongxp opened this Issue Jul 30, 2015 · 1 comment


None yet
2 participants

sunsongxp commented Jul 30, 2015

Version: marshmallow==2.0.0b4


class UserSchema(Schema):
    github_account_name = Str()

    def validate_github_account_name(self, value):

    def make_object(self, data):
          return User(**data)

This example lead to a error in line 771(value = data[field_name]) in, alleging

TypeError: 'User' object has no attribute '__getitem__'

The problem is that the "value" in line 771 is actually the User object which returned by make_object, the 'field_name ' is exactly 'github_account_name' that defined needs to be validated.

This problem may be solved by validate fields prior to make_object.


This comment has been minimized.


sloria commented Aug 1, 2015

Good catch. You are correct, make_object should be called after the validators. I will fix this shortly.

@sloria sloria added the bug label Aug 1, 2015

@sloria sloria closed this in 0cd153b Aug 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment