scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.41k stars 225 forks source link

The contents of the array in the form-data are converted to a single string #297

Closed tomyoll closed 2 years ago

tomyoll commented 2 years ago

I'm trying to send a form-data request that describes an array of objects. The problem is that when sending such a request, my server receives an array, the entire content of which is turned into one string.

"requestBody": {
     "content": {
         "multipart/form-data": {
            "schema": {
               "type": "object",
               "properties": {
                   "video[]": {
                    "type": "array",
                    "items": {
                       "type": "object",
                       "properties": {
                          "_id": {
                             "type": "string"
                          }
                       }
                    }
                 }
               }
            },
            "encoding": {
               "video[]": {
                 "contentType": "application/json",
                 "explode": true
               }
            }
         }
     }
 },

What I expect on server: { video: [{ _id: "string" }] }

What I get: { video: [ '{"_id": "string"}' ] }

I use swagger-ui-express 4.4.0

scottie1984 commented 2 years ago

suggest raising this directly with https://github.com/swagger-api/swagger-ui

josip-volarevic commented 1 year ago

@tomyoll Any secret knowledge you've obtained in the last few months that you might share with me?

Kinda have the same issue but haven't managed to dig out a solution