OpenAPI request with array of objects body treated as single object without array

For an OpenAPI resource with an endpoint like the following (irrelevant parts omitted):

{
  "/x/{market}/y": {
    "post": {
      "requestBody": {
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": { "$ref": "#/components/schemas/ProductsManualOverride" }
            }
          }
        }
      }
    }
  }
}

the interface in Retool shows the following:

There is no way to remove those request body parameters or somehow change them to an array.

When I fill out the form and send a preview request, the request body does in fact only show a single object instead of an array.

When viewed in Swagger, the array resource is correctly displayed.


Self-hosted Retool version 2.121.5 deployed with the retool-wf Helm chart.

Hi @jeengbe! Happy to take a look at this.

Quick question—does the request fail because of these additional required parameters?

Hi, thanks for your reply!

The issue is that Retool treats the array of objects as a singular object only. Only a single input is expected, and when the request is sent, the body is a single JSON object instead of an array. That in turn causes the request to fail since the API expects an array containing objects.

Hope that helps :slightly_smiling_face:

Ah, got it! This definitely seems like a bug on our end. I've filed an internal ticket for this and will keep you updated with any fixes :slight_smile:

Are you fully blocked here? To be transparent, we're likely not prioritizing this particularly soon, so I just wanted to check with you.

Thank you, I appreciate the transparency.
I haven't actually tried anything yet (low prio feature), but I'm sure I'll find a way around it for the time being :slightly_smiling_face:

1 Like