summaryrefslogtreecommitdiff
path: root/jsonpatch.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2020-11-20 13:26:48 +0100
committerGitHub <noreply@github.com>2020-11-20 13:26:48 +0100
commit24b5e86dd66824dce232ea07e95d39a67b1dd735 (patch)
treebbcec9e1ba705b381b10f7bf9160b25271c62004 /jsonpatch.py
parent511cbc25ec27068fa698818382ec19b6653f34ca (diff)
parent3bb33518194b0cbc6e1512dbeb2ac5ef548d8c72 (diff)
downloadpython-json-patch-24b5e86dd66824dce232ea07e95d39a67b1dd735.tar.gz
Merge pull request #116 from dave-shawley/validate-patch-doc
Fix #110 - validate patch document during creation
Diffstat (limited to 'jsonpatch.py')
-rw-r--r--jsonpatch.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index d7c1988..dc54efc 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -225,6 +225,13 @@ class JsonPatch(object):
'copy': CopyOperation,
}
+ # Verify that the structure of the patch document
+ # is correct by retrieving each patch element.
+ # Much of the validation is done in the initializer
+ # though some is delayed until the patch is applied.
+ for op in self.patch:
+ self._get_operation(op)
+
def __str__(self):
"""str(self) -> self.to_string()"""
return self.to_string()