Use json to encode invalid values in configuration errors so that the user sees a proper repr of the value.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
475a091768
commit
bf1552da79
8 changed files with 17 additions and 3 deletions
|
|
@ -254,7 +254,8 @@ def _parse_oneof_validator(error):
|
|||
)
|
||||
return "{}contains {}, which is an invalid type, it should be {}".format(
|
||||
invalid_config_key,
|
||||
context.instance,
|
||||
# Always print the json repr of the invalid value
|
||||
json.dumps(context.instance),
|
||||
_parse_valid_types_from_validator(context.validator_value))
|
||||
|
||||
if context.validator == 'uniqueItems':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue