narrows: Validate negated field.

This commit is contained in:
Steve Howell 2020-06-24 22:47:43 +00:00 committed by Tim Abbott
parent 0039c858a4
commit f960df04e8
1 changed files with 9 additions and 4 deletions

View File

@ -554,10 +554,15 @@ def narrow_parameter(json: str) -> OptionalNarrowListT:
else:
operand_validator = check_string
validator = check_dict([
('operator', check_string),
('operand', operand_validator),
])
validator = check_dict(
required_keys=[
('operator', check_string),
('operand', operand_validator),
],
optional_keys=[
('negated', check_bool),
],
)
try:
validator('elem', elem)