alecthomas/voluptuous — pull request #3 by spice (2012-05-06 05:53:39+00:00)
Title: Making error reporting consistent

1. Extra keys error

Right now, extra keys error can be reported as two different errors: "extra keys not allowed" and "not a valid dictionary key". First change makes sure there is only one ("extra keys not allowed").

This will be consistent with the observation that if you allow extra keys with extra=True, these keys become "valid", which is a bit misleading, because they were only invalid because they were not found in the schema.

In fact, the only time you could get "extra keys not allowed" error is when your dict schema is empty (the example in README).

2. Missing required keys error

The change makes this error more uniform and more easily processed programmatically, with individual missing keys being accessible.