fix(validation): say no keys are accepted when a dict declares none
This commit is contained in:
@@ -103,7 +103,8 @@ class _Validator:
|
|||||||
return
|
return
|
||||||
for key in value:
|
for key in value:
|
||||||
if key not in options:
|
if key not in options:
|
||||||
self.errors.append(f"{path}.{key}: unsupported key, {path} accepts {', '.join(sorted(options))}")
|
accepted = ", ".join(sorted(options)) or "no keys"
|
||||||
|
self.errors.append(f"{path}.{key}: unsupported key, {path} accepts {accepted}")
|
||||||
for key, spec in options.items():
|
for key, spec in options.items():
|
||||||
if key in value:
|
if key in value:
|
||||||
self.check(spec, value[key], f"{path}.{key}")
|
self.check(spec, value[key], f"{path}.{key}")
|
||||||
|
|||||||
Reference in New Issue
Block a user