Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow API: support PATCH #2802

Open
josephjclark opened this issue Jan 8, 2025 · 1 comment
Open

Workflow API: support PATCH #2802

josephjclark opened this issue Jan 8, 2025 · 1 comment

Comments

@josephjclark
Copy link
Contributor

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

@github-project-automation github-project-automation bot moved this to New Issues in v2 Jan 8, 2025
@josephjclark josephjclark moved this from New Issues to Ready in v2 Jan 8, 2025
@josephjclark
Copy link
Contributor Author

Updates on this:

  • We may or may not want JSON patch for the workflow API
  • But we can decide that later
  • For now, we can support a simple REST protocol to allow PATCH requests

Caveat: PATCH probably needs to support some kind of delete key (how do I remove a whole job with PATCH)

Additional note: is our current PUT implementation destructive? Can I remove a job with PUT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

No branches or pull requests

1 participant