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

Backward incompatibility: error path not available anymore #283

Closed
brmzkw opened this issue Apr 21, 2017 · 4 comments
Closed

Backward incompatibility: error path not available anymore #283

brmzkw opened this issue Apr 21, 2017 · 4 comments

Comments

@brmzkw
Copy link

brmzkw commented Apr 21, 2017

The code below raises a voluptuous error because extra data are forbidden by and empty schema.

from voluptuous import Schema

try:
    Schema({})({"extra": "invalid", "extra2": "invalid"})
except Exception as exc:
    print '\n'.join([', '.join(error.path) for error in exc.errors])

With voluptuous 0.9.3, the extra keys are displayed ("extra2", "extra").
With voluptuous >=0.10, the error path is not longer available and an empty string is displayed.

Is it an expected change, or is it a bug that needs to be fixed?

@vikbez
Copy link

vikbez commented Apr 21, 2017

PR #215 introduced this behaviour: a length check of schema was added here, so now _compile_dict is never called on an empty dict.

@alecthomas
Copy link
Owner

Agreed, that seems inconsistent.

@brmzkw
Copy link
Author

brmzkw commented Jul 5, 2017

Any chance to revert #215 then?

@tbillon tbillon mentioned this issue Jul 12, 2017
@kdeldycke
Copy link

Should we close that PR now that #298 has been proposed by @tbillon and merged?

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

No branches or pull requests

5 participants