windmill icon indicating copy to clipboard operation
windmill copied to clipboard

Payload catcher to seed script and flow input

Open rubenfiszel opened this issue 3 years ago • 1 comments

  1. Spawn a temporary endpoint
  2. Send a payload to that endpoint
  3. The payload is captured to be used as test input and a jsonschema is inferred and copiable as flow/script input

rubenfiszel avatar Jul 17 '22 17:07 rubenfiszel

@sqwishy

We can implement that feature in the backend quite easily: new payload_capture table of (workspace_id, user, is_flow, path, created_at, payload )

3 endpoints:

  • a PUT create endpoint to create a new "endpoint" at /capture/create taking in a workspace_id, user, is_flow, path: It will erase the last endpoint from the last created payload_catcher for that workspace_id + user. it returns the endpoint at which it will captures and return it (see below)
  • a POST endpoint at /w/workspace/capture/{flow/script}/{path} that will just save the last json payload send to it
  • a GET endpoint at /w/workspace/capture/{flow/script}/{path} that will return the last value. Should send 200 undefined if there is no value but the catcher has been created but no payload was sent yet. 404 if it wasn't created

In top of that, a zombie job such that every week/month you clean the endpoints that have been created more than 2 hours ago.

From there @fatonramadani can take up the rest of this by basically creating the endpoint at flow/script builder spawn, then polling regularly the associated endpoint

rubenfiszel avatar Aug 02 '22 16:08 rubenfiszel