Processing of arrays from an API Spec


#1

Hello,

I have an API route which expects an array of string in the payload. Here’s what the relevant part of the API spec looks like:

"DeviceRegistration": {
      "type": "object",
      "description": "Device Registration",
      "properties": {
        "deviceToken": {
          "type": "string",
          "description": "Device Token"
        },
        "deviceId": {
          "type": "string",
          "description": "Device Id"
        },
        "os": {
          "type": "string",
          "description": "Device OS"
        },
        "osVersion": {
          "type": "string",
          "description": "Device OS Version"
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Channels"
        },
        "expiration": {
          "type": "number",
          "description": "Expire in"
        }
      }
    }

Notice the “channels” element is declared as an array of string objects. When the API spec is imported into Dropsource and I go into configuring the payload, that part of the body looks like this:

I am not sure where these properties (count, endIndex, isEmpty and startIndex) come from, but most importantly, it is not clear how to specify a value which should be sent in that array. I am not sure if the problem is in the API Spec itself or in Dropsource. When I imported the spec into editor.swagger.io, it was processed correctly.

Regards,
Mark


#2

Hi Mark, unfortunately we don’t currently support array parameters to requests in Dropsource. Will you be able to restructure the request to work without sending an array?


#3

Thank you for your reply, @sue. I was trying to use the API we already have. The channels parameter is optional, so it is not a show stopper.


#4

Ah ok hope it isn’t too much of an issue.