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

Record invalid type errors per index with many=True #621

Conversation

tuukkamustonen
Copy link
Contributor

@tuukkamustonen tuukkamustonen commented May 2, 2017

Earlier, errors about invalid types (such as giving primitive for dict) got recorded on _schema level for list elements, rather than for each index separately.

So for example, first block in the added test used to produce:

{
    '_schema': ['Invalid input type.', 'Invalid input type.']}
    0: {},
    1: {}
}

With this change it now produces:

{
    0: {'_schema': ['Invalid input type.']}
    1: {'_schema': ['Invalid input type.']}
}

I don't know marshmallow internals well, and I am quite unsure this. But if this fix makes sense, we can iterate it into a proper form! :)

I used slightly different style to do asserts. I can replace strings by references to Field.default_error_messages, if that's better. Or remove value comparisons altogether. I just think this slightly more verbose form gives reader a better understanding of what is actually in result.errors.

Earlier, errors about invalid types (such as primitive for dict) got recorded
on _schema level for list elements, rather than for each index separately.
@tuukkamustonen
Copy link
Contributor Author

Also this, what do you think @sloria? Candidate for 3.0.0?

@tuukkamustonen
Copy link
Contributor Author

This seems to be fixed (at least in 3.0.0b13).

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.

1 participant