-
-
Notifications
You must be signed in to change notification settings - Fork 32k
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
Update voluputous #12463
Update voluputous #12463
Conversation
We must be careful with |
I know. Was waiting for Travis to tell me what needs work. We should rip this bandaid off 👍 |
I like this new feature but it have also break some stuff on hass.io :) |
I did a first pass looking for all the Next up I'm going to modify voluptuous locally to validate default while constructing schemas, load every file and find final defaults that are wrong. |
To patch voluptuous, add this to the end of the if not isinstance(schema, dict):
return
for key, value in schema.items():
if not hasattr(key, 'default'):
continue
if key.default is UNDEFINED:
continue
default = key.default
if callable(default):
default = default()
try:
Schema(value)(default)
except Exception as err:
print(f'{default} did not match {value}: {err}') Then change |
Making tons of progress. Just the tests left. Found a voluptuous 0.11 incompatible schema in one of our dependencies using voluptuous: emlove/aioautomatic#4 |
Done 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing. Make the code a lot better and fix really strange stuff :( they going out of scope by reviews
Bump voluptuous to 0.11.1
Note for breaking change
Custom components only: voluptuous now requires default values for config keys to be valid values.
[0.11.0]
Changes:
Default values MUST now pass validation just as any regular value. This is a backward incompatible change if a schema uses default values that don't pass validation against the specified schema.
Modify
__lt__
in Marker class to allow comparison with non Marker objects, such as str and int.New:
Marker
instances.Schema.infer
method for basic schema inference.SomeOf
validator.Fixes:
Treat Python 2 old-style classes like types when validating.
IsDir()
,IsFile()
andPathExists()
consistent between different Python versions.Coerce
validator to catchdecimal.InvalidOperation
.Schema([])
usage consistent withSchema({})
.Schema.__eq__
deterministic.Maybe(s)
withAny(None, s)
to allow it to be compiled.