C-Accel-CRIPT / Python-SDK

CRIPT Python SDK
MIT License
10 stars 5 forks source link

Add a working patch option for `get_json` #440

Closed InnocentBug closed 8 months ago

InnocentBug commented 8 months ago

Description

Minimal change, but removes the uuid field from the top-level node in a patch call.

Changes

Known Issues

Notes

Checklist

trunk-io[bot] commented 8 months ago

Merging to develop in this repository is managed by Trunk.

InnocentBug commented 8 months ago

Ok, this is the second part of the puzzle that I promised you.

In order to create JSON for the reverse DFS patches, here is what you can do:

# create a set of all, old known uuids, but exclude the node to patch
suppress_uuid = set(old_tree_map.keys()) - {str(node.uuid)}
patch_json = node.get_json(is_patch = True, known_uuid=suppress_uuid)

I assume you have the old_tree_map as discussed.

The is_patch now removes the uuid from the top level node, I think that is required at the moment.