This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
[Backend] JSON PATCH Endpoint for Datasets/Saas Configs #1093
Labels
enhancement
New feature or request
Describe the solution you'd like
This is to support a UI where we want to allow more targeted edits to specific fields. This is not necessary for a UI where we are uploading an entire yaml or updating an existing yaml.
For making edits to a datasetconfig or a saasconfig, your only option currently is to edit a very deeply nested JSON body and PATCH the whole thing back to Fidesops.
Add a new endpoint(s)
PATCH /dataset/{fides_key}
that supports incremental edits to a dataset with request bodies inspired by JSON Patch format, with slight adjustments. The frontend should be able make requests saying to add/remove/replace a collection/field/reference/identity without having to know the index of its location or whether a key exists already, the backend will take care of that. The frontend request body should be as simple as possible, and the backend is responsible for re-formatting in the appropriate way.The backend should be responsible for taking the frontend request, formatting them into appropriate index-based patch operations, and applying the patch on the dataset or saas config using python-json-patch. Since the backend needs to make edits anyway, we may just avoid python-json-patch and just roll our own solution. It should fail in an all or nothing way. If all the operations can't be completed, none of it should be persisted to the database. It should support an unlimited number of patch operations, one operation, ten operations, etc.
Unlike JSON Patch format, don't specify indices in path.
Describe alternatives you've considered, if any
Early design review had the frontend be entirely responsible for building properly formatted JSON Patch operations. To lighten the FE load, we are looking into moving more of the logic to the backend. If a collection key doesn't yet exist on the dataset, the backend should add it for example, without the FE having to specify that it needs to be added.
Additional context
Output of ticket:
The text was updated successfully, but these errors were encountered: