Added basic delete support
This commit is contained in:
@@ -20,8 +20,13 @@ def _build_patch_set(change: dict) -> str:
|
|||||||
return ''.join(line)
|
return ''.join(line)
|
||||||
|
|
||||||
|
|
||||||
|
def _build_patch_delete(change: dict) -> str:
|
||||||
|
return f'-{change["path"]} : '
|
||||||
|
|
||||||
|
|
||||||
_patch_builders = {
|
_patch_builders = {
|
||||||
'set': _build_patch_set
|
'set': _build_patch_set,
|
||||||
|
'delete': _build_patch_delete,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -41,6 +46,13 @@ class PatchBuilder:
|
|||||||
'type': value_type
|
'type': value_type
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def delete_node(self, path: str):
|
||||||
|
self.changes.append({
|
||||||
|
'action': 'delete',
|
||||||
|
'path': path
|
||||||
|
})
|
||||||
|
pass
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
patch = []
|
patch = []
|
||||||
for entry in self.changes:
|
for entry in self.changes:
|
||||||
|
|||||||
Reference in New Issue
Block a user