feat(validation): name a keyed collection as such when a list is given
This commit is contained in:
@@ -78,7 +78,8 @@ class _Validator:
|
||||
self.errors.append(f"{path}: expected bool or dict, got {_kind(value)}")
|
||||
return
|
||||
if not TYPES[kind](value):
|
||||
self.errors.append(f"{path}: expected {kind}, got {_kind(value)}")
|
||||
keyed = len(spec.get("options", {})) == 1 and next(iter(spec["options"])).startswith("<")
|
||||
self.errors.append(f"{path}: expected {'dict keyed by name' if keyed else kind}, got {_kind(value)}")
|
||||
return
|
||||
if "choices" in spec and value not in spec["choices"]:
|
||||
shown = "" if spec.get("no_log") else f", got {value!r}"
|
||||
|
||||
Reference in New Issue
Block a user