• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Enhancement Requests Application Enhancements

Osami Ichiyama

started a topic almost 6 years ago

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.


nested.png
nested.png
(39.8 KB)
C

Chandra Vippena

said almost 6 years ago

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.

Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

Documentation
Developer's Library
Tutorials
eBooks
Product Hour
Product Blog
Workato Blog
Product updates
Customer Stories
© Workato 2022   Privacy   Terms   +1 (844) 469-6752
  • Documentation
  • Workato Blog
  • Product Blog
  • Solutions
  • Forums
  • Tickets
  • Log in
  • Return to Workato
Topic views count