OpenAPI Resource: Specification version 3.0.4 does not send request body

Goal: When using an OpenAPI specification of version 3.0.4 in Retool, the resource should correctly send requests with a body.

Steps:

  • Set up an OpenAPI resource in Retool, referencing a specification using version 3.0.4.
  • Ensure that the OpenAPI specification defines endpoints that require a request body (e.g., POST or PUT requests with a request body schema).
  • Attempt to send a request with a JSON payload.
  • Observe that the resource sends no request body, and the Content-Type header is not set.

Details:

  • I have verified that the OpenAPI spec correctly defines the request body schema and works with other tools.
  • The same API functions correctly in Postman and Curl, where the request body is included.
  • I tested switching to OpenAPI 3.0.1, and the issue does not occur. I have not tested versions between 3.0.1 and 3.0.4.
  • Retool does not display any errors, but the resource returns the following response
{
  "status": 415,
  "message": "",
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.16",
  "title": "Unsupported Media Type",
  "traceId": "00-67c18176000000007202f1e27a9c0cc3-de838e925b2fe4ef-00"
}

This suggests that the API is rejecting the request due to the missing Content-Type and request body. I assume this is a bug with the OpenAPI resource in retool and the version 3.0.4
The logs confirm that the request is sent without a body and without a Content-Type header, leading to the API responding with a 415 Unsupported Media Type error.

I hope this helps resolving this issue. Let me know if you need additional information. Following a sample of the specification JSON:

{
  "openapi": "3.0.4",
  "info": {
    "title": "***",
    "version": "1.0.0"
  },
  "servers": [
    ...
  ],
  "paths": {
    "/api/assetgroups": {
      "post": {
        "tags": [
          "AssetGroups"
        ],
        "summary": "CreateAssetGroup",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAssetGroupCommand"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAssetGroupCommand"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAssetGroupCommand"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/GetAssetGroupResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAssetGroupResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAssetGroupResult"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEntryResponse"
                }
              }
            }
          }
        }
      },
      ...
    }
  },
  "components": {
    "schemas": {
      ...
      "CreateAssetGroupCommand": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "assetIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        }
      }
      ...
    }
  },
  "security": [
    ...
  ],
  "tags": [
    ...
  ]
}
2 Likes