SaaS Connector ,connector spec, key vale type

:bangbang: Please be sure you’ve read the docs and API specs before asking for help. Also, please be sure you’ve searched the forum for your answer before you create a new topic.

We are currently developing a custom SaaS connector. As part of the design, we need to create a UI that allows users to define mapping criteria through a key-value list. To achieve this, we created a connector spec file using the key-value type as described in the SaaS connectivity documentation.

Our assumption was that the key-value data is stored as an array. However, when we attempt to iterate over it in our code, we encounter a “not an iterable” error once we deploy the connector

We are seeking clarity on the following:

  1. How is the key-value type actually stored/passed to the back end from the UI (e.g., as an array or in another format)?

  2. When testing, how should we correctly specify the config object to represent the expected key-value list?

Here is code snippet of the connector-spec file -

"items": [
  {
    "type": "section",
    "sectionTitle": "Schema Mapping",
    "sectionHelpMessage": "Provide the response attributes to schema attributes mapping",
    "items": [
      {
        "key": "mappingSchema",
        "label": "Mapping criteria",
        "type": "keyValue",
        "keyValueKey": {
          "key": "key",
          "label": "Response attributes",
          "type": "text",
          "required": true,
          "maxlength": "4096"
        },
        "keyValueValue": {
          "key": "value",
          "label": "Schema attribute",
          "type": "text",
          "required": true,
          "maxlength": "4096"
        }
      }
    ]
  }
]

You should be able to do something like this:

for (const name of Object.keys(mappingSchema)) {
   const mapping = mappingSchema[name]
   ....
}

Your testing would be like this:

"mappingSchema": {
       "mapping1": "testing123",
       "mapping2": "testingabc"
}

They get stored as Key-Value pairs under what you define as the key, in this case “mappingSchema”.

"mappingSchema": {
"Response2": "schema2",
"Response1": "schema1"
}

Use the Get Source API to view how it shows up after you have created your source.

Thanks for help.

We have been able to retrieve the key-value list as expected.