Please consider the patch below. In reporting a missing property during validation, this include the name of the property in the ValidationError's reason.
(Sorry for the inline code. I haven't figured out how to properly submit a patch. The github's issues editor won't let me attach a *.patch file to this post, and other options I tried get rejected because I don't have permission to contribute.)
From 42c4a75835ccb98907c75b7611f550774e3e245f Mon Sep 17 00:00:00 2001
From: Greg Bullock <greg@nwra.com>
Date: Wed, 20 Apr 2016 15:30:37 -0700
Subject: [PATCH] Add details to Missing Property error
In reporting a missing property during validation, include the name of
the property in the ValidationError's reason.
---
src/jsonspec/validators/draft04.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/jsonspec/validators/draft04.py b/src/jsonspec/validators/draft04.py
index adb6ee9..f6d67bb 100644
--- a/src/jsonspec/validators/draft04.py
+++ b/src/jsonspec/validators/draft04.py
@@ -380,7 +380,7 @@ class Draft04Validator(Validator):
if key in obj:
if isinstance(dependencies, sequence_types):
for dep in set(dependencies) - set(obj.keys()):
- self.fail('Missing property', obj, pointer)
+ self.fail('Missing property "{}"'.format(dep), obj, pointer)
else:
dependencies(obj)
return obj
@@ -609,7 +609,7 @@ class Draft04Validator(Validator):
if 'required' in self.attrs:
for name in self.attrs['required']:
if name not in obj:
- self.fail('Missing property', obj, pointer)
+ self.fail('Missing property "{}"'.format(name), obj, pointer)
return obj
def validate_type(self, obj, pointer=None):
--
2.7.1.windows.2
Please consider the patch below. In reporting a missing property during validation, this include the name of the property in the ValidationError's reason.
(Sorry for the inline code. I haven't figured out how to properly submit a patch. The github's issues editor won't let me attach a *.patch file to this post, and other options I tried get rejected because I don't have permission to contribute.)