OpenFn / OpenFn/lightning

Workflow API: support JsonPatch

Open
#2,802 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Elixir
Stars
296
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
50

Description

We have temporarily disabled the PATCH method on the new Workflow API.

A PATCH request should submit a partial update to a workflow. Where PUT requires the whole workflow to be uploaded, PATCH can accept a diff on a single node (or the structure itself)

There are two ways we might implement a PATCH handler:

  1. Accept a partial workflow. Presumably we must accept an object with at least a a jobs, triggers or edges array, containing an id for the thing to be updated. Eg, { jobs: [{ id: "abc", name: "CHANGED NAME" }] }.

  2. Accept a JSON patch. This is what the Workflow Diagram uses right now and presumably when we migrate the diagram to use the workflow API, we'll want to support updates via JSON path. Saying that, I don't actually know if it's technically needed because every item has an explicit id, so we don't need complex json paths or anything to partial updates - so maybe we'd prefer to re-write the workflow differ instead.

Proposed Solution

JSON Patch actually has it's own mime type - I think its application/json-patch+json.

So if we decide to keep both formats, the patch handler can simply add support for both, based on the content type of the request

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Workflow API's PATCH handler and reviewing how the Workflow Diagram currently submits JSON Patch updates. Resolve whether to support partial workflow objects, JSON Patch with application/json-patch+json, or both; done means PATCH can apply the agreed update format to a workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.