Hi Osami,
Thank you for your feedback. Nested Objects are supported in SDK, please find the syntax below.
document_list: {
fields: lambda do
[
{name: "total", type: "integer"},
{name: "page", type: "integer"},
{name: "documents", type:"array", of:"object", properties: [
{name: "id"},
{name: "user_id"},
{name: "title"},
{name: "note"},
{name: "message"},
{name: "status", type:"integer"},
{name: "created_at"},
]},
{name: "hasnext"}
]
end
}
Please refer the documentation for details: http://docs.workato.com/developing-connectors/sdk/object-definition.html#nested-fields
I understand referencing object definition is not supported for now. with this approach, you may have to repeat the object definition repeatedly. We already informed about referencing the object in other object definitions. I will update again to my product team.
Thanks.
Send us a ticket, we will try our best to assist you with your problem
Osami Ichiyama
Nesting object definitions in SDK
Problems:
Let's say that we make the SDK connector which includes the following nested object definitions.
-----
document: {
fields: lambda do
[
{name: "id"},
{name: "user_id"},
{name: "title"},
{name: "note"},
{name: "message"},
{name: "status", type:"integer"},
{name: "created_at"},
{name: "updated_at"},
{name: "participants", type:"array", of:"participant"},
{name: "files", type:"array", of:"file"}
]
end
},
document_list: {
fields: lambda do
[
{name: "total", type: "integer"},
{name: "page", type: "integer"},
{name: "documents", type:"array", of:"document"}
]
end
}
},
-----
i.e.
"document_list" has an array "documents" of "document".
"document" has arrays "participants" and "files".
When we see the recipe which uses the above connector, we can't access to the fields within "Documents" as the attached screenshot.
To avoid it, we have to make the child object definitions within each top level definition.
Expected behavior:
We should make the nested object definitions and access to the fields on the child objects in the same way as the top level. We should avoid the redundant object definition.