alecthomas / voluptuous

CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library.
https://pypi.org/project/voluptuous
BSD 3-Clause "New" or "Revised" License
1.82k stars 218 forks source link

Error triggered after upgrading to version 0.14.0 #511

Closed galeo closed 3 months ago

galeo commented 7 months ago

The following code works fine in 0.13.1, but will trigger a MultipleInvalid error after updating to 0.14.0:

import voluptuous as v

test_schema = v.All(
    v.Schema({
        v.Required(v.Any('key_A', 'key_B')): object
    }, extra=v.ALLOW_EXTRA),
    v.Schema({
        v.Exclusive('key_A', 'key_D'): str,
        v.Optional('test_bool', default=True): bool
    }, extra=v.REMOVE_EXTRA)
)
data = {'key_A': 'fake value', 'test_bool': True}
result = test_schema(data)
print(f'{result=}')

Error message:

voluptuous.error.MultipleInvalid: not a valid value @ data['test_bool']

Thanks.

spacegaier commented 3 months ago

Fixed via https://github.com/alecthomas/voluptuous/pull/522