Support struct variables in Action Types

I am trying to define an action type that calls a webhook (Outbound Oauth application) and takes the response (a nested struct) together with user input to create a range of objects in the ontology. I would like to use a typescript function for the ontology part but unfortunately, cannot pass the struct response to the function.

If I try it says that my struct arguments (nested struct + list of nested structs) are not supported in action types.

Given the fact that there are also struct variables in Workshop, the expected behavior would be to be able to define those also in action types.

This could generally be handy also for the definition of input forms e.g. when wanting to create N objects linked to a parent in a single form.

Alternatively, enable Webhoooks using user credentials with outbound applications. Then we can keep everything in the functions world.

1 Like

I just tried defining the input to my webhook from a function producing the same signature, but even that is not supported in Action Types.

So I had a similar issue, and couldn’t find a good solution. In the end I just accepted the Webhook response as a String and then used JSON.parse() to turn it into an object, and then tried to validate that it matches the expected interface before handing it off to the ‘real’ function.

It’s frustrating. Additionally, this run-time validation of if an object matches an interface definition is surprisingly tricky (at least for my limited Type/JavaScript skills), given TS’s focus on types, but apparently it’s not something the TS is going to support so you have to do it yourself, but this SO answer on user defined type guards answered it.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.