swagger-converter icon indicating copy to clipboard operation
swagger-converter copied to clipboard

multipart/form-data is converted incorrectly

Open we-zhang opened this issue 4 years ago • 2 comments

Swagger 2.0 multipart/form-data defined as below:

consumes:
       - multipart/form-data
     produces:
       - application/json
     parameters:
       - type: file
         name: artifact
         in: formData
         required: true
       - type: file
         name: metadata
         in: formData

And after converting, in OAS 3, it becomes:

requestBody:
       content:
         multipart/form-data:
           schema:
             required:
               - artifact
             properties:
               artifact:
                 type: string
                 format: binary
               metadata:
                 type: string
                 format: binary

Under schema section, missing type: object property. It should be:

     requestBody:
       content:
         multipart/form-data:
           schema:
             type: object
             required:
               - artifact
             properties:
               artifact:
                 type: string
                 format: binary
               metadata:
                 type: string
                 format: binary

we-zhang avatar Jan 11 '21 17:01 we-zhang

Any update on this? facing the same issue , any work arounds?

Venkat2382 avatar Nov 10 '21 03:11 Venkat2382

The fix is in https://github.com/swagger-api/swagger-parser/pull/1713

RockyMM avatar Apr 21 '22 15:04 RockyMM