rapi-doc / RapiDoc

RapiDoc -WebComponent for OpenAPI Spec
https://rapidocweb.com
MIT License
1.71k stars 285 forks source link

RapiDoc doesn't treat complex data as 'application/json' in 'multipart/form-data' request #1060

Open glprojetinho2 opened 4 days ago

glprojetinho2 commented 4 days ago

Here is a quote from the OpenAPI docs:

If the property is complex, or an array of complex values, the default Content-Type is application/json.

That's not what I'm seeing in this example request:

"/test": {
  "post": {
    "summary": "Tests multipart",
    "operationId": "upload",
    "requestBody": {
      "content": {
        "multipart/form-data": {
          "schema": {
            "type": "string",
            "properties": {
              "shouldBeJson": {
                "type": "object",
                "properties": {}
              }
            }
          }
        }
      },
      "required": true
    },
    "responses": {
      "200": {
        "description": "Success"
      }
    }
  }
}

image Adding encoding doesn't work:

"encoding": {
  "metadata": {
    "contentType": "application/json"
  }
}

image

These requests were made with the help of a minimal actix server that I built to test this: rapidoc.tar.gz This gzip file also contains a Swagger-Ui version of the api docs. It has the same problem, but the "encoding trick" works (not completely) Am I missing something? I'm having a lot of problems with this little thing.